This commit is contained in:
parent
020f47b808
commit
4ddc70a314
5
ai.c
5
ai.c
|
@ -57,6 +57,11 @@ enum OBTYPE aigetattackspell(lifeform_t *lf, lifeform_t *victim) {
|
|||
} else {
|
||||
ok = B_TRUE;
|
||||
}
|
||||
} else if (ot->id == OT_A_CRUSH) {
|
||||
// can only crush if you first grab something
|
||||
if (lfhasflag(lf, F_GRABBING)) {
|
||||
ok = B_TRUE;
|
||||
}
|
||||
} else {
|
||||
ok = B_TRUE;
|
||||
}
|
||||
|
|
167
attack.c
167
attack.c
|
@ -296,7 +296,7 @@ int attacklf(lifeform_t *lf, lifeform_t *victim) {
|
|||
sprintf(buf, "%s",attackername);
|
||||
capitalise(buf);
|
||||
|
||||
if (wep && !unarmedflag && (lf->race->id != R_DANCINGWEAPON)) {
|
||||
if (wep && !unarmedflag && (lf->race->id != R_DANCINGWEAPON) && haslos(player, lf->cell)) {
|
||||
sprintf(withwep, " with %s", wepname);
|
||||
} else {
|
||||
strcpy(withwep, "");
|
||||
|
@ -328,16 +328,19 @@ int attacklf(lifeform_t *lf, lifeform_t *victim) {
|
|||
gainhp(victim, dam[i]);
|
||||
}
|
||||
} else {
|
||||
char attackername2[BUFLEN];
|
||||
real_getlfname(lf, attackername2, B_FALSE);
|
||||
// victim loses hp
|
||||
// don't adjust damage - we've already done that
|
||||
if (wep && !unarmedflag) {
|
||||
char wepname[BUFLEN];
|
||||
getobname(wep, wepname, 1);
|
||||
sprintf(buf, "%s^%s %s",attackername,
|
||||
sprintf(buf, "%s^%s %s",attackername2,
|
||||
(lf == victim) ? "using" : "weilding",
|
||||
wepname);
|
||||
} else {
|
||||
strcpy(buf, attackername);
|
||||
char attackername2[BUFLEN];
|
||||
strcpy(buf, attackername2);
|
||||
}
|
||||
|
||||
losehp_real(victim, dam[i], damtype[i], lf, buf, B_FALSE);
|
||||
|
@ -368,7 +371,7 @@ int attacklf(lifeform_t *lf, lifeform_t *victim) {
|
|||
int dam;
|
||||
char lfname[BUFLEN];
|
||||
dam = rolldie(f->val[0], f->val[1]) + f->val[2];
|
||||
getlfname(lf, lfname);
|
||||
real_getlfname(lf, lfname, B_FALSE);
|
||||
losehp_real(victim, dam, DT_BITE, lf, lfname, B_FALSE);
|
||||
if (isplayer(victim) || haslos(player, victim->cell)) {
|
||||
msg("%s bites %s!", lfname, victimname);
|
||||
|
@ -619,8 +622,78 @@ int getarmourdamreduction(lifeform_t *lf, object_t *wep, int dam, enum DAMTYPE d
|
|||
char *getattackverb(enum DAMTYPE damtype, int dam, int maxhp) {
|
||||
float pct;
|
||||
pct = (int)(((float) dam / (float) maxhp) * 100.0);
|
||||
if (damtype == DT_PROJECTILE) {
|
||||
if (damtype == DT_BASH) {
|
||||
if (pct <= 5) {
|
||||
return "whack";
|
||||
} else if (pct <= 20) {
|
||||
if (rnd(1,2) == 1) {
|
||||
return "hit";
|
||||
} else {
|
||||
return "bash";
|
||||
}
|
||||
} else {
|
||||
return "pummel";
|
||||
}
|
||||
} else if (damtype == DT_BITE) {
|
||||
if (pct <= 5) {
|
||||
return "gnaw";
|
||||
} else if (pct <= 30) {
|
||||
return "bite";
|
||||
} else {
|
||||
return "savage";
|
||||
}
|
||||
} else if (damtype == DT_CLAW) {
|
||||
if (pct <= 5) {
|
||||
return "scratch";
|
||||
} else if (pct <= 15) {
|
||||
return "claw";
|
||||
} else if (pct <= 30) {
|
||||
return "tear";
|
||||
} else if (pct <= 40) {
|
||||
return "rake";
|
||||
} else if (pct <= 50) {
|
||||
return "gouge";
|
||||
} else {
|
||||
return "eviscerate";
|
||||
}
|
||||
} else if (damtype == DT_CHOP) {
|
||||
if (pct <= 5) {
|
||||
return "hit";
|
||||
} else if (pct <= 15) {
|
||||
return "hack";
|
||||
} else {
|
||||
return "chop";
|
||||
}
|
||||
} else if (damtype == DT_COLD) {
|
||||
if (pct <= 10) {
|
||||
return "chill";
|
||||
} else {
|
||||
return "freeze";
|
||||
}
|
||||
} else if (damtype == DT_CRUSH) {
|
||||
return "crush";
|
||||
} else if (damtype == DT_ELECTRIC) {
|
||||
if (pct <= 5) {
|
||||
return "zap";
|
||||
} else if (pct <= 15) {
|
||||
return "jolt";
|
||||
} else if (pct <= 20) {
|
||||
return "shock";
|
||||
} else if (pct <= 30) {
|
||||
return "electrify";
|
||||
} else {
|
||||
return "electrocute";
|
||||
}
|
||||
} else if (damtype == DT_FIRE) {
|
||||
if (pct <= 5) {
|
||||
return "scorch";
|
||||
} else if (pct <= 20) {
|
||||
return "burn";
|
||||
} else if (pct <= 40) {
|
||||
return "scald";
|
||||
} else {
|
||||
return "incinerate";
|
||||
}
|
||||
} else if (damtype == DT_HOLY) {
|
||||
switch (rnd(1,2)) {
|
||||
case 1:
|
||||
|
@ -642,32 +715,8 @@ char *getattackverb(enum DAMTYPE damtype, int dam, int maxhp) {
|
|||
}
|
||||
} else if (damtype == DT_POISONGAS) {
|
||||
return "poison";
|
||||
} else if (damtype == DT_ELECTRIC) {
|
||||
if (pct <= 5) {
|
||||
return "zap";
|
||||
} else if (pct <= 15) {
|
||||
return "jolt";
|
||||
} else if (pct <= 20) {
|
||||
return "shock";
|
||||
} else if (pct <= 30) {
|
||||
return "electrify";
|
||||
} else {
|
||||
return "electrocute";
|
||||
}
|
||||
} else if (damtype == DT_CLAW) {
|
||||
if (pct <= 5) {
|
||||
return "scratch";
|
||||
} else if (pct <= 15) {
|
||||
return "claw";
|
||||
} else if (pct <= 30) {
|
||||
return "tear";
|
||||
} else if (pct <= 40) {
|
||||
return "rake";
|
||||
} else if (pct <= 50) {
|
||||
return "gouge";
|
||||
} else {
|
||||
return "eviscerate";
|
||||
}
|
||||
} else if (damtype == DT_PROJECTILE) {
|
||||
return "hit";
|
||||
} else if (damtype == DT_SLASH) {
|
||||
if (pct <= 5) {
|
||||
return "scratch";
|
||||
|
@ -678,58 +727,14 @@ char *getattackverb(enum DAMTYPE damtype, int dam, int maxhp) {
|
|||
} else {
|
||||
return "slice";
|
||||
}
|
||||
} else if (damtype == DT_CHOP) {
|
||||
if (pct <= 5) {
|
||||
return "hit";
|
||||
} else if (pct <= 15) {
|
||||
return "hack";
|
||||
} else {
|
||||
return "chop";
|
||||
}
|
||||
} else if (damtype == DT_BASH) {
|
||||
if (pct <= 5) {
|
||||
return "whack";
|
||||
} else if (pct <= 20) {
|
||||
if (rnd(1,2) == 1) {
|
||||
return "hit";
|
||||
} else {
|
||||
return "bash";
|
||||
}
|
||||
} else {
|
||||
return "pummel";
|
||||
}
|
||||
} else if (damtype == DT_BITE) {
|
||||
if (pct <= 5) {
|
||||
return "gnaw";
|
||||
} else if (pct <= 30) {
|
||||
return "bite";
|
||||
} else {
|
||||
return "savage";
|
||||
}
|
||||
} else if (damtype == DT_FIRE) {
|
||||
if (pct <= 5) {
|
||||
return "scorch";
|
||||
} else if (pct <= 20) {
|
||||
return "burn";
|
||||
} else if (pct <= 40) {
|
||||
return "scald";
|
||||
} else {
|
||||
return "incinerate";
|
||||
}
|
||||
} else if (damtype == DT_COLD) {
|
||||
if (pct <= 10) {
|
||||
return "chill";
|
||||
} else {
|
||||
return "freeze";
|
||||
}
|
||||
} else if (damtype == DT_TOUCH) {
|
||||
return "touch";
|
||||
} else if (damtype == DT_UNARMED) {
|
||||
if (rnd(1,2) == 1) {
|
||||
return "punch";
|
||||
} else {
|
||||
return "hit";
|
||||
}
|
||||
} else if (damtype == DT_TOUCH) {
|
||||
return "touch";
|
||||
}
|
||||
return "hit";
|
||||
}
|
||||
|
@ -786,6 +791,10 @@ char *getkillverb(lifeform_t *victim, enum DAMTYPE damtype, int dam, int maxhp)
|
|||
return "shatter";
|
||||
}
|
||||
|
||||
if (damtype == DT_CRUSH) {
|
||||
return "crush";
|
||||
}
|
||||
|
||||
if (damtype == DT_HOLY) {
|
||||
return "smite";
|
||||
}
|
||||
|
@ -1182,10 +1191,12 @@ void wepeffects(object_t *wep, cell_t *where) {
|
|||
extradam = (int)(dampct * (float)maxdam);
|
||||
if (extradam > 0) {
|
||||
char buf[BUFLEN];
|
||||
char buf2[BUFLEN];
|
||||
char obname[BUFLEN];
|
||||
char damstring[BUFLEN];
|
||||
char victimname[BUFLEN];
|
||||
getlfname(owner, buf);
|
||||
real_getlfname(owner, buf2, B_FALSE);
|
||||
getlfname(victim, victimname);
|
||||
getobname(wep, obname, 1);
|
||||
|
||||
|
@ -1198,7 +1209,7 @@ void wepeffects(object_t *wep, cell_t *where) {
|
|||
f->known = B_TRUE;
|
||||
}
|
||||
|
||||
sprintf(damstring, "%s%s blast of revenge",buf, getpossessive(buf));
|
||||
sprintf(damstring, "%s%s blast of revenge",buf2, getpossessive(buf2));
|
||||
losehp(victim, extradam, DT_DIRECT, owner, damstring);
|
||||
}
|
||||
} // end if dampct > 50
|
||||
|
|
146
defs.h
146
defs.h
|
@ -22,17 +22,20 @@ enum ATTRIB {
|
|||
A_STR = 0,
|
||||
A_DEX = 1,
|
||||
A_IQ = 2,
|
||||
A_CON = 3,
|
||||
};
|
||||
#define MAXATTS 3
|
||||
#define MAXATTS 4
|
||||
|
||||
enum CHECKTYPE {
|
||||
SC_STR,
|
||||
SC_DEX,
|
||||
SC_IQ,
|
||||
SC_CON,
|
||||
//////////
|
||||
SC_DODGE,
|
||||
SC_SLIP,
|
||||
SC_MORALE,
|
||||
SC_OPENLOCKS,
|
||||
};
|
||||
|
||||
enum BURDENED {
|
||||
|
@ -72,7 +75,8 @@ enum LFCONDITION {
|
|||
#define FROMOBACTIVATE (-9868)
|
||||
#define FROMMAT (-9867)
|
||||
#define FROMBLESSING (-9866)
|
||||
#define FROMOBMOD (-9865)
|
||||
#define FROMBRAND (-9865)
|
||||
#define FROMOBMOD (-9864)
|
||||
|
||||
|
||||
#define IFKNOWN (-9772) // used by f_xxconfer. only confer a flag if item is known.
|
||||
|
@ -165,6 +169,7 @@ enum LFCONDITION {
|
|||
#define AO_SPECIFIED 512
|
||||
#define AO_READABLE 1024
|
||||
#define AO_ARMOUR 2048
|
||||
#define AO_NOTKNOWN 4096
|
||||
|
||||
// askcoords target types
|
||||
#define TT_NONE 0
|
||||
|
@ -273,6 +278,7 @@ enum SPELLSCHOOL {
|
|||
};
|
||||
|
||||
enum STRBRACKET {
|
||||
ST_RANDOM = -1,
|
||||
ST_HELPLESS = 0,
|
||||
ST_FEEBLE = 1,
|
||||
ST_VWEAK = 2,
|
||||
|
@ -284,6 +290,7 @@ enum STRBRACKET {
|
|||
};
|
||||
|
||||
enum DEXBRACKET {
|
||||
DX_RANDOM = -1,
|
||||
DX_INCOMPETENT = 0,
|
||||
DX_OAFISH = 1,
|
||||
DX_INEPT = 2,
|
||||
|
@ -298,6 +305,7 @@ enum DEXBRACKET {
|
|||
};
|
||||
|
||||
enum IQBRACKET {
|
||||
IQ_RANDOM = -1,
|
||||
IQ_MINDLESS = 0,
|
||||
IQ_VEGETABLE = 1,
|
||||
IQ_ANIMAL = 2,
|
||||
|
@ -310,6 +318,18 @@ enum IQBRACKET {
|
|||
IQ_GENIUS = 9,
|
||||
};
|
||||
|
||||
enum CONBRACKET {
|
||||
CN_RANDOM = -1,
|
||||
CN_FRAIL = 0,
|
||||
CN_SICKLY = 1,
|
||||
CN_UNHEALTHY = 2,
|
||||
CN_UNFIT = 3,
|
||||
CN_AVERAGE = 4,
|
||||
CN_HEALTHY = 5,
|
||||
CN_FIT = 6,
|
||||
CN_HARDY = 7,
|
||||
};
|
||||
|
||||
// damage type
|
||||
enum DAMTYPE {
|
||||
DT_ALL = -1,
|
||||
|
@ -334,9 +354,11 @@ enum DAMTYPE {
|
|||
DT_TOUCH = 18,
|
||||
DT_POISONGAS = 19,
|
||||
DT_UNARMED = 20,
|
||||
DT_NONE = 21, // for direclty dealt damage, not really any type
|
||||
DT_LIGHT = 21,
|
||||
DT_CRUSH = 22,
|
||||
DT_NONE = 23, // for direclty dealt damage, not really any type
|
||||
};
|
||||
#define MAXDAMTYPE 22
|
||||
#define MAXDAMTYPE 24
|
||||
|
||||
// Object Classes
|
||||
enum OBCLASS {
|
||||
|
@ -390,6 +412,7 @@ enum RACE {
|
|||
R_HUMAN,
|
||||
// monsters
|
||||
R_BUGBEAR,
|
||||
R_DARKMANTLE,
|
||||
R_EYEBAT,
|
||||
R_GIANTHILL,
|
||||
R_GIANTFIRE,
|
||||
|
@ -696,11 +719,13 @@ enum OBTYPE {
|
|||
OT_S_GIFT,
|
||||
// abilities
|
||||
OT_A_GRAB,
|
||||
OT_A_CRUSH,
|
||||
OT_A_JUMP,
|
||||
OT_A_SPRINT,
|
||||
OT_A_DEBUG,
|
||||
OT_A_EMPLOY,
|
||||
OT_A_HEAVYBLOW,
|
||||
OT_A_INSPECT,
|
||||
// wands
|
||||
OT_WAND_COLD,
|
||||
OT_WAND_DETONATION,
|
||||
|
@ -817,6 +842,7 @@ enum OBTYPE {
|
|||
OT_FISTS,
|
||||
OT_TAIL,
|
||||
OT_TEETH,
|
||||
OT_TENTACLE,
|
||||
OT_ZAPPER,
|
||||
// monster weapons
|
||||
OT_ACIDATTACK,
|
||||
|
@ -954,10 +980,11 @@ enum FLAG {
|
|||
F_DTIMMUNE, // immune to damtype val0
|
||||
F_DTRESIST, // half dam from damtype val0
|
||||
F_DTVULN, // double dam from damtype val0
|
||||
// if dam=0, set dam to textfield dice (eg.text="2d6")
|
||||
F_MATIMMUNE, // immune to damage from obs with material 'mat'
|
||||
F_DAMAGABLE, // this ob can be damaged via takedamage()
|
||||
F_TINTED, // when worn on eyes, protects against bright lights
|
||||
F_HASOBMOD, // has the object mod v0 (ie. OM_FLAMESTRIKE)
|
||||
F_HASBRAND, // has the object mod v0 (ie. OM_FLAMESTRIKE)
|
||||
F_HOLDCONFER, // gives flag v0+v1 when carried. v2 specifies if it must be id'd.
|
||||
F_EQUIPCONFER, // gives flag v0+v1 when weilded/worn. v2 specifies if it must be id'd.
|
||||
F_ACTIVATECONFER, // gives flag v0+v1 when activated. v2 specifies if it must be id'd.
|
||||
|
@ -1011,6 +1038,8 @@ enum FLAG {
|
|||
// object mods/effects
|
||||
F_ONFIRE, // burning, also deals extra fire damage
|
||||
F_HEADLESS, // for corpses. can go on LFs too.
|
||||
F_MASTERWORK, // weps do higher damager, armour protects better
|
||||
F_SHODDY, // weps do less damage, armour protects less.
|
||||
// weapon flags
|
||||
F_OBATTACKDELAY, // how long weapon takes to attack
|
||||
F_DAMTYPE, // val0 = damage type
|
||||
|
@ -1077,12 +1106,11 @@ enum FLAG {
|
|||
F_LASTCMD, // text[0] = last command performed, v0/1 = x/y of cell, v2=various
|
||||
F_STARTOB, // val0 = %chance of starting with it, text = ob name
|
||||
// val1,2 = min/max amounts. if NA, min=max=1.
|
||||
F_STARTSKILL, // val0 = skill id
|
||||
F_STARTOBDT, // val0 = %chance of starting with damtype val1
|
||||
F_STARTOBCLASS, // val0 = %chance of starting with obclass val1
|
||||
F_STARTJOB, // val0 = %chance of starting with it, v1 = jobid
|
||||
F_STARTIQ, // val0 = start iq bracket (ie. IQ_GENIUS)
|
||||
F_STARTDEX, // val0 = start dex bracket (ie. DEX_xxx)
|
||||
F_STARTSTR, // val0 = start str bracket (ie. STR_STRONG)
|
||||
F_STARTATT, // val0 = A_xxx, val0 = start bracket (ie. IQ_GENIUS)
|
||||
F_CORPSETYPE, // text field specifies what corpse obtype to leave
|
||||
F_NOCORPSE, // monster's body crumbles to dust after death
|
||||
F_LFSUFFIX, // text = suffix. eg. "skeleton"
|
||||
|
@ -1091,6 +1119,8 @@ enum FLAG {
|
|||
F_GUNTARGET, // current projectile weapon target
|
||||
F_CASTINGSPELL, // set while the player is casting a spell
|
||||
// v0 is spell id
|
||||
// ABILITY FLAGS
|
||||
F_FAILEDINSPECT, // lf has failed an inspect check for item id v0
|
||||
// MONSTER AI FLAGS
|
||||
F_HOSTILE, // lf will attack the player if in sight
|
||||
F_FRIENDLY, // lf will attack all non-players if in sight
|
||||
|
@ -1199,6 +1229,8 @@ enum FLAG {
|
|||
F_TIRED, // you are too tired to sprint
|
||||
F_DODGES, // you dodge missed attacks
|
||||
F_NOTIME, // this lf's actions don't take time
|
||||
// skills
|
||||
F_HASSKILL, // lf has skill v0 at level v1
|
||||
// COMBAT
|
||||
F_HASATTACK, // objecttype id to use when attacking unarmed
|
||||
// if val0-3 are filled in, they override the object's
|
||||
|
@ -1252,12 +1284,13 @@ enum HUNGER {
|
|||
//#define B_NOT (-3)
|
||||
|
||||
enum LIGHTLEV {
|
||||
L_DARK = -1,
|
||||
L_PERMDARK = -1,
|
||||
L_NOTLIT = 0,
|
||||
L_TEMP = 1,
|
||||
L_PERM = 2,
|
||||
L_PERMLIGHT = 2,
|
||||
};
|
||||
|
||||
|
||||
#define B_DIEONFAIL (-1)
|
||||
#define B_BLUNTONFAIL (-2)
|
||||
|
||||
|
@ -1403,6 +1436,8 @@ typedef struct cell_s {
|
|||
struct celltype_s *type;
|
||||
struct obpile_s *obpile;
|
||||
enum LIGHTLEV lit;
|
||||
enum LIGHTLEV origlit;
|
||||
int littimer;
|
||||
|
||||
char *writing;
|
||||
|
||||
|
@ -1528,6 +1563,38 @@ typedef struct material_s {
|
|||
struct material_s *next,*prev;
|
||||
} material_t;
|
||||
|
||||
|
||||
enum SKILL {
|
||||
SK_LOCKPICKING,
|
||||
SK_RESEARCH,
|
||||
};
|
||||
|
||||
// proficiency levels
|
||||
enum SKILLLEVEL {
|
||||
PR_INEPT = 0,
|
||||
PR_NOVICE = 1,
|
||||
PR_BEGINNER = 2,
|
||||
PR_ADEPT = 3,
|
||||
PR_SKILLED = 4,
|
||||
PR_EXPERT = 5,
|
||||
PR_MASTER = 6,
|
||||
};
|
||||
|
||||
|
||||
typedef struct skill_s {
|
||||
enum SKILL id;
|
||||
char *name;
|
||||
char *desc;
|
||||
struct skill_s *next, *prev;
|
||||
} skill_t;
|
||||
|
||||
typedef struct hiddenname_s {
|
||||
enum OBCLASS obclass;
|
||||
char *text;
|
||||
int used;
|
||||
struct hiddenname_s *next, *prev;
|
||||
} hiddenname_t;
|
||||
|
||||
typedef struct knowledge_s {
|
||||
enum OBTYPE id;
|
||||
char *hiddenname;
|
||||
|
@ -1584,34 +1651,49 @@ typedef struct object_s {
|
|||
} object_t;
|
||||
|
||||
enum OBMOD {
|
||||
OM_BALANCE,
|
||||
OM_DEXTERITY,
|
||||
OM_FEEBLENESS,
|
||||
OM_FLIGHT,
|
||||
OM_GIANTSTRENGTH,
|
||||
OM_IMPACT,
|
||||
OM_INTELLIGENCE,
|
||||
OM_KNOWLEDGE,
|
||||
OM_LEVITATION,
|
||||
OM_MAGRESIST,
|
||||
OM_SHARPNESS,
|
||||
OM_PYROMANIA,
|
||||
OM_REVENGE,
|
||||
OM_SLOTH,
|
||||
OM_SPEED,
|
||||
OM_STRENGTH,
|
||||
OM_SWIFTNESS,
|
||||
OM_TELEKINESIS,
|
||||
OM_TELEPATHY,
|
||||
OM_WEAKNESS,
|
||||
OM_FLAMING,
|
||||
OM_HEADLESS,
|
||||
OM_MASTERWORK,
|
||||
OM_SHODDY,
|
||||
};
|
||||
#define MAXOBMODS 4
|
||||
|
||||
enum BRAND {
|
||||
BR_BALANCE,
|
||||
BR_DEXTERITY,
|
||||
BR_FEEBLENESS,
|
||||
BR_FLIGHT,
|
||||
BR_GIANTSTRENGTH,
|
||||
BR_IMPACT,
|
||||
BR_INTELLIGENCE,
|
||||
BR_KNOWLEDGE,
|
||||
BR_LEVITATION,
|
||||
BR_MAGRESIST,
|
||||
BR_SHARPNESS,
|
||||
BR_PYROMANIA,
|
||||
BR_REVENGE,
|
||||
BR_SLOTH,
|
||||
BR_SPEED,
|
||||
BR_STRENGTH,
|
||||
BR_SWIFTNESS,
|
||||
BR_TELEKINESIS,
|
||||
BR_TELEPATHY,
|
||||
BR_WEAKNESS,
|
||||
};
|
||||
|
||||
typedef struct obmod_s {
|
||||
enum OBMOD id;
|
||||
typedef struct brand_s {
|
||||
enum BRAND id;
|
||||
char *description;
|
||||
char *suffix;
|
||||
flagpile_t *flags;
|
||||
enum BODYPART bp;
|
||||
struct brand_s *next, *prev;
|
||||
} brand_t;
|
||||
|
||||
typedef struct obmod_s {
|
||||
enum OBMOD id;
|
||||
char *prefix;
|
||||
flagpile_t *flags;
|
||||
struct obmod_s *next, *prev;
|
||||
} obmod_t;
|
||||
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
defs.h:
|
||||
add A_xxx
|
||||
inc MAXATTS
|
||||
|
||||
add CHECKTYPE (SC_xxx)
|
||||
add xxxBRACKET
|
||||
|
||||
|
||||
lf.c:
|
||||
add getxxxname()
|
||||
update rollstat()
|
||||
add rollxxx()
|
||||
update skillcheck()
|
||||
update gainlevel() question
|
||||
update givejob()
|
||||
|
||||
|
||||
ooooooo replace startxxx with startstat
|
|
@ -13,3 +13,4 @@ in attack.c
|
|||
will dull a weapon.
|
||||
ie. hitting a door with DT_CHOP won't damage the weapon
|
||||
ie. hitting a door with DT_SLASH _will_ damage the weapon
|
||||
|
||||
|
|
5
flag.c
5
flag.c
|
@ -295,10 +295,9 @@ void killflag(flag_t *f) {
|
|||
int howlong;
|
||||
// you get tired when you finish sprinting
|
||||
|
||||
// TODO: change this based on
|
||||
// constitution
|
||||
// running skill
|
||||
howlong = 5;
|
||||
// adjust for constitution
|
||||
howlong = howlong - (int) ((float)howlong * (getstatmod(lf, A_CON) / 100) );
|
||||
addtempflag(f->pile, F_TIRED, B_TRUE, NA, NA, NULL, howlong);
|
||||
}
|
||||
|
||||
|
|
186
io.c
186
io.c
|
@ -806,7 +806,7 @@ int announceflaggain(lifeform_t *lf, flag_t *f) {
|
|||
}
|
||||
break;
|
||||
case F_PRODUCESLIGHT:
|
||||
msg("%s start%s glowing!", lfname, isplayer(lf) ? "" : "s");
|
||||
msg("%s start%s producing light!", lfname, isplayer(lf) ? "" : "s");
|
||||
donesomething = B_TRUE;
|
||||
break;
|
||||
case F_REGENERATES:
|
||||
|
@ -1055,7 +1055,7 @@ int announceflagloss(lifeform_t *lf, flag_t *f) {
|
|||
if (lf2 && !isdead(lf2)) {
|
||||
char buf[BUFLEN];
|
||||
getlfname(lf2, buf);
|
||||
msg("%s releases %s.",buf, lfname);
|
||||
msg("%s break%s free from %s!",lfname, isplayer(lf) ? "" : "s", buf);
|
||||
donesomething = B_TRUE;
|
||||
}
|
||||
break;
|
||||
|
@ -1100,7 +1100,7 @@ int announceflagloss(lifeform_t *lf, flag_t *f) {
|
|||
}
|
||||
break;
|
||||
case F_PRODUCESLIGHT:
|
||||
msg("%s stop%s glowing!", lfname, isplayer(lf) ? "" : "s");
|
||||
msg("%s stop%s glowing.", lfname, isplayer(lf) ? "" : "s");
|
||||
donesomething = B_TRUE;
|
||||
break;
|
||||
case F_REGENERATES:
|
||||
|
@ -1282,15 +1282,15 @@ void announceobflagloss(object_t *o, flag_t *f) {
|
|||
}
|
||||
|
||||
|
||||
object_t *askobject(obpile_t *op, char *prompt, int *count, int opts) {
|
||||
object_t *askobject(obpile_t *op, char *prompt, int *count, long opts) {
|
||||
return doaskobject(op, prompt, count, opts, F_NONE, OC_NULL);
|
||||
}
|
||||
|
||||
object_t *askobjectwithflag(obpile_t *op, char *prompt, int *count, int opts, enum FLAG withflag) {
|
||||
object_t *askobjectwithflag(obpile_t *op, char *prompt, int *count, long opts, enum FLAG withflag) {
|
||||
return doaskobject(op, prompt, count, opts, withflag, OC_NULL);
|
||||
}
|
||||
|
||||
object_t *askobjectofclass(obpile_t *op, char *prompt, int *count, int opts, enum OBCLASS obclass) {
|
||||
object_t *askobjectofclass(obpile_t *op, char *prompt, int *count, long opts, enum OBCLASS obclass) {
|
||||
return doaskobject(op, prompt, count, opts, F_NONE, obclass, OC_NULL);
|
||||
}
|
||||
|
||||
|
@ -1305,7 +1305,7 @@ int contains(enum OBCLASS *array, int nargs, enum OBCLASS want) {
|
|||
return B_FALSE;
|
||||
}
|
||||
|
||||
object_t *doaskobject(obpile_t *op, char *prompt, int *count, int opts, enum FLAG withflag, ...) {
|
||||
object_t *doaskobject(obpile_t *op, char *prompt, int *count, long opts, enum FLAG withflag, ...) {
|
||||
int c,i;
|
||||
object_t *mylist[MAXPILEOBS+1];
|
||||
char myletters[MAXPILEOBS+1];
|
||||
|
@ -1395,40 +1395,7 @@ object_t *doaskobject(obpile_t *op, char *prompt, int *count, int opts, enum FLA
|
|||
ok = B_FALSE;
|
||||
}
|
||||
}
|
||||
if ((opts & AO_ONLYEQUIPPED) && !hasflag(o->flags, F_EQUIPPED)) {
|
||||
ok = B_FALSE;
|
||||
}
|
||||
if ((opts & AO_EQUIPPEDARMOUR)) {
|
||||
flag_t *ff;
|
||||
ff = hasflag(o->flags, F_EQUIPPED);
|
||||
if (!ff) {
|
||||
ok = B_FALSE;
|
||||
} else if (ff->val[0] == BP_WEAPON) {
|
||||
ok = B_FALSE;
|
||||
}
|
||||
}
|
||||
if ((opts & AO_EDIBLE) && !isedible(o)) ok = B_FALSE;
|
||||
if ((opts & AO_READABLE) && !isreadable(o)) ok = B_FALSE;
|
||||
if ((opts & AO_ARMOUR) && (o->type->obclass->id != OC_ARMOUR)) ok = B_FALSE;
|
||||
if ((opts & AO_WEARABLE) && !iswearable(o)) {
|
||||
ok = B_FALSE;
|
||||
}
|
||||
if ((opts & AO_WEILDABLE) && !isweapon(o)) {
|
||||
ok = B_FALSE;
|
||||
}
|
||||
if ((opts & AO_OPERABLE) && !isoperable(o)) {
|
||||
ok = B_FALSE;
|
||||
}
|
||||
if ((opts & AO_POURABLE) && !ispourable(o)) {
|
||||
ok = B_FALSE;
|
||||
}
|
||||
if (opts & AO_NOTIDENTIFIED) {
|
||||
// if ob is identified
|
||||
if (isidentified(o)) {
|
||||
ok = B_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
ok = obmatchescondition(o, opts);
|
||||
if (ok) {
|
||||
mylist[i] = o;
|
||||
myletters[i] = nextlet;
|
||||
|
@ -1573,7 +1540,7 @@ object_t *doaskobject(obpile_t *op, char *prompt, int *count, int opts, enum FLA
|
|||
return NULL;
|
||||
}
|
||||
|
||||
int askobjectmulti(obpile_t *op, char *prompt, int opts) {
|
||||
int askobjectmulti(obpile_t *op, char *prompt, long opts) {
|
||||
int c,i;
|
||||
object_t *mylist[MAXPILEOBS+1];
|
||||
int selected[MAXPILEOBS+1];
|
||||
|
@ -1635,40 +1602,7 @@ int askobjectmulti(obpile_t *op, char *prompt, int opts) {
|
|||
if (o->type->obclass->id == sortorder[c]) {
|
||||
int ok;
|
||||
// can we include this object?
|
||||
ok = B_TRUE;
|
||||
if ((opts & AO_ONLYEQUIPPED) && !hasflag(o->flags, F_EQUIPPED)) {
|
||||
ok = B_FALSE;
|
||||
}
|
||||
if ((opts & AO_EQUIPPEDARMOUR)) {
|
||||
flag_t *ff;
|
||||
ff = hasflag(o->flags, F_EQUIPPED);
|
||||
if (!ff) {
|
||||
ok = B_FALSE;
|
||||
} else if (ff->val[0] == BP_WEAPON) {
|
||||
ok = B_FALSE;
|
||||
}
|
||||
}
|
||||
if ((opts & AO_EDIBLE) && !isedible(o)) ok = B_FALSE;
|
||||
if ((opts & AO_READABLE) && !isreadable(o)) ok = B_FALSE;
|
||||
if ((opts & AO_ARMOUR) && (o->type->obclass->id != OC_ARMOUR)) ok = B_FALSE;
|
||||
if ((opts & AO_WEARABLE) && !iswearable(o)) {
|
||||
ok = B_FALSE;
|
||||
}
|
||||
if ((opts & AO_WEILDABLE) && !isweapon(o)) {
|
||||
ok = B_FALSE;
|
||||
}
|
||||
if ((opts & AO_OPERABLE) && !isoperable(o)) {
|
||||
ok = B_FALSE;
|
||||
}
|
||||
if ((opts & AO_POURABLE) && !ispourable(o)) {
|
||||
ok = B_FALSE;
|
||||
}
|
||||
if (opts & AO_NOTIDENTIFIED) {
|
||||
// if ob is identified
|
||||
if (isidentified(o)) {
|
||||
ok = B_FALSE;
|
||||
}
|
||||
}
|
||||
ok = obmatchescondition(o, opts);
|
||||
|
||||
if (ok) {
|
||||
mylist[i] = o;
|
||||
|
@ -2092,6 +2026,8 @@ void describeob(object_t *o) {
|
|||
|
||||
f = hasflag(o->flags, F_DAM);
|
||||
if (f) {
|
||||
char buf[BUFLEN];
|
||||
char dicebuf[BUFLEN];
|
||||
int mindam,maxdam;
|
||||
getdamrange(o->flags, &mindam, &maxdam);
|
||||
mindam += bonus;
|
||||
|
@ -2099,14 +2035,21 @@ void describeob(object_t *o) {
|
|||
if (mindam < 0) mindam = 0;
|
||||
if (maxdam < 0) maxdam = 0;
|
||||
|
||||
if (mindam == maxdam) {
|
||||
sprintf(buf, "It inflicts %d %s damage",maxdam, getdamname(damtype));
|
||||
} else {
|
||||
sprintf(buf, "It inflicts %d-%d %s damage",mindam,maxdam, getdamname(damtype));
|
||||
}
|
||||
|
||||
if (f->val[2] == NA) {
|
||||
mvwprintw(mainwin, y, 0, "It inflicts %d-%d %s damage (%dd%d).",mindam,maxdam,
|
||||
getdamname(damtype), f->val[0], f->val[1]);
|
||||
sprintf(dicebuf, " (%dd%d).", f->val[0], f->val[1]);
|
||||
} else {
|
||||
mvwprintw(mainwin, y, 0, "It inflicts %d-%d %s damage (%dd%d%c%d).",mindam,maxdam,
|
||||
getdamname(damtype), f->val[0], f->val[1], (f->val[2] > 0) ? '+' : '-', abs(f->val[2]));
|
||||
sprintf(dicebuf, " (%dd%d%c%d).", f->val[0], f->val[1],
|
||||
(f->val[2] > 0) ? '+' : '-',
|
||||
abs(f->val[2]));
|
||||
}
|
||||
strcat(buf,dicebuf);
|
||||
mvwprintw(mainwin, y, 0, "%s",buf);
|
||||
y++;
|
||||
} else {
|
||||
mvwprintw(mainwin, y, 0, "It inflicts %s damage.",getdamname(damtype));
|
||||
|
@ -2198,9 +2141,21 @@ void describeob(object_t *o) {
|
|||
y++;
|
||||
}
|
||||
|
||||
|
||||
// now special flags...
|
||||
y++;
|
||||
|
||||
f = hasflag(o->flags, F_MASTERWORK);
|
||||
if (f && f->known) {
|
||||
mvwprintw(mainwin, y, 0, "It is extremely well crafted.");
|
||||
y++;
|
||||
}
|
||||
f = hasflag(o->flags, F_SHODDY);
|
||||
if (f && f->known) {
|
||||
mvwprintw(mainwin, y, 0, "It is very poorly crafted.");
|
||||
y++;
|
||||
}
|
||||
|
||||
f = hasflag(o->flags, F_ONFIRE);
|
||||
if (f) {
|
||||
mvwprintw(mainwin, y, 0, "It is on fire.");
|
||||
|
@ -2436,7 +2391,7 @@ void describespell(objecttype_t *ot) {
|
|||
|
||||
|
||||
// properties
|
||||
y = 4;
|
||||
y = 5;
|
||||
f = hasflag(ot->flags, F_SPELLLEVEL);
|
||||
if (f) {
|
||||
flag_t *sf;
|
||||
|
@ -2880,7 +2835,7 @@ void domagic(enum OBTYPE spellid, int cellx, int celly) {
|
|||
// add to list
|
||||
poss[nposs] = ot->id;
|
||||
mpcost[nposs] = cost;
|
||||
sprintf(mpdesc[nposs], "(%d MP)", mpcost[nposs]);
|
||||
sprintf(mpdesc[nposs], "(cost: %d MP)", mpcost[nposs]);
|
||||
if (player->mp >= cost) {
|
||||
validspell[nposs] = B_TRUE;
|
||||
} else {
|
||||
|
@ -3529,13 +3484,16 @@ void drawscannedcell(cell_t *cell, int x, int y) {
|
|||
}
|
||||
*/
|
||||
|
||||
void downline(int *y, int h, char *heading, char *subheading) {
|
||||
// returns TRUE if escape pressed
|
||||
int downline(int *y, int h, char *heading, char *subheading) {
|
||||
char headbuf[BUFLEN];
|
||||
int ch;
|
||||
sprintf(headbuf, "%s (continued)", heading);
|
||||
(*y)++;
|
||||
if (*y >= (h-2)) {
|
||||
centre(mainwin, h-1, MORESTRING);
|
||||
getch();
|
||||
ch = getch();
|
||||
if (getch() == 27) { return B_TRUE; }
|
||||
cls(); *y = 0;
|
||||
centre(mainwin, *y, headbuf);
|
||||
*y += 2;
|
||||
|
@ -3544,6 +3502,7 @@ void downline(int *y, int h, char *heading, char *subheading) {
|
|||
doheading(mainwin, y, 0, subheading);
|
||||
}
|
||||
}
|
||||
return B_FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -4502,7 +4461,7 @@ void drawstatus(void) {
|
|||
char waitbuf[BUFLEN];
|
||||
char pname[BUFLEN];
|
||||
flag_t *f;
|
||||
int str,dex,iq;
|
||||
int str,dex,iq,con;
|
||||
|
||||
getplayernamefull(pname);
|
||||
|
||||
|
@ -4599,14 +4558,16 @@ void drawstatus(void) {
|
|||
str = getattr(player, A_STR);
|
||||
dex = getattr(player, A_DEX);
|
||||
iq = getattr(player, A_IQ);
|
||||
con = getattr(player, A_CON);
|
||||
//redraw();
|
||||
sprintf(buf, "HP:%d/%d MP:%d/%d %12sST:%2d%c DX:%2d%c IQ:%2d%c DLev:%2d",
|
||||
sprintf(buf, "HP:%d/%d MP:%d/%d %12sST:%2d%c DX:%2d%c IQ:%2d%c CN:%2d%c DLev:%2d",
|
||||
player->hp,player->maxhp,
|
||||
player->mp, player->maxmp,
|
||||
" ",
|
||||
str, (str == player->baseatt[A_STR]) ? ' ' : '*',
|
||||
dex, (dex == player->baseatt[A_DEX]) ? ' ' : '*',
|
||||
iq, (iq == player->baseatt[A_IQ]) ? ' ' : '*',
|
||||
con, (con == player->baseatt[A_CON]) ? ' ' : '*',
|
||||
player->cell->map->depth
|
||||
);
|
||||
mvwprintw(statwin, 1, 0, buf);
|
||||
|
@ -4938,6 +4899,25 @@ void showlfstats(lifeform_t *lf, int showall) {
|
|||
wprintw(mainwin, "%s", buf); y++;
|
||||
}
|
||||
|
||||
if (showall) {
|
||||
char buf2[BUFLEN];
|
||||
int con;
|
||||
con = getattr(lf, A_CON);
|
||||
getconname(con, buf2);
|
||||
sprintf(buf, "%d (%s)",con, buf2);
|
||||
if (con != lf->baseatt[A_CON]) strcat(buf, "*");
|
||||
mvwprintw(mainwin, y, 0, ftext, "CON");
|
||||
wprintw(mainwin, "%s", buf); y++;
|
||||
} else if (!isplayer(lf)) {
|
||||
int con;
|
||||
// just show name
|
||||
con = getattr(lf, A_CON);
|
||||
getconname(con, buf);
|
||||
if (con != lf->baseatt[A_CON]) strcat(buf, "*");
|
||||
mvwprintw(mainwin, y, 0, ftext, "CON");
|
||||
wprintw(mainwin, "%s", buf); y++;
|
||||
}
|
||||
|
||||
//mvwprintw(mainwin, y, 0, ftext, "XP");
|
||||
//wprintw(mainwin, "%ld (%ld more for next level)", lf->xp, xpneeded); y++;
|
||||
|
||||
|
@ -5344,7 +5324,8 @@ void showlfstats(lifeform_t *lf, int showall) {
|
|||
|
||||
// wait for key
|
||||
centre(mainwin, h-1, "[Press any key]");
|
||||
getch();
|
||||
if (getch() == 27) { drawscreen(); real_clearmsg(B_TRUE); return; }
|
||||
|
||||
if (showall) {
|
||||
int anyfound = B_FALSE;
|
||||
char subheading[BUFLEN];
|
||||
|
@ -5373,13 +5354,28 @@ void showlfstats(lifeform_t *lf, int showall) {
|
|||
}
|
||||
sprintf(buf, "%-12s%s%s", ot->name, ot->desc, expirebuf);
|
||||
mvwprintw(mainwin, y, 0, buf);
|
||||
downline(&y, h, "ABILITIES", NULL);
|
||||
if (downline(&y, h, "ABILITIES", NULL)) {
|
||||
drawscreen(); real_clearmsg(B_TRUE); return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
y++;
|
||||
|
||||
if (hasflag(lf->flags, F_HASSKILL)) {
|
||||
centre(mainwin, y, "SKILLS"); y += 2;
|
||||
for (f = lf->flags->first ; f ; f = f->next) {
|
||||
if (f->id == F_HASSKILL) {
|
||||
mvwprintw(mainwin, y, 0, "- %s %s",getskilllevelname(f->val[1]), getskillname(f->val[0]));
|
||||
if (downline(&y, h, "SKILLS", NULL)) {
|
||||
drawscreen(); real_clearmsg(B_TRUE); return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
centre(mainwin, h-1, "[Press any key]");
|
||||
getch();
|
||||
if (getch() == 27) { drawscreen(); real_clearmsg(B_TRUE); return; }
|
||||
cls(); y = 0;
|
||||
//wmove(mainwin, y, 0);
|
||||
centre(mainwin, y, "SPELLS"); y += 2;
|
||||
|
@ -5408,7 +5404,9 @@ void showlfstats(lifeform_t *lf, int showall) {
|
|||
sprintf(buf, " %-4d%-25s%-22s%s",thislev, ot->name, getschoolname(getspellschool(ot->id)), mpbuf);
|
||||
mvwprintw(mainwin, y, 0, "%s\n", buf);
|
||||
anyfound = B_TRUE;
|
||||
downline(&y, h, "SPELLS", subheading);
|
||||
if (downline(&y, h, "SPELLS", subheading)) {
|
||||
drawscreen(); real_clearmsg(B_TRUE); return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5420,7 +5418,7 @@ void showlfstats(lifeform_t *lf, int showall) {
|
|||
//}
|
||||
|
||||
centre(mainwin, h-1, "[Press any key]");
|
||||
getch();
|
||||
if (getch() == 27) { drawscreen(); real_clearmsg(B_TRUE); return; }
|
||||
cls(); y = 0;
|
||||
|
||||
x = 0; // override
|
||||
|
@ -5630,7 +5628,7 @@ void showlfstats(lifeform_t *lf, int showall) {
|
|||
|
||||
// wait for key
|
||||
centre(mainwin, h-1, "[Press any key]");
|
||||
getch();
|
||||
if (getch() == 27) { drawscreen(); real_clearmsg(B_TRUE); return; }
|
||||
}
|
||||
|
||||
if (!isplayer(lf) && showall) {
|
||||
|
@ -5649,7 +5647,7 @@ void showlfstats(lifeform_t *lf, int showall) {
|
|||
if (y >= (h-3) && (o->next)) {
|
||||
// wait for key
|
||||
centre(mainwin, h-1, "-- More --");
|
||||
getch();
|
||||
if (getch() == 27) { drawscreen(); real_clearmsg(B_TRUE); return; }
|
||||
cls();
|
||||
centre(mainwin, 0, "INVENTORY");
|
||||
y = 2;
|
||||
|
@ -5657,7 +5655,7 @@ void showlfstats(lifeform_t *lf, int showall) {
|
|||
}
|
||||
// wait for key
|
||||
centre(mainwin, h-1, "[Press any key]");
|
||||
getch();
|
||||
if (getch() == 27) { drawscreen(); real_clearmsg(B_TRUE); return; }
|
||||
}
|
||||
|
||||
drawscreen();
|
||||
|
|
12
io.h
12
io.h
|
@ -12,11 +12,11 @@ int announceflaggain(lifeform_t *lf, flag_t *f);
|
|||
int announceflagloss(lifeform_t *lf, flag_t *f);
|
||||
int announceobflaggain(object_t *o, flag_t *f);
|
||||
void announceobflagloss(object_t *o, flag_t *f);
|
||||
object_t *askobject(obpile_t *op, char *title, int *count, int opts);
|
||||
object_t *askobjectwithflag(obpile_t *op, char *title, int *count, int opts, enum FLAG withflag);
|
||||
object_t *askobjectofclass(obpile_t *op, char *title, int *count, int opts, enum OBCLASS obclass);
|
||||
object_t *doaskobject(obpile_t *op, char *title, int *count, int opts, enum FLAG withflag, ...);
|
||||
int askobjectmulti(obpile_t *op, char *prompt, int opts);
|
||||
object_t *askobject(obpile_t *op, char *title, int *count, long opts);
|
||||
object_t *askobjectwithflag(obpile_t *op, char *title, int *count, long opts, enum FLAG withflag);
|
||||
object_t *askobjectofclass(obpile_t *op, char *title, int *count, long opts, enum OBCLASS obclass);
|
||||
object_t *doaskobject(obpile_t *op, char *title, int *count, long opts, enum FLAG withflag, ...);
|
||||
int askobjectmulti(obpile_t *op, char *prompt, long opts);
|
||||
char askchar(char *prompt, char *validchars, char *def, int showchars);
|
||||
cell_t *askcoords(char *prompt, int targettype);
|
||||
char *askstring(char *prompt, char punc, char *retbuf, int retbuflen, char *def);
|
||||
|
@ -59,7 +59,7 @@ void dothrow(obpile_t *op);
|
|||
void dovendingmachine(lifeform_t *lf, object_t *vm);
|
||||
int dowear(obpile_t *op);
|
||||
int doweild(obpile_t *op);
|
||||
void downline(int *y, int h, char *heading, char *subheading);
|
||||
int downline(int *y, int h, char *heading, char *subheading);
|
||||
void drawunviscell(cell_t *cell, int x, int y);
|
||||
void drawcellwithcontents(cell_t *cell, int x, int y);
|
||||
void drawcursor(void);
|
||||
|
|
15
lf.h
15
lf.h
|
@ -4,6 +4,7 @@ lifeform_t *addlf(cell_t *cell, enum RACE rid, int level);
|
|||
lifeform_t *real_addlf(cell_t *cell, enum RACE rid, int level, int controller);
|
||||
job_t *addjob(enum JOB id, char *name);
|
||||
race_t *addrace(enum RACE id, char *name, float weight, char glyph, enum MATERIAL mat);
|
||||
skill_t *addskill(enum SKILL id, char *name, char *desc);
|
||||
void adjustdamlf(lifeform_t *lf, int *amt, enum DAMTYPE damtype);
|
||||
void autotarget(lifeform_t *lf);
|
||||
void autoweild(lifeform_t *lf);
|
||||
|
@ -33,6 +34,7 @@ job_t *findjobbyname(char *name);
|
|||
lifeform_t *findlf(map_t *m, int lfid);
|
||||
race_t *findrace(enum RACE id);
|
||||
race_t *findracebyname(char *name);
|
||||
skill_t *findskill(enum SKILL id);
|
||||
int flee(lifeform_t *lf);
|
||||
int freezelf(lifeform_t *freezee, lifeform_t *freezer, int howlong);
|
||||
void gainhp(lifeform_t *lf, int amt);
|
||||
|
@ -77,6 +79,7 @@ int getmovespeed(lifeform_t *lf);
|
|||
char *getmoveverb(lifeform_t *lf);
|
||||
char *getmoveverbother(lifeform_t *lf);
|
||||
char *getlfname(lifeform_t *lf, char *buf);
|
||||
char *real_getlfname(lifeform_t *lf, char *buf, int usevis);
|
||||
char *getlfnamea(lifeform_t *lf, char *buf);
|
||||
enum LFSIZE getlfsize(lifeform_t *lf);
|
||||
float getlfweight(lifeform_t *lf, int withobs);
|
||||
|
@ -87,17 +90,24 @@ object_t *getrandomarmour(lifeform_t *lf);
|
|||
//int getrandommonlevel(int depth);
|
||||
race_t *getrandomrace(map_t *map);
|
||||
race_t *getreallyrandomrace(void);
|
||||
enum SKILLLEVEL getskill(lifeform_t *lf, enum SKILL id);
|
||||
char *getspeedname(int speed, char *buf);
|
||||
float getstatmod(lifeform_t *lf, enum ATTRIB att);
|
||||
enum CONBRACKET getconname(int str, char *buf);
|
||||
enum STRBRACKET getstrname(int str, char *buf);
|
||||
enum DEXBRACKET getdexname(int dex, char *buf);
|
||||
enum IQBRACKET getiqname(int iq, char *buf);
|
||||
char *getskilldesc(enum SKILL id );
|
||||
char *getskillname(enum SKILL id );
|
||||
char *getskilllevelname(enum SKILLLEVEL sl);
|
||||
int getthrowspeed(int str);
|
||||
object_t *getweapon(lifeform_t *lf);
|
||||
long getxpforlev(int level);
|
||||
void givejob(lifeform_t *lf, enum JOB jobid);
|
||||
void giveobflags(lifeform_t *lf, object_t *o, enum FLAG whattype);
|
||||
int giveskill(lifeform_t *lf, enum SKILL id);
|
||||
void givestartobs(lifeform_t *lf, flagpile_t *fp);
|
||||
void givestartskills(lifeform_t *lf, flagpile_t *fp);
|
||||
map_t *gotolev(lifeform_t *lf, int depth, object_t *fromstairs);
|
||||
job_t *hasjob(lifeform_t *lf, enum JOB job);
|
||||
flag_t *lfhasflag(lifeform_t *lf, enum FLAG fid);
|
||||
|
@ -111,6 +121,7 @@ int haslos(lifeform_t *viewer, cell_t *dest);
|
|||
int hasmr(lifeform_t *lf);
|
||||
void initjobs(void);
|
||||
void initrace(void);
|
||||
void initskills(void);
|
||||
void interrupt(lifeform_t *lf);
|
||||
int isairborne(lifeform_t *lf);
|
||||
int isbleeding(lifeform_t *lf);
|
||||
|
@ -141,6 +152,7 @@ lifeform_t *makezombie(object_t *o);
|
|||
void mayusespellschool(flagpile_t *fp, enum SPELLSCHOOL ss, enum FLAG how);
|
||||
int modattr(lifeform_t *lf, enum ATTRIB attr, int amt);
|
||||
void modhunger(lifeform_t *lf, int amt);
|
||||
float modifybystat(float num, lifeform_t *lf, enum ATTRIB att);
|
||||
void outfitlf(lifeform_t *lf);
|
||||
int pickup(lifeform_t *lf, object_t *what, int howmany, int fromground);
|
||||
void precalclos(lifeform_t *lf);
|
||||
|
@ -148,6 +160,7 @@ int push(lifeform_t *lf, object_t *o, int dir);
|
|||
void relinklf(lifeform_t *src, map_t *dst);
|
||||
int rest(lifeform_t *lf, int onpurpose);
|
||||
void startresting(lifeform_t *lf);
|
||||
int rollcon(enum CONBRACKET bracket);
|
||||
int rolldex(enum DEXBRACKET bracket);
|
||||
int rolliq(enum IQBRACKET bracket);
|
||||
int rollstr(enum STRBRACKET bracket);
|
||||
|
@ -160,6 +173,8 @@ void setrace(lifeform_t *lf, enum RACE rid);
|
|||
void setlastdam(lifeform_t *lf, char *buf);
|
||||
int shoot(lifeform_t *lf);
|
||||
int skillcheck(lifeform_t *lf, enum CHECKTYPE ct, int diff, int mod);
|
||||
int real_skillcheck(lifeform_t *lf, enum CHECKTYPE ct, int diff, int mod, int *result);
|
||||
int skillcheckvs(lifeform_t *lf1, enum CHECKTYPE ct1, int mod1, lifeform_t *lf2, enum CHECKTYPE ct2, int mod2);
|
||||
int slipon(lifeform_t *lf, object_t *o);
|
||||
void sortlf(map_t *map, lifeform_t *lf);
|
||||
int stone(lifeform_t *lf);
|
||||
|
|
46
map.c
46
map.c
|
@ -32,6 +32,8 @@ cell_t *addcell(map_t *m, int x, int y) {
|
|||
cell->lf = NULL;
|
||||
cell->roomid = -1;
|
||||
cell->lit = L_NOTLIT;
|
||||
cell->origlit = L_NOTLIT;
|
||||
cell->littimer = 0;
|
||||
cell->writing = NULL;
|
||||
cell->known = B_FALSE;
|
||||
return cell;
|
||||
|
@ -358,7 +360,8 @@ void calclight(map_t *map) {
|
|||
for (y = 0; y < map->h; y++) {
|
||||
for (x = 0; x < map->w; x++) {
|
||||
c = getcellat(map, x,y);
|
||||
if (c && (c->lit == L_PERM) && (c->lit != L_DARK)) c->lit = B_FALSE;
|
||||
//if (c && (c->lit == L_PERMLIGHT) && (c->lit != L_PERMDARK)) c->lit = B_FALSE;
|
||||
if (c && (c->lit != L_PERMLIGHT) && (c->lit != L_PERMDARK)) c->lit = B_FALSE;
|
||||
}
|
||||
}
|
||||
for (y = 0; y < map->h; y++) {
|
||||
|
@ -367,23 +370,28 @@ void calclight(map_t *map) {
|
|||
if (c) {
|
||||
int radius;
|
||||
object_t *o;
|
||||
|
||||
// lit based on depth
|
||||
if ((map->depth <= 5) && (c->lit != L_DARK)) {
|
||||
c->lit = L_PERM;
|
||||
if ((map->depth <= 5) && (c->lit != L_PERMDARK)) {
|
||||
c->lit = L_PERMLIGHT;
|
||||
}
|
||||
|
||||
// TODO: has dark producing lf?
|
||||
// TODO: has dark producing object?
|
||||
|
||||
// has lightproducing lf? (ie.hasflag f_produceslight)
|
||||
if (c->lf) {
|
||||
if (lfhasflag(c->lf, F_PRODUCESLIGHT)) {
|
||||
sumflags(c->lf->flags, F_PRODUCESLIGHT, &radius, NULL, NULL);
|
||||
|
||||
makelitradius(c, radius, L_TEMP);
|
||||
makelitradius(c, radius, L_TEMP, -1);
|
||||
}
|
||||
// objects in hands or on body...
|
||||
for (o = c->lf->pack->first ; o ; o = o->next) {
|
||||
if (obproduceslight(o) && isequipped(o)) {
|
||||
sumflags(o->flags, F_PRODUCESLIGHT, &radius, NULL, NULL);
|
||||
|
||||
makelitradius(c, radius, L_TEMP);
|
||||
makelitradius(c, radius, L_TEMP, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -391,7 +399,7 @@ void calclight(map_t *map) {
|
|||
for (o = c->obpile->first ; o ; o = o->next) {
|
||||
if (obproduceslight(o)) {
|
||||
sumflags(o->flags, F_PRODUCESLIGHT, &radius, NULL, NULL);
|
||||
makelitradius(c, radius, L_TEMP);
|
||||
makelitradius(c, radius, L_TEMP, -1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1244,7 +1252,9 @@ void createroom(map_t *map, int minx, int miny, int w, int h, int roomid) {
|
|||
// make it a border or room
|
||||
if ((y == miny) || (y == maxy) ||
|
||||
(x == minx) || (x == maxx)) {
|
||||
if (cell->type->solid) {
|
||||
setcelltype(cell, CT_ROOMWALL);
|
||||
}
|
||||
} else {
|
||||
setcelltype(cell, CT_ROOM);
|
||||
}
|
||||
|
@ -1835,6 +1845,9 @@ int getslipperyness(cell_t *c, object_t **slipob) {
|
|||
thisslip *= o->amt;
|
||||
totalslip += thisslip;
|
||||
}
|
||||
|
||||
totalslip *= 2;
|
||||
|
||||
return totalslip;
|
||||
}
|
||||
|
||||
|
@ -1951,7 +1964,7 @@ int isinscanrange(cell_t *c, void **thing, char *desc, char *glyph) {
|
|||
int islit(cell_t *c) {
|
||||
switch (c->lit) {
|
||||
case L_TEMP:
|
||||
case L_PERM:
|
||||
case L_PERMLIGHT:
|
||||
return B_TRUE;
|
||||
default:
|
||||
break;
|
||||
|
@ -2034,16 +2047,23 @@ void makedoor(cell_t *cell) {
|
|||
}
|
||||
|
||||
|
||||
void makelit(cell_t *c, enum LIGHTLEV how) {
|
||||
void makelit(cell_t *c, enum LIGHTLEV how, int howlong) {
|
||||
// don't override permenant light with temp light!
|
||||
if ((c->lit == L_PERM) && (how == L_TEMP)) {
|
||||
//if ((c->lit == L_PERMLIGHT) && (how == L_TEMP)) {
|
||||
if (how == L_TEMP) {
|
||||
//if ((c->lit == L_PERMLIGHT) || (c->lit == L_PERMDARK)) {
|
||||
if (c->lit == L_PERMLIGHT) {
|
||||
return;
|
||||
} else {
|
||||
c->lit = how;
|
||||
}
|
||||
}
|
||||
if (howlong > 0) {
|
||||
c->littimer = howlong;
|
||||
c->origlit = c->lit;
|
||||
}
|
||||
c->lit = how;
|
||||
}
|
||||
|
||||
void makelitradius(cell_t *c, int radius, enum LIGHTLEV how) {
|
||||
void makelitradius(cell_t *c, int radius, enum LIGHTLEV how, int howlong) {
|
||||
int x,y;
|
||||
cell_t *c2;
|
||||
|
||||
|
@ -2054,7 +2074,7 @@ void makelitradius(cell_t *c, int radius, enum LIGHTLEV how) {
|
|||
c2 = getcellat(c->map, x, y);
|
||||
if (c2 && (getcelldistorth(c, c2) <= radius)) {
|
||||
if (cellhaslos(c,c2)) {
|
||||
makelit(c2, how);
|
||||
makelit(c2, how,howlong);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
4
map.h
4
map.h
|
@ -50,7 +50,7 @@ int isnewcellok(cell_t *cell, char *err);
|
|||
int isonmap(map_t *map, int x, int y);
|
||||
int iswallindir(cell_t *cell, int dir);
|
||||
void makedoor(cell_t *cell);
|
||||
void makelit(cell_t *c, enum LIGHTLEV how);
|
||||
void makelitradius(cell_t *c, int radius, enum LIGHTLEV how);
|
||||
void makelit(cell_t *c, enum LIGHTLEV how, int howlong);
|
||||
void makelitradius(cell_t *c, int radius, enum LIGHTLEV how, int howlong);
|
||||
void setcelltype(cell_t *cell, int id);
|
||||
void updateknowncells(void);
|
||||
|
|
45
move.c
45
move.c
|
@ -18,6 +18,8 @@ extern lifeform_t *player;
|
|||
extern int statdirty;
|
||||
extern int needredraw;
|
||||
|
||||
extern int gamestarted;
|
||||
|
||||
extern enum ERROR reason;
|
||||
extern void *rdata;
|
||||
|
||||
|
@ -454,6 +456,16 @@ int movelf(lifeform_t *lf, cell_t *newcell) {
|
|||
}
|
||||
}
|
||||
|
||||
// remove grabs
|
||||
f = lfhasflag(lf, F_GRABBING);
|
||||
if (f) {
|
||||
lifeform_t *grabee;
|
||||
grabee = findlf(NULL, f->val[0]);
|
||||
assert(grabee);
|
||||
killflagsofid(grabee->flags, F_GRABBEDBY);
|
||||
killflagsofid(lf->flags, F_GRABBING);
|
||||
}
|
||||
|
||||
|
||||
// check ground objects
|
||||
if (!isairborne(lf)) {
|
||||
|
@ -522,6 +534,7 @@ int movelf(lifeform_t *lf, cell_t *newcell) {
|
|||
}
|
||||
|
||||
// does anyone else see you?
|
||||
if (gamestarted) {
|
||||
for (l = newcell->map->lf ; l ; l = l->next) {
|
||||
if (l != lf) {
|
||||
if (haslos(l, newcell)) {
|
||||
|
@ -537,6 +550,7 @@ int movelf(lifeform_t *lf, cell_t *newcell) {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return didmsg;
|
||||
}
|
||||
|
@ -545,6 +559,10 @@ int movelf(lifeform_t *lf, cell_t *newcell) {
|
|||
// does other game things like telling the player
|
||||
// what is here.
|
||||
int moveto(lifeform_t *lf, cell_t *newcell) {
|
||||
return real_moveto(lf,newcell,B_FALSE);
|
||||
}
|
||||
|
||||
int real_moveto(lifeform_t *lf, cell_t *newcell, int dontclearmsg) {
|
||||
char lfname[BUFLEN];
|
||||
int didmsg;
|
||||
|
||||
|
@ -553,6 +571,10 @@ int moveto(lifeform_t *lf, cell_t *newcell) {
|
|||
// actually do the move
|
||||
didmsg = movelf(lf, newcell);
|
||||
|
||||
if (dontclearmsg) {
|
||||
didmsg = B_TRUE;
|
||||
}
|
||||
|
||||
// tell player about things
|
||||
if (!isdead(lf)) {
|
||||
// some lifeforms can go through things
|
||||
|
@ -1058,14 +1080,27 @@ int trymove(lifeform_t *lf, int dir) {
|
|||
taketime(lf, getmovespeed(lf));
|
||||
break;
|
||||
case E_GRABBEDBY:
|
||||
if (isplayer(lf)) {
|
||||
char lfname[BUFLEN];
|
||||
if (rdata) {
|
||||
getlfname((lifeform_t *)rdata, lfname);
|
||||
lifeform_t *grabbedby;
|
||||
char gbname[BUFLEN];
|
||||
// skill check to escape.
|
||||
grabbedby = (lifeform_t *)rdata;
|
||||
getlfname(grabbedby, gbname);
|
||||
if (!cell->lf && skillcheckvs(lf, SC_STR, 0, grabbedby, SC_STR, 0)) {
|
||||
// broke free
|
||||
killflagsofid(lf->flags, F_GRABBEDBY);
|
||||
killflagsofid(grabbedby->flags, F_GRABBING);
|
||||
// move - don't clear the 'you break free from' msg
|
||||
real_moveto(lf, cell, B_TRUE);
|
||||
} else {
|
||||
sprintf(lfname, "whatever is holding you");
|
||||
if (isplayer(lf)) {
|
||||
msg("You cannot get away from %s!",gbname);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (isplayer(lf)) {
|
||||
msg("You cannot get away from whatever is holding you!");
|
||||
}
|
||||
msg("You cannot get away from %s!",lfname);
|
||||
}
|
||||
taketime(lf, getmovespeed(lf));
|
||||
break;
|
||||
|
|
1
move.h
1
move.h
|
@ -14,6 +14,7 @@ int knockback(lifeform_t *lf, int dir, int howfar, lifeform_t *pusher);
|
|||
int moveawayfrom(lifeform_t *lf, cell_t *dst);
|
||||
int movelf(lifeform_t *lf, cell_t *newcell);
|
||||
int moveto(lifeform_t *lf, cell_t *newcell);
|
||||
int real_moveto(lifeform_t *lf, cell_t *newcell, int dontclearmsg);
|
||||
int movetowards(lifeform_t *lf, cell_t *dst);
|
||||
int opendoorat(lifeform_t *lf, cell_t *c);
|
||||
int opendoor(lifeform_t *lf, object_t *o);
|
||||
|
|
49
nexus.c
49
nexus.c
|
@ -19,13 +19,16 @@
|
|||
material_t *material = NULL,*lastmaterial = NULL;
|
||||
objectclass_t *objectclass = NULL,*lastobjectclass = NULL;
|
||||
objecttype_t *objecttype = NULL,*lastobjecttype = NULL;
|
||||
brand_t *firstbrand = NULL,*lastbrand = NULL;
|
||||
obmod_t *firstobmod = NULL,*lastobmod = NULL;
|
||||
celltype_t *firstcelltype = NULL,*lastcelltype = NULL;
|
||||
command_t *firstcommand = NULL,*lastcommand = NULL;
|
||||
race_t *firstrace = NULL,*lastrace = NULL;
|
||||
job_t *firstjob = NULL,*lastjob = NULL;
|
||||
skill_t *firstskill = NULL,*lastskill = NULL;
|
||||
map_t *firstmap = NULL,*lastmap = NULL;
|
||||
knowledge_t *knowledge = NULL, *lastknowledge = NULL;
|
||||
hiddenname_t *firsthiddenname = NULL, *lasthiddenname = NULL;
|
||||
|
||||
// maintains unique lifeform ID numbers
|
||||
long nextlfid = 0;
|
||||
|
@ -311,7 +314,7 @@ void cleanup(void) {
|
|||
|
||||
// free maps
|
||||
// free knowledge
|
||||
// free obmods
|
||||
// free brands
|
||||
// free obtypes
|
||||
// free objects
|
||||
// free materials
|
||||
|
@ -447,7 +450,7 @@ void getrarity(int depth, int *min, int *max, int range) {
|
|||
//*max = mid + range; if (*max > 100) *max = 100;
|
||||
*max = 100;
|
||||
|
||||
if (*min > 75) *min = 75;
|
||||
if (*min > 85) *min = 85;
|
||||
if (*max < 25) *max = 25;
|
||||
}
|
||||
|
||||
|
@ -459,6 +462,7 @@ int init(void) {
|
|||
|
||||
initcommands();
|
||||
initobjects();
|
||||
initskills();
|
||||
initjobs();
|
||||
initrace();
|
||||
|
||||
|
@ -572,7 +576,10 @@ int rolldie(int ndice, int sides) {
|
|||
int rollhitdice(lifeform_t *lf) {
|
||||
flag_t *f;
|
||||
int ndice, plus;
|
||||
int roll;
|
||||
int roll = 0;
|
||||
int i;
|
||||
float mod;
|
||||
int db = B_TRUE;
|
||||
|
||||
f = hasflag(lf->flags, F_HITDICE);
|
||||
if (f) {
|
||||
|
@ -583,7 +590,33 @@ int rollhitdice(lifeform_t *lf) {
|
|||
ndice = 1;
|
||||
plus = 0;
|
||||
}
|
||||
roll = rolldie(ndice, 4) + plus;
|
||||
if (db && isplayer(lf)) dblog("rollhitdice() - rolling %dd4 + %d",ndice,plus);
|
||||
|
||||
mod = getstatmod(lf, A_CON);
|
||||
if (mod > 0) mod *= 2;
|
||||
if (db && isplayer(lf)) dblog("rollhitdice() - mod is +%0.0f%%",mod);
|
||||
|
||||
if (ndice == 0) {
|
||||
int thisroll;
|
||||
// just the bonus
|
||||
thisroll = plus;
|
||||
thisroll = thisroll + (int)((float)thisroll * (mod/100));
|
||||
if (thisroll < 1) thisroll = 1;
|
||||
|
||||
roll += thisroll;
|
||||
} else {
|
||||
for (i = 0; i < ndice; i++) {
|
||||
int thisroll;
|
||||
thisroll = rolldie(1, 4) + plus;
|
||||
if (thisroll < 1) thisroll = 1;
|
||||
if (db && isplayer(lf)) dblog("rollhitdice() ---- die %d/%d == %d",i+1,ndice,thisroll);
|
||||
|
||||
roll += thisroll;
|
||||
}
|
||||
}
|
||||
if (db && isplayer(lf)) dblog("TOTAL: %d",roll);
|
||||
roll = roll + (int)((float)roll * (mod/100));
|
||||
if (db && isplayer(lf)) dblog(" -> modified to: %d",roll);
|
||||
return roll;
|
||||
}
|
||||
|
||||
|
@ -808,6 +841,14 @@ void timeeffectsworld(map_t *map) {
|
|||
|
||||
timeeffectsob(o);
|
||||
} // end foreach object here
|
||||
|
||||
// expire light effects
|
||||
if (c->littimer > 0) {
|
||||
c->littimer--;
|
||||
if (c->littimer == 0) {
|
||||
c->lit = c->origlit;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // end for (y...
|
||||
|
|
|
@ -2,14 +2,16 @@
|
|||
#define __OBJECTS_H
|
||||
#include "defs.h"
|
||||
|
||||
brand_t *addbrand(enum BRAND id, char *suffix, enum BODYPART bp);
|
||||
object_t *addemptyob(obpile_t *where, object_t *o);
|
||||
hiddenname_t *addhiddenname(enum OBCLASS obclass, char *text);
|
||||
knowledge_t *addknowledge(enum OBCLASS id, char *hiddenname, int known);
|
||||
material_t *addmaterial(enum MATERIAL id, char *name, float weightrating);
|
||||
objectclass_t *addoc(enum OBCLASS id, char *name, char *desc, char glyph);
|
||||
object_t *addob(obpile_t *where, char *name);
|
||||
object_t *addobject(obpile_t *where, char *name, int canstack);
|
||||
int addobburst(cell_t *where, int range, int dirtype, char *name);
|
||||
obmod_t *addobmod(enum OBMOD id, char *suffix, enum BODYPART bp);
|
||||
obmod_t *addobmod(enum OBMOD id, char *prefix);
|
||||
obpile_t *addobpile(lifeform_t *owner, cell_t *where);
|
||||
objecttype_t *addot(int id, char *name, char *description, int material, float weight, int obclassid);
|
||||
void adjustdammaterial(unsigned int *dam, enum DAMTYPE damtype, enum MATERIAL mat);
|
||||
|
@ -33,6 +35,7 @@ material_t *findmaterial(int id);
|
|||
objectclass_t *findoc(int id);
|
||||
object_t *findobbyid(obpile_t *op, long oid);
|
||||
object_t *findobl(obpile_t *op, char let); // find object by letter
|
||||
brand_t *findbrand(enum BRAND id);
|
||||
obmod_t *findobmod(enum OBMOD id);
|
||||
objecttype_t *findot(enum OBTYPE id);
|
||||
objecttype_t *findotn(char *name); // find objecttype by name
|
||||
|
@ -141,7 +144,8 @@ object_t *obexists(enum OBTYPE obid);
|
|||
void obdie(object_t *o);
|
||||
int obfits(object_t *o, obpile_t *op);
|
||||
enum DAMTYPE oblastdamtype(object_t *o);
|
||||
int obmodappliesto(obmod_t *om, objecttype_t *ot);
|
||||
int brandappliesto(brand_t *om, objecttype_t *ot);
|
||||
int obmatchescondition(object_t *o, long opts);
|
||||
flag_t *obproduceslight(object_t *o);
|
||||
int obpropsmatch(object_t *a, object_t *b);
|
||||
int obotpropsmatch(object_t *a, objecttype_t *b);
|
||||
|
|
8
save.c
8
save.c
|
@ -315,8 +315,8 @@ map_t *loadmap(char *basefile) {
|
|||
*/
|
||||
|
||||
// cell info
|
||||
fscanf(f, "%d,%d,%d,%d,%d\n",
|
||||
&c->roomid, &celltypeid, &c->known, &c->visited, &c->lit);
|
||||
fscanf(f, "%d,%d,%d,%d,%d,%d,%d\n",
|
||||
&c->roomid, &celltypeid, &c->known, &c->visited, &c->lit, &c->origlit, &c->littimer);
|
||||
|
||||
|
||||
ct = findcelltype(celltypeid);
|
||||
|
@ -725,8 +725,8 @@ int savemap(map_t *m) {
|
|||
cell_t *c;
|
||||
c = getcellat(m, x, y);
|
||||
// cell info
|
||||
fprintf(f, "%d,%d,%d,%d,%d\n",
|
||||
c->roomid, c->type->id, c->known, c->visited,c->lit);
|
||||
fprintf(f, "%d,%d,%d,%d,%d,%d,%d\n",
|
||||
c->roomid, c->type->id, c->known, c->visited,c->lit,c->origlit,c->littimer);
|
||||
// cell objects
|
||||
for (o = c->obpile->first ; o ; o = o->next) {
|
||||
fprintf(f, "ob:%ld\n",o->id);
|
||||
|
|
170
spell.c
170
spell.c
|
@ -32,6 +32,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef
|
|||
if (abilid == OT_A_GRAB) {
|
||||
char dirch;
|
||||
flag_t *f;
|
||||
char targetname[BUFLEN];
|
||||
|
||||
f = lfhasflag(user, F_GRABBING);
|
||||
if (f) {
|
||||
|
@ -68,8 +69,66 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef
|
|||
return B_TRUE;
|
||||
}
|
||||
|
||||
getlfname(target, targetname);
|
||||
|
||||
// victim gets a skilcheck to avoid being grabbed
|
||||
if (skillcheck(target, SC_DODGE, getattr(user, A_DEX)+11, 0)) {
|
||||
msg("%s evade%s %s%s grasp.", targetname, isplayer(target) ? "" : "s",
|
||||
username, getpossessive(username));
|
||||
} else {
|
||||
addflag(user->flags, F_GRABBING, target->id, NA, NA, NULL);
|
||||
addflag(target->flags, F_GRABBEDBY, user->id, NA, NA, NULL);
|
||||
}
|
||||
taketime(user, getactspeed(user));
|
||||
} else if (abilid == OT_A_CRUSH) {
|
||||
flag_t *f;
|
||||
lifeform_t *grabee;
|
||||
char gbname[BUFLEN];
|
||||
int dam = 0;
|
||||
|
||||
if (isimmobile(user)) {
|
||||
if (isplayer(user)) msg("You cannot move!");
|
||||
return B_TRUE;
|
||||
}
|
||||
|
||||
f = lfhasflag(user, F_GRABBING);
|
||||
if (!f) {
|
||||
if (isplayer(user)) msg("You need to hold someone before using this ability.");
|
||||
return B_TRUE;
|
||||
}
|
||||
grabee = findlf(NULL, f->val[0]);
|
||||
|
||||
assert(grabee);
|
||||
getlfname(grabee, gbname);
|
||||
|
||||
// announce
|
||||
if (haslos(player, grabee->cell)) {
|
||||
msg("%s squeeze%s %s tightly!", username, isplayer(user) ? "" : "s", gbname);
|
||||
}
|
||||
|
||||
// victim gets a skilcheck to avoid damage...
|
||||
if (skillcheckvs(grabee, SC_STR, 0, user, SC_STR, 1)) {
|
||||
if (haslos(player, grabee->cell)) {
|
||||
// broke free
|
||||
killflagsofid(grabee->flags, F_GRABBEDBY);
|
||||
killflagsofid(user->flags, F_GRABBING);
|
||||
}
|
||||
} else {
|
||||
char killername[BUFLEN];
|
||||
int str;
|
||||
// determine damage baesd on crusher's strength
|
||||
str = getattr(user, A_STR);
|
||||
dam = modifybystat((str/2), user, A_STR);
|
||||
|
||||
// announce
|
||||
if (haslos(player, grabee->cell)) {
|
||||
msg("%s %s being crushed!", gbname, isplayer(grabee) ? "are" : "is");
|
||||
}
|
||||
|
||||
real_getlfname(user,killername, B_FALSE);
|
||||
losehp(grabee, dam, DT_CRUSH, user, killername);
|
||||
}
|
||||
taketime(user, getactspeed(user));
|
||||
} else if (abilid == OT_A_JUMP) {
|
||||
lifeform_t *victim = NULL;
|
||||
char victimname[BUFLEN];
|
||||
|
@ -196,10 +255,17 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef
|
|||
}
|
||||
return B_TRUE;
|
||||
}
|
||||
// TODO: calculate time based on:
|
||||
// constitution (or max hp?)
|
||||
// running speed
|
||||
howlong = 5;
|
||||
// modify for constitution
|
||||
howlong = modifybystat(howlong, user, A_CON);
|
||||
|
||||
if (howlong <= 1) {
|
||||
if (isplayer(user)) {
|
||||
msg("You are too unfit to sprint.");
|
||||
}
|
||||
return B_TRUE;
|
||||
}
|
||||
|
||||
addtempflag(user->flags, F_SPRINTING, B_TRUE, NA, NA, NULL, howlong);
|
||||
} else if (abilid == OT_A_DEBUG) {
|
||||
cell_t *where;
|
||||
|
@ -289,6 +355,71 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef
|
|||
f = addflag(wep->flags, F_HEAVYBLOW, B_TRUE, NA, NA, NULL);
|
||||
attackcell(user, targcell);
|
||||
killflag(f);
|
||||
} else if (abilid == OT_A_INSPECT) {
|
||||
object_t *o;
|
||||
int difficulty;
|
||||
int rarity;
|
||||
int mod;
|
||||
enum SKILLLEVEL slev;
|
||||
flag_t *f;
|
||||
|
||||
// only players can do this
|
||||
if (!isplayer(user)) {
|
||||
return B_TRUE;
|
||||
}
|
||||
|
||||
|
||||
// blind?
|
||||
if (isblind(user)) {
|
||||
msg("You must be able to see before you can inspect something.");
|
||||
return B_TRUE;
|
||||
}
|
||||
|
||||
// ask what to inspect
|
||||
o = askobject(user->pack, "Inspect which object", NULL, AO_NOTKNOWN);
|
||||
if (!o) {
|
||||
msg("Cancelled");
|
||||
return B_TRUE;
|
||||
}
|
||||
|
||||
if (isknown(o)) {
|
||||
msg("You already know what that is!");
|
||||
return B_TRUE;
|
||||
}
|
||||
|
||||
// failed this already?
|
||||
if (lfhasflagval(user, F_FAILEDINSPECT, o->type->id, NA, NA, NULL)) {
|
||||
msg("You won't be able to recognise this until you are more experienced.");
|
||||
return B_TRUE;
|
||||
}
|
||||
// skillcheck...
|
||||
f = hasflag(o->flags, F_RARITY);
|
||||
if (f) {
|
||||
rarity = f->val[1];
|
||||
} else {
|
||||
rarity = 0;
|
||||
}
|
||||
difficulty = 25 + ((100 - rarity) / 5);
|
||||
slev = getskill(user, SK_RESEARCH);
|
||||
switch (slev) {
|
||||
case PR_INEPT:
|
||||
mod = -5;
|
||||
break;
|
||||
default:
|
||||
mod = slev*4;
|
||||
break;
|
||||
}
|
||||
if (skillcheck(user, SC_IQ, difficulty, mod)) {
|
||||
char obname[BUFLEN];
|
||||
// passed!
|
||||
makeknown(o->type->id);
|
||||
getobname(o, obname, o->amt);
|
||||
msgnocap("This seems to be %s!", obname);
|
||||
} else {
|
||||
msg("You are not yet sure what this is.");
|
||||
addflag(user->flags, F_FAILEDINSPECT, o->type->id, NA, NA, NULL);
|
||||
}
|
||||
taketime(user, getactspeed(user));
|
||||
}
|
||||
|
||||
// expire ability
|
||||
|
@ -706,12 +837,19 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, lifeform_t *target,
|
|||
return B_TRUE;
|
||||
}
|
||||
} else if (spellid == OT_S_DARKNESS) {
|
||||
if (!targcell) targcell = caster->cell;
|
||||
// centre on the caster
|
||||
if (isplayer(caster) || haslos(player, caster->cell)) {
|
||||
if (haslos(player, targcell)) {
|
||||
msg("A cloud of darkness descends!");
|
||||
if (seenbyplayer) *seenbyplayer = B_TRUE;
|
||||
}
|
||||
makelitradius(caster->cell, 10, L_DARK);
|
||||
if (blessed) {
|
||||
// permenant darkness
|
||||
makelitradius(targcell, 10, L_PERMDARK, -1);
|
||||
} else {
|
||||
// temporary darkness
|
||||
makelitradius(targcell, 10, L_PERMDARK, rnd(5,10) );
|
||||
}
|
||||
} else if (spellid == OT_S_DETECTAURA) {
|
||||
if (isplayer(caster)) {
|
||||
object_t *o;
|
||||
|
@ -1941,12 +2079,21 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, lifeform_t *target,
|
|||
}
|
||||
} else if (spellid == OT_S_LIGHT) {
|
||||
lifeform_t *l;
|
||||
|
||||
if (!targcell) targcell = caster->cell;
|
||||
|
||||
// centre light on the caster
|
||||
if (isplayer(caster) || haslos(player, caster->cell)) {
|
||||
if (haslos(player, targcell)) {
|
||||
msg("The area is lit by a magical light!");
|
||||
if (seenbyplayer) *seenbyplayer = B_TRUE;
|
||||
}
|
||||
makelitradius(caster->cell, 10, L_PERM);
|
||||
if (blessed) {
|
||||
// permenant light
|
||||
makelitradius(targcell, 10, L_PERMLIGHT, -1);
|
||||
} else {
|
||||
// temporary light
|
||||
makelitradius(targcell, 10, L_PERMLIGHT, rnd(5,10) );
|
||||
}
|
||||
|
||||
// blind anyone with nightvis who sees it
|
||||
// (player last)
|
||||
|
@ -1975,6 +2122,11 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, lifeform_t *target,
|
|||
}
|
||||
}
|
||||
|
||||
// anyone there glows
|
||||
if ((targcell != caster->cell) && targcell->lf) {
|
||||
addtempflag(targcell->lf->flags, F_PRODUCESLIGHT, B_TRUE, NA, NA, NULL, rnd(10,20));
|
||||
}
|
||||
|
||||
} else if (spellid == OT_S_GRAVBOOST) {
|
||||
// ask for target
|
||||
if (!target) {
|
||||
|
@ -2413,12 +2565,12 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, lifeform_t *target,
|
|||
}
|
||||
} else {
|
||||
// couldn't make it appear
|
||||
msg("The air in front of %s seems to ripple for a while.", lfname);
|
||||
msg("The air in front of %s seems to ripple for a moment.", lfname);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// couldn't make it appear - ob doesn't exist
|
||||
msg("The air in front of %s seems to ripple for a moment.", lfname);
|
||||
msg("The air in front of %s seems to ripple for a while.", lfname);
|
||||
}
|
||||
} else {
|
||||
// monsters can't wish
|
||||
|
|
35
text.c
35
text.c
|
@ -342,6 +342,41 @@ int strpixmatch(char *haystack, char *needle) {
|
|||
return matched;
|
||||
}
|
||||
|
||||
int texttodice(char *text, int *ndice, int *nsides, int *bonus) {
|
||||
char *dummy;
|
||||
char *localtext;
|
||||
char *p;
|
||||
localtext = strdup(text);
|
||||
// number of dice
|
||||
p = strtok_r(localtext, "d", &dummy);
|
||||
if (!p) {
|
||||
return B_TRUE;
|
||||
}
|
||||
if (ndice) {
|
||||
*ndice = atoi(p);
|
||||
}
|
||||
// sides on each die
|
||||
p = strtok_r(NULL, "d", &dummy);
|
||||
if (!p) {
|
||||
return B_TRUE;
|
||||
}
|
||||
if (nsides) {
|
||||
*nsides = atoi(p);
|
||||
}
|
||||
// bonus/plus
|
||||
if (bonus) {
|
||||
p = strtok_r(NULL, "+", &dummy);
|
||||
if (p) {
|
||||
*bonus = atoi(p);
|
||||
} else {
|
||||
*bonus = 0;
|
||||
}
|
||||
}
|
||||
|
||||
free(localtext);
|
||||
return B_FALSE;
|
||||
}
|
||||
|
||||
char *you(lifeform_t *lf) {
|
||||
if (isplayer(lf)) {
|
||||
return "You";
|
||||
|
|
1
text.h
1
text.h
|
@ -15,6 +15,7 @@ void splittime(int *hours, int *mins, int *secs);
|
|||
char *strrep(char *text, char *oldtok, char *newtok, int *rv);
|
||||
char *dostrrep(char* in, char** out, char* oldtok, char* newtok, int *rv);
|
||||
int strpixmatch(char *haystack, char *needle);
|
||||
int texttodice(char *text, int *ndice, int *nsides, int *bonus);
|
||||
char *you(lifeform_t *lf);
|
||||
char *you_l(lifeform_t *lf);
|
||||
char *your(lifeform_t *lf);
|
||||
|
|
Loading…
Reference in New Issue