- [+] ob1() macros

- [+] healing  potions should heal even "permenant" injuries
- [+] potions/spells
    - [+] summon decoy (chicken horde) spell  - "friends!"
    - [+] potion of spider climb (arachnid adhesion)
    - [+] gloves of the spider
- [+] F_startobwepskill sk_shortblades etc
- [+] change mosnter starting weapons to be based on wepsk, not
      specific named weapons
- [+] make wrapprint cope properly with 0 length strings
- [+] fix io.c showlfstats layout
- [+] fountains of xp should always dry up after one use!
- [+] plants shouldn't leave footprints!
- [+] fix overcomplicated code in updateknowncells
- [+] you always "see" allies following you down/up stairs, even if
      they are behind you.
- [+] remove dtresist slash from skeletons - their bone skin reduces
      this already.
    - [+] leave dtresist pierce because it's hard to hit them.
- [+] confirm gold amount when donating to shops
- [+] increase piety by half of any gold donated to temples
- [+] move hp, mp, sp to same line as target, and make them into bars
    - [+] HP:[    11 / 11   ]
    - [+] makebar(window,min,max, loss,barcol, losscol)
        - [+] print the prefix:  "HP:["
        - [+] construct the bar string to fit into 10 chars: "     11 /
              11    "
        - [+] print it one char at a time, setting bg as follows:
        - [+] background:
            - [+] 0 - min is barcol
            - [+] min+1 - min+loss is losscol
            - [+] rest is black
        - [+] print the suffix:  "]  "
    - [+] remember last dam amount for hp.
    - [+] show mp and stamina like this too.
- [+] update viewpoint sooner when moving vertically
- [+] if you can't comprehend the contents of a spellbook, don't ID it!
- [+] hpbar: pass textcol and texcolwithbg
- [+] show f_stability in @e
- [+] don't identify tech inside shops if it's beyond your skill level
- [+] bug:  "a cursed +-1 ring of dexterity"
- [+] enraged or deaf lfs shouldn't respond to chats
- [+] drawbar:  show mp/sp text in orange if it's at 0.
- [+] allow vegetarians to eat frozen corpses.
- [+] anything flying + stunned loses flying.
- [+] chance for monsters to throw missiles is reduced when acc <  C
    - [+] use same code as firearms
- [+] undead shouldn't lose consciousness - they should jsut die.
This commit is contained in:
Rob Pearce 2011-12-05 17:03:47 +00:00
parent d5b1e40f98
commit 9da88f06e3
20 changed files with 744 additions and 296 deletions

4
ai.c
View File

@ -1338,8 +1338,8 @@ int aimovetolf(lifeform_t *lf, lifeform_t *target, int wantattack) {
// to maintain distance. // to maintain distance.
rangedob = aigetrangedattack(lf, target, &rangedattack, &shootrange); rangedob = aigetrangedattack(lf, target, &rangedattack, &shootrange);
// for firearms, chance to fire depends on accuracy. // for firearms/projectiles, chance to fire/throw depends on accuracy.
if (rangedattack == RA_GUN) { if ((rangedattack == RA_GUN) || (rangedattack == RA_THROW)) {
int acc,chance; int acc,chance;
acc = getmissileaccuracy(lf, target->cell, getammo(rangedob), rangedob, NULL); acc = getmissileaccuracy(lf, target->cell, getammo(rangedob), rangedob, NULL);
switch (getpctletter(acc,100)) { switch (getpctletter(acc,100)) {

View File

@ -2028,7 +2028,7 @@ int rolltohit(lifeform_t *lf, lifeform_t *victim, object_t *wep, int *critical)
if (lorelev != PR_INEPT) acc += (lorelev*10); if (lorelev != PR_INEPT) acc += (lorelev*10);
// modify for attacking while climbing // modify for attacking while climbing
if (isclimbing(lf)) { if (isclimbing(lf) && !lfhasflag(lf, F_SPIDERCLIMB)) {
switch (getskill(lf, SK_CLIMBING)) { switch (getskill(lf, SK_CLIMBING)) {
case PR_INEPT: acc -= 100; break; case PR_INEPT: acc -= 100; break;
case PR_NOVICE: acc -= 100; break; case PR_NOVICE: acc -= 100; break;

73
data.c
View File

@ -167,7 +167,7 @@ void initjobs(void) {
addflag(lastjob->flags, F_STARTSKILL, SK_SS_MENTAL, PR_MASTER, NA, NULL); addflag(lastjob->flags, F_STARTSKILL, SK_SS_MENTAL, PR_MASTER, NA, NULL);
addflag(lastjob->flags, F_STARTSKILL, SK_SS_SUMMONING, PR_MASTER, NA, NULL); addflag(lastjob->flags, F_STARTSKILL, SK_SS_SUMMONING, PR_MASTER, NA, NULL);
addflag(lastjob->flags, F_STARTSKILL, SK_TECHUSAGE, PR_ADEPT, NA, NULL); addflag(lastjob->flags, F_STARTSKILL, SK_TECHUSAGE, PR_ADEPT, NA, NULL);
addflag(lastjob->flags, F_HASPET, NA, NA, NA, "young wolf"); //addflag(lastjob->flags, F_HASPET, NA, NA, NA, "young wolf");
for (i = 1; i < MAXSKILLS; i++) { for (i = 1; i < MAXSKILLS; i++) {
addflag(lastjob->flags, F_CANLEARN, i, NA, NA, NULL); addflag(lastjob->flags, F_CANLEARN, i, NA, NA, NULL);
} }
@ -996,6 +996,8 @@ void initobjects(void) {
addflag_real(lastbrand->flags, F_EQUIPCONFER, F_ATTRMOD, A_STR, -3, NULL, PERMENANT, B_UNKNOWN, -1); addflag_real(lastbrand->flags, F_EQUIPCONFER, F_ATTRMOD, A_STR, -3, NULL, PERMENANT, B_UNKNOWN, -1);
addbrand(BR_NIMBLENESS, "of nimbleness", BP_HANDS); addbrand(BR_NIMBLENESS, "of nimbleness", BP_HANDS);
addflag_real(lastbrand->flags, F_EQUIPCONFER, F_ATTRMOD, A_AGI, 3, NULL, PERMENANT, B_UNKNOWN, -1); addflag_real(lastbrand->flags, F_EQUIPCONFER, F_ATTRMOD, A_AGI, 3, NULL, PERMENANT, B_UNKNOWN, -1);
addbrand(BR_SPIDERCLIMB, "of the spider", BP_HANDS);
addflag_real(lastbrand->flags, F_EQUIPCONFER, F_SPIDERCLIMB, B_TRUE, NA, NULL, PERMENANT, B_UNKNOWN, -1);
// head // head
addbrand(BR_THINKING, "of thinking", BP_HEAD); addbrand(BR_THINKING, "of thinking", BP_HEAD);
@ -2018,7 +2020,9 @@ void initobjects(void) {
addflag(lastot->flags, F_ISMEAT, B_TRUE, 80, NA, ""); addflag(lastot->flags, F_ISMEAT, B_TRUE, 80, NA, "");
// potions (sorted by rarity) // potions
addot(OT_POT_SPIDERCLIMB, "potion of arachnid adhesion", "Temporarily allows you to climb on walls like a spider.", MT_GLASS, 1, OC_POTION, SZ_TINY);
addflag(lastot->flags, F_RARITY, H_ALL, 100, RR_COMMON, NULL);
addot(OT_POT_JUICE, "potion of fruit juice", "Tasty (but not very fresh) fruit juice! Sates hunger and restores a little stamina.", MT_GLASS, 1, OC_POTION, SZ_TINY); addot(OT_POT_JUICE, "potion of fruit juice", "Tasty (but not very fresh) fruit juice! Sates hunger and restores a little stamina.", MT_GLASS, 1, OC_POTION, SZ_TINY);
addflag(lastot->flags, F_RARITY, H_ALL, 100, NA, NULL); addflag(lastot->flags, F_RARITY, H_ALL, 100, NA, NULL);
addot(OT_POT_CANINETRACKING, "potion of canine tracking", "Mimics the effects of a 'canine tracking' spell.", MT_GLASS, 1, OC_POTION, SZ_TINY); addot(OT_POT_CANINETRACKING, "potion of canine tracking", "Mimics the effects of a 'canine tracking' spell.", MT_GLASS, 1, OC_POTION, SZ_TINY);
@ -3348,6 +3352,10 @@ void initobjects(void) {
addflag(lastot->flags, F_SPELLLEVEL, 3, NA, NA, NULL); addflag(lastot->flags, F_SPELLLEVEL, 3, NA, NA, NULL);
addflag(lastot->flags, F_AICASTTOATTACK, ST_ANYWHERE, NA, NA, NULL); addflag(lastot->flags, F_AICASTTOATTACK, ST_ANYWHERE, NA, NA, NULL);
addflag(lastot->flags, F_LOSLOF, B_TRUE, LOF_DONTNEED, NA, NULL); addflag(lastot->flags, F_LOSLOF, B_TRUE, LOF_DONTNEED, NA, NULL);
addot(OT_S_FRIENDS, "friends!", "Surrounds the caster with a horde of tiny animals to act as a decoy.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_SPELLSCHOOL, SS_SUMMONING, NA, NA, NULL);
addflag(lastot->flags, F_SPELLLEVEL, 3, NA, NA, NULL);
addflag(lastot->flags, F_MAXPOWER, 1, NA, NA, NULL);
// l5 // l5
addot(OT_S_SUMMONDEMON, "summon demon", "Summons a random demonic entity.", MT_NOTHING, 0, OC_SPELL, SZ_TINY); addot(OT_S_SUMMONDEMON, "summon demon", "Summons a random demonic entity.", MT_NOTHING, 0, OC_SPELL, SZ_TINY);
addflag(lastot->flags, F_EXTRADESC, NA, NA, NA, "The spell's power determines its chances of success, and how long the demon will remain."); addflag(lastot->flags, F_EXTRADESC, NA, NA, NA, "The spell's power determines its chances of success, and how long the demon will remain.");
@ -3530,6 +3538,7 @@ void initobjects(void) {
addflag(lastot->flags, F_STAMCOST, 1, NA, NA, NULL); addflag(lastot->flags, F_STAMCOST, 1, NA, NA, NULL);
addflag(lastot->flags, F_SPELLSCHOOL, SS_ABILITY, NA, NA, NULL); addflag(lastot->flags, F_SPELLSCHOOL, SS_ABILITY, NA, NA, NULL);
addflag(lastot->flags, F_AICASTTOFLEE, ST_ANYWHERE, NA, NA, NULL); addflag(lastot->flags, F_AICASTTOFLEE, ST_ANYWHERE, NA, NA, NULL);
addflag(lastot->flags, F_AICASTTOATTACK, ST_ANYWHERE, NA, NA, NULL);
addot(OT_A_COOK, "cook", "Cook a corpse, or combine various foods into a healthy meal.", MT_NOTHING, 0, OC_ABILITY, SZ_TINY); addot(OT_A_COOK, "cook", "Cook a corpse, or combine various foods into a healthy meal.", MT_NOTHING, 0, OC_ABILITY, SZ_TINY);
addflag(lastot->flags, F_SPELLSCHOOL, SS_ABILITY, NA, NA, NULL); addflag(lastot->flags, F_SPELLSCHOOL, SS_ABILITY, NA, NA, NULL);
addot(OT_A_DARKWALK, "darkwalk", "Step between the shadows.", MT_NOTHING, 0, OC_ABILITY, SZ_TINY); addot(OT_A_DARKWALK, "darkwalk", "Step between the shadows.", MT_NOTHING, 0, OC_ABILITY, SZ_TINY);
@ -3553,7 +3562,7 @@ void initobjects(void) {
addflag(lastot->flags, F_SPELLSCHOOL, SS_ABILITY, NA, NA, NULL); addflag(lastot->flags, F_SPELLSCHOOL, SS_ABILITY, NA, NA, NULL);
addflag(lastot->flags, F_AICASTTOATTACK, ST_ADJVICTIM, NA, NA, NULL); addflag(lastot->flags, F_AICASTTOATTACK, ST_ADJVICTIM, NA, NA, NULL);
addot(OT_A_FLURRY, "flurry", "Perform a flurry of attacks, forcing your opponent backwards.", MT_NOTHING, 0, OC_ABILITY, SZ_TINY); addot(OT_A_FLURRY, "flurry", "Perform a flurry of attacks, forcing your opponent backwards.", MT_NOTHING, 0, OC_ABILITY, SZ_TINY);
addflag(lastot->flags, F_STAMCOST, 3, NA, NA, NULL); addflag(lastot->flags, F_STAMCOST, 1, NA, NA, NULL);
addflag(lastot->flags, F_SPELLSCHOOL, SS_ABILITY, NA, NA, NULL); addflag(lastot->flags, F_SPELLSCHOOL, SS_ABILITY, NA, NA, NULL);
addflag(lastot->flags, F_AICASTTOATTACK, ST_ADJVICTIM, NA, NA, NULL); addflag(lastot->flags, F_AICASTTOATTACK, ST_ADJVICTIM, NA, NA, NULL);
addot(OT_A_GRAB, "grab", "You can grab hold of nearby enemies to prevent their escape.", MT_NOTHING, 0, OC_ABILITY, SZ_TINY); addot(OT_A_GRAB, "grab", "You can grab hold of nearby enemies to prevent their escape.", MT_NOTHING, 0, OC_ABILITY, SZ_TINY);
@ -4763,7 +4772,7 @@ void initobjects(void) {
addflag(lastot->flags, F_BLOCKSVIEW, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_BLOCKSVIEW, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_DAMAGABLE, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_DAMAGABLE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_THEREISHERE, B_TRUE, NA, NA, "!"); addflag(lastot->flags, F_THEREISHERE, B_TRUE, NA, NA, "!");
addflag(lastot->flags, F_CAUSESCOUGH, 26, NA, NA, NULL); addflag(lastot->flags, F_CAUSESCOUGH, 25, NA, NA, NULL);
addot(OT_SMOKEPUFF, "puff of smoke", "A small puff of black smoke.", MT_GAS, 0, OC_EFFECT, SZ_MEDIUM); addot(OT_SMOKEPUFF, "puff of smoke", "A small puff of black smoke.", MT_GAS, 0, OC_EFFECT, SZ_MEDIUM);
addflag(lastot->flags, F_GLYPH, C_GREY, UNI_SHADELIGHT, NA, NULL); addflag(lastot->flags, F_GLYPH, C_GREY, UNI_SHADELIGHT, NA, NULL);
@ -4774,7 +4783,7 @@ void initobjects(void) {
addflag(lastot->flags, F_DAMAGABLE, B_TRUE, NA, NA, NULL); addflag(lastot->flags, F_DAMAGABLE, B_TRUE, NA, NA, NULL);
addflag(lastot->flags, F_BLOCKSVIEW, 2, NA, NA, NULL); addflag(lastot->flags, F_BLOCKSVIEW, 2, NA, NA, NULL);
addflag(lastot->flags, F_THEREISHERE, B_TRUE, NA, NA, "."); addflag(lastot->flags, F_THEREISHERE, B_TRUE, NA, NA, ".");
addflag(lastot->flags, F_CAUSESCOUGH, 18, NA, NA, NULL); addflag(lastot->flags, F_CAUSESCOUGH, 16, NA, NA, NULL);
addot(OT_POISONCLOUD, "cloud of poison gas", "A thick cloud of poisonous gas.", MT_GAS, 0, OC_EFFECT, SZ_LARGE); addot(OT_POISONCLOUD, "cloud of poison gas", "A thick cloud of poisonous gas.", MT_GAS, 0, OC_EFFECT, SZ_LARGE);
addflag(lastot->flags, F_GLYPH, C_GREEN, UNI_SHADEMED, NA, NULL); addflag(lastot->flags, F_GLYPH, C_GREEN, UNI_SHADEMED, NA, NULL);
@ -7206,7 +7215,7 @@ void initrace(void) {
addflag(lastrace->flags, F_STARTOBCLASS, 100, OC_ARMOUR, NA, NULL); addflag(lastrace->flags, F_STARTOBCLASS, 100, OC_ARMOUR, NA, NULL);
addflag(lastrace->flags, F_STARTOBCLASS, 80, OC_ARMOUR, NA, NULL); addflag(lastrace->flags, F_STARTOBCLASS, 80, OC_ARMOUR, NA, NULL);
addflag(lastrace->flags, F_STARTOBCLASS, 80, OC_ARMOUR, NA, NULL); addflag(lastrace->flags, F_STARTOBCLASS, 80, OC_ARMOUR, NA, NULL);
addflag(lastrace->flags, F_STARTOB, 100, NA, NA, "glaive"); addflag(lastrace->flags, F_STARTOBWEPSK, 100, SK_POLEARMS, NA, NULL);
addflag(lastrace->flags, F_DIURNAL, B_TRUE, NA, NA, NULL); addflag(lastrace->flags, F_DIURNAL, B_TRUE, NA, NA, NULL);
addflag(lastrace->flags, F_STARTATT, A_STR, AT_GTAVERAGE, NA, NULL); addflag(lastrace->flags, F_STARTATT, A_STR, AT_GTAVERAGE, NA, NULL);
addflag(lastrace->flags, F_STARTATT, A_IQ, AT_LTAVERAGE, NA, NULL); addflag(lastrace->flags, F_STARTATT, A_IQ, AT_LTAVERAGE, NA, NULL);
@ -7383,7 +7392,7 @@ void initrace(void) {
addflag(lastrace->flags, F_STARTATT, A_AGI, AT_GTAVERAGE, NA, NULL); addflag(lastrace->flags, F_STARTATT, A_AGI, AT_GTAVERAGE, NA, NULL);
addflag(lastrace->flags, F_STARTATT, A_STR, AT_GTAVERAGE, NA, NULL); addflag(lastrace->flags, F_STARTATT, A_STR, AT_GTAVERAGE, NA, NULL);
addflag(lastrace->flags, F_HASATTACK, OT_CLAWS, 10, NA, NULL); addflag(lastrace->flags, F_HASATTACK, OT_CLAWS, 10, NA, NULL);
addflag(lastrace->flags, F_STARTOB, 50, NA, NA, "spear"); addflag(lastrace->flags, F_STARTOBWEPSK, 50, SK_POLEARMS, NA, NULL);
addflag(lastrace->flags, F_STARTOB, 50, NA, NA, "shield"); addflag(lastrace->flags, F_STARTOB, 50, NA, NA, "shield");
addflag(lastrace->flags, F_STARTOB, 100, NA, NA, "leather armour"); addflag(lastrace->flags, F_STARTOB, 100, NA, NA, "leather armour");
addflag(lastrace->flags, F_STARTOB, 50, NA, NA, "1-40 gold coins"); addflag(lastrace->flags, F_STARTOB, 50, NA, NA, "1-40 gold coins");
@ -7453,8 +7462,8 @@ void initrace(void) {
addflag(lastrace->flags, F_STARTATT, A_STR, AT_AVERAGE, NA, NULL); addflag(lastrace->flags, F_STARTATT, A_STR, AT_AVERAGE, NA, NULL);
addflag(lastrace->flags, F_STARTATT, A_AGI, AT_GTAVERAGE, NA, NULL); addflag(lastrace->flags, F_STARTATT, A_AGI, AT_GTAVERAGE, NA, NULL);
addflag(lastrace->flags, F_STARTOB, 50, NA, NA, "1-25 gold coins"); addflag(lastrace->flags, F_STARTOB, 50, NA, NA, "1-25 gold coins");
addflag(lastrace->flags, F_STARTOB, 50, NA, NA, "gladius"); addflag(lastrace->flags, F_STARTOB, 50, NA, NA, "sling");
addflag(lastrace->flags, F_STARTOB, 100, NA, NA, "sling"); addflag(lastrace->flags, F_STARTOBWEPSK, 100, SK_SHORTBLADES, NA, NULL);
addflag(lastrace->flags, F_STARTOBCLASS, 40, OC_POTION, NA, NULL); addflag(lastrace->flags, F_STARTOBCLASS, 40, OC_POTION, NA, NULL);
addflag(lastrace->flags, F_WANTSBETTERWEP, B_TRUE, B_COVETS, NA, NULL); addflag(lastrace->flags, F_WANTSBETTERWEP, B_TRUE, B_COVETS, NA, NULL);
addflag(lastrace->flags, F_WANTS, OT_GOLD, B_COVETS, NA, NULL); addflag(lastrace->flags, F_WANTS, OT_GOLD, B_COVETS, NA, NULL);
@ -7486,7 +7495,7 @@ void initrace(void) {
addflag(lastrace->flags, F_STARTATT, A_IQ, AT_LTAVERAGE, NA, NULL); addflag(lastrace->flags, F_STARTATT, A_IQ, AT_LTAVERAGE, NA, NULL);
addflag(lastrace->flags, F_STARTATT, A_STR, AT_AVERAGE, NA, NULL); addflag(lastrace->flags, F_STARTATT, A_STR, AT_AVERAGE, NA, NULL);
addflag(lastrace->flags, F_STARTATT, A_AGI, AT_GTAVERAGE, NA, NULL); addflag(lastrace->flags, F_STARTATT, A_AGI, AT_GTAVERAGE, NA, NULL);
addflag(lastrace->flags, F_STARTOB, 100, NA, NA, "spear"); addflag(lastrace->flags, F_STARTOBWEPSK, 100, SK_POLEARMS, NA, NULL);
addflag(lastrace->flags, F_STARTOB, 100, NA, NA, "1-5 javelins"); addflag(lastrace->flags, F_STARTOB, 100, NA, NA, "1-5 javelins");
addflag(lastrace->flags, F_STARTOB, 100, NA, NA, "leather armour"); addflag(lastrace->flags, F_STARTOB, 100, NA, NA, "leather armour");
addflag(lastrace->flags, F_STARTOB, 50, NA, NA, "1-50 gold coins"); addflag(lastrace->flags, F_STARTOB, 50, NA, NA, "1-50 gold coins");
@ -7518,7 +7527,6 @@ void initrace(void) {
addflag(lastrace->flags, F_STARTATT, A_IQ, AT_LTAVERAGE, NA, NULL); addflag(lastrace->flags, F_STARTATT, A_IQ, AT_LTAVERAGE, NA, NULL);
addflag(lastrace->flags, F_STARTATT, A_STR, AT_AVERAGE, NA, NULL); addflag(lastrace->flags, F_STARTATT, A_STR, AT_AVERAGE, NA, NULL);
addflag(lastrace->flags, F_STARTATT, A_AGI, AT_GTAVERAGE, NA, NULL); addflag(lastrace->flags, F_STARTATT, A_AGI, AT_GTAVERAGE, NA, NULL);
addflag(lastrace->flags, F_STARTOB, 100, NA, NA, "gladius");
addflag(lastrace->flags, F_STARTOB, 100, NA, NA, "hand crossbow"); addflag(lastrace->flags, F_STARTOB, 100, NA, NA, "hand crossbow");
addflag(lastrace->flags, F_STARTOB, 100, NA, NA, "1-15 bolts"); addflag(lastrace->flags, F_STARTOB, 100, NA, NA, "1-15 bolts");
addflag(lastrace->flags, F_STARTOB, 100, NA, NA, "leather armour"); addflag(lastrace->flags, F_STARTOB, 100, NA, NA, "leather armour");
@ -7553,7 +7561,7 @@ void initrace(void) {
addflag(lastrace->flags, F_STARTATT, A_IQ, AT_AVERAGE, NA, NULL); addflag(lastrace->flags, F_STARTATT, A_IQ, AT_AVERAGE, NA, NULL);
addflag(lastrace->flags, F_STARTATT, A_STR, AT_AVERAGE, NA, NULL); addflag(lastrace->flags, F_STARTATT, A_STR, AT_AVERAGE, NA, NULL);
addflag(lastrace->flags, F_STARTATT, A_AGI, AT_GTAVERAGE, NA, NULL); addflag(lastrace->flags, F_STARTATT, A_AGI, AT_GTAVERAGE, NA, NULL);
addflag(lastrace->flags, F_STARTOB, 80, NA, NA, "club"); addflag(lastrace->flags, F_STARTOBWEPSK, 50, SK_CLUBS, NA, NULL);
addflag(lastrace->flags, F_STARTOB, 80, NA, NA, "leather armour"); addflag(lastrace->flags, F_STARTOB, 80, NA, NA, "leather armour");
addflag(lastrace->flags, F_NOISETEXT, N_GETANGRY, 3, NA, "shouts^a shout"); addflag(lastrace->flags, F_NOISETEXT, N_GETANGRY, 3, NA, "shouts^a shout");
addflag(lastrace->flags, F_SEEINDARK, 5, NA, NA, NULL); addflag(lastrace->flags, F_SEEINDARK, 5, NA, NA, NULL);
@ -7610,7 +7618,7 @@ void initrace(void) {
addflag(lastrace->flags, F_STARTATT, A_IQ, AT_GTAVERAGE, NA, NULL); addflag(lastrace->flags, F_STARTATT, A_IQ, AT_GTAVERAGE, NA, NULL);
addflag(lastrace->flags, F_STARTATT, A_STR, AT_HIGH, NA, NULL); addflag(lastrace->flags, F_STARTATT, A_STR, AT_HIGH, NA, NULL);
addflag(lastrace->flags, F_STARTATT, A_AGI, AT_GTAVERAGE, NA, NULL); addflag(lastrace->flags, F_STARTATT, A_AGI, AT_GTAVERAGE, NA, NULL);
addflag(lastrace->flags, F_STARTOB, 80, NA, NA, "longsword"); addflag(lastrace->flags, F_STARTOBWEPSK, 80, SK_LONGBLADES, NA, NULL);
addflag(lastrace->flags, F_STARTOB, 50, NA, NA, "buckler"); addflag(lastrace->flags, F_STARTOB, 50, NA, NA, "buckler");
addflag(lastrace->flags, F_STARTOBCLASS, 100, OC_ARMOUR, NA, NULL); addflag(lastrace->flags, F_STARTOBCLASS, 100, OC_ARMOUR, NA, NULL);
addflag(lastrace->flags, F_STARTOB, 50, NA, NA, "1-50 gold coins"); addflag(lastrace->flags, F_STARTOB, 50, NA, NA, "1-50 gold coins");
@ -7646,7 +7654,7 @@ void initrace(void) {
addflag(lastrace->flags, F_STARTATT, A_IQ, AT_GTAVERAGE, NA, NULL); addflag(lastrace->flags, F_STARTATT, A_IQ, AT_GTAVERAGE, NA, NULL);
addflag(lastrace->flags, F_STARTATT, A_STR, AT_HIGH, NA, NULL); addflag(lastrace->flags, F_STARTATT, A_STR, AT_HIGH, NA, NULL);
addflag(lastrace->flags, F_STARTATT, A_AGI, AT_GTAVERAGE, NA, NULL); addflag(lastrace->flags, F_STARTATT, A_AGI, AT_GTAVERAGE, NA, NULL);
addflag(lastrace->flags, F_STARTOB, 100, NA, NA, "flail"); addflag(lastrace->flags, F_STARTOBWEPSK, 100, SK_CLUBS, NA, NULL);
addflag(lastrace->flags, F_STARTOB, 50, NA, NA, "1-75 gold coins"); addflag(lastrace->flags, F_STARTOB, 50, NA, NA, "1-75 gold coins");
addflag(lastrace->flags, F_STARTOB, 90, NA, NA, "large shield"); addflag(lastrace->flags, F_STARTOB, 90, NA, NA, "large shield");
addflag(lastrace->flags, F_STARTOB, 100, NA, NA, "scale armour"); addflag(lastrace->flags, F_STARTOB, 100, NA, NA, "scale armour");
@ -7688,7 +7696,7 @@ void initrace(void) {
addflag(lastrace->flags, F_STARTOBDT, 20, DT_PIERCE, NA, NULL); addflag(lastrace->flags, F_STARTOBDT, 20, DT_PIERCE, NA, NULL);
addflag(lastrace->flags, F_STARTOBCLASS, 25, OC_POTION, NA, NULL); addflag(lastrace->flags, F_STARTOBCLASS, 25, OC_POTION, NA, NULL);
addflag(lastrace->flags, F_STARTSKILL, SK_THROWING, PR_ADEPT, NA, NULL); addflag(lastrace->flags, F_STARTSKILL, SK_THROWING, PR_ADEPT, NA, NULL);
addflag(lastrace->flags, F_STARTOB, 50, NA, NA, "1-3 darts"); addflag(lastrace->flags, F_STARTOB, 33, NA, NA, "1-3 darts");
addflag(lastrace->flags, F_STARTOB, 10, NA, NA, "javelin"); addflag(lastrace->flags, F_STARTOB, 10, NA, NA, "javelin");
addflag(lastrace->flags, F_STARTOB, 15, NA, NA, "buckler"); addflag(lastrace->flags, F_STARTOB, 15, NA, NA, "buckler");
addflag(lastrace->flags, F_STARTOB, 50, NA, NA, "1-10 gold coins"); addflag(lastrace->flags, F_STARTOB, 50, NA, NA, "1-10 gold coins");
@ -7720,7 +7728,7 @@ void initrace(void) {
addflag(lastrace->flags, F_HASATTACK, OT_FISTS, 2, NA, NULL); addflag(lastrace->flags, F_HASATTACK, OT_FISTS, 2, NA, NULL);
addflag(lastrace->flags, F_HASATTACK, OT_TAIL, 2, NA, NULL); addflag(lastrace->flags, F_HASATTACK, OT_TAIL, 2, NA, NULL);
addflag(lastrace->flags, F_MAXATTACKS, 1, 1, NA, NULL); addflag(lastrace->flags, F_MAXATTACKS, 1, 1, NA, NULL);
addflag(lastrace->flags, F_STARTOB, 50, NA, NA, "club"); addflag(lastrace->flags, F_STARTOBWEPSK, 50, SK_CLUBS, NA, NULL);
addflag(lastrace->flags, F_STARTOB, 50, NA, NA, "buckler"); addflag(lastrace->flags, F_STARTOB, 50, NA, NA, "buckler");
addflag(lastrace->flags, F_STARTOB, 50, NA, NA, "1-10 gold coins"); addflag(lastrace->flags, F_STARTOB, 50, NA, NA, "1-10 gold coins");
addflag(lastrace->flags, F_DTVULN, DT_COLD, B_TRUE, NA, NULL); addflag(lastrace->flags, F_DTVULN, DT_COLD, B_TRUE, NA, NULL);
@ -7773,7 +7781,7 @@ void initrace(void) {
addflag(lastrace->flags, F_HASATTACK, OT_CLAWS, 6, NA, NULL); addflag(lastrace->flags, F_HASATTACK, OT_CLAWS, 6, NA, NULL);
addflag(lastrace->flags, F_HASATTACK, OT_TAIL, 4, NA, NULL); addflag(lastrace->flags, F_HASATTACK, OT_TAIL, 4, NA, NULL);
addflag(lastrace->flags, F_STARTOB, 50, NA, NA, "1-50 gold coins"); addflag(lastrace->flags, F_STARTOB, 50, NA, NA, "1-50 gold coins");
addflag(lastrace->flags, F_STARTOB, 50, NA, NA, "spear"); addflag(lastrace->flags, F_STARTOBWEPSK, 50, SK_POLEARMS, NA, NULL);
addflag(lastrace->flags, F_STARTOB, 50, NA, NA, "1-2 javelins"); addflag(lastrace->flags, F_STARTOB, 50, NA, NA, "1-2 javelins");
addflag(lastrace->flags, F_DTVULN, DT_COLD, B_TRUE, NA, NULL); addflag(lastrace->flags, F_DTVULN, DT_COLD, B_TRUE, NA, NULL);
addflag(lastrace->flags, F_DTRESIST, DT_FIRE, B_TRUE, NA, NULL); addflag(lastrace->flags, F_DTRESIST, DT_FIRE, B_TRUE, NA, NULL);
@ -7806,7 +7814,7 @@ void initrace(void) {
addflag(lastrace->flags, F_STARTATT, A_STR, AT_VHIGH, NA, NULL); addflag(lastrace->flags, F_STARTATT, A_STR, AT_VHIGH, NA, NULL);
addflag(lastrace->flags, F_HASATTACK, OT_BUTT, 14, NA, NULL); addflag(lastrace->flags, F_HASATTACK, OT_BUTT, 14, NA, NULL);
addflag(lastrace->flags, F_HASATTACK, OT_BUTT, 14, NA, NULL); addflag(lastrace->flags, F_HASATTACK, OT_BUTT, 14, NA, NULL);
addflag(lastrace->flags, F_STARTOB, 50, NA, NA, "+2 heavy flail"); addflag(lastrace->flags, F_STARTOB, 50, NA, NA, "good heavy flail");
addflag(lastrace->flags, F_STARTOB, 50, NA, NA, "greataxe"); addflag(lastrace->flags, F_STARTOB, 50, NA, NA, "greataxe");
addflag(lastrace->flags, F_WANTSBETTERWEP, B_TRUE, NA, NA, NULL); addflag(lastrace->flags, F_WANTSBETTERWEP, B_TRUE, NA, NA, NULL);
addflag(lastrace->flags, F_STARTSKILL, SK_PERCEPTION, PR_EXPERT, NA, NULL); addflag(lastrace->flags, F_STARTSKILL, SK_PERCEPTION, PR_EXPERT, NA, NULL);
@ -7902,9 +7910,9 @@ void initrace(void) {
addflag(lastrace->flags, F_ACTIONSPEED, SP_NORMAL, NA, NA, ""); addflag(lastrace->flags, F_ACTIONSPEED, SP_NORMAL, NA, NA, "");
addflag(lastrace->flags, F_STARTATT, A_IQ, AT_LTAVERAGE, NA, NULL); addflag(lastrace->flags, F_STARTATT, A_IQ, AT_LTAVERAGE, NA, NULL);
addflag(lastrace->flags, F_HASATTACK, OT_CLAWS, 4, NA, NULL); addflag(lastrace->flags, F_HASATTACK, OT_CLAWS, 4, NA, NULL);
f = addflag(lastrace->flags, F_STARTOB, 100, NA, NA, "club"); f = addflag(lastrace->flags, F_STARTOBWEPSK, 100, SK_CLUBS, NA, NULL);
addcondition(f, FC_NOCONDITION, 70); addcondition(f, FC_NOCONDITION, 70);
addaltval(f, F_STARTOBDT, 50, DT_SLASH, NA, NULL); addaltval(f, F_STARTOBWEPSK, 50, SK_SHORTBLADES, NA, NULL);
addflag(lastrace->flags, F_STARTOBCLASS, 30, OC_POTION, NA, NULL); addflag(lastrace->flags, F_STARTOBCLASS, 30, OC_POTION, NA, NULL);
addflag(lastrace->flags, F_STARTOB, 50, NA, NA, "leather armour"); addflag(lastrace->flags, F_STARTOB, 50, NA, NA, "leather armour");
addflag(lastrace->flags, F_STARTOB, 50, NA, NA, "bone helmet"); addflag(lastrace->flags, F_STARTOB, 50, NA, NA, "bone helmet");
@ -8020,7 +8028,7 @@ void initrace(void) {
addflag(lastrace->flags, F_MOVESPEED, SP_NORMAL, NA, NA, NULL); addflag(lastrace->flags, F_MOVESPEED, SP_NORMAL, NA, NA, NULL);
addflag(lastrace->flags, F_STARTATT, A_IQ, AT_HIGH, NA, NULL); addflag(lastrace->flags, F_STARTATT, A_IQ, AT_HIGH, NA, NULL);
addflag(lastrace->flags, F_HASATTACK, OT_BUTT, 8, NA, NULL); addflag(lastrace->flags, F_HASATTACK, OT_BUTT, 8, NA, NULL);
addflag(lastrace->flags, F_STARTOBDT, 50, DT_SLASH, NA, NULL); addflag(lastrace->flags, F_STARTOBWEPSK, 50, SK_SHORTBLADES, NA, NULL);
addflag(lastrace->flags, F_STARTOB, 100, NA, NA, "panpipes"); addflag(lastrace->flags, F_STARTOB, 100, NA, NA, "panpipes");
addflag(lastrace->flags, F_STARTOB, 50, NA, NA, "bow"); addflag(lastrace->flags, F_STARTOB, 50, NA, NA, "bow");
addflag(lastrace->flags, F_STARTOB, 75, NA, NA, "1-10 arrows"); addflag(lastrace->flags, F_STARTOB, 75, NA, NA, "1-10 arrows");
@ -8311,6 +8319,7 @@ void initrace(void) {
addflag(lastrace->flags, F_SIZE, SZ_HUMAN, NA, NA, NULL); addflag(lastrace->flags, F_SIZE, SZ_HUMAN, NA, NA, NULL);
addflag(lastrace->flags, F_CORPSETYPE, NA, NA, NA, "cactus fruit"); addflag(lastrace->flags, F_CORPSETYPE, NA, NA, NA, "cactus fruit");
addflag(lastrace->flags, F_DOESNTMOVE, B_TRUE, NA, NA, NULL); addflag(lastrace->flags, F_DOESNTMOVE, B_TRUE, NA, NA, NULL);
addflag(lastrace->flags, F_NOPRINTS, B_TRUE, NA, NA, NULL);
addflag(lastrace->flags, F_MOVESPEED, SP_NORMAL, NA, NA, ""); addflag(lastrace->flags, F_MOVESPEED, SP_NORMAL, NA, NA, "");
addflag(lastrace->flags, F_HITDICE, NA, NA, NA, "4d4"); addflag(lastrace->flags, F_HITDICE, NA, NA, NA, "4d4");
addflag(lastrace->flags, F_NOSPELLS, B_TRUE, NA, NA, NULL); addflag(lastrace->flags, F_NOSPELLS, B_TRUE, NA, NA, NULL);
@ -8325,6 +8334,7 @@ void initrace(void) {
addflag(lastrace->flags, F_SIZE, SZ_HUMAN, NA, NA, NULL); addflag(lastrace->flags, F_SIZE, SZ_HUMAN, NA, NA, NULL);
addflag(lastrace->flags, F_CORPSETYPE, NA, NA, NA, "pile of sleeping powder"); addflag(lastrace->flags, F_CORPSETYPE, NA, NA, NA, "pile of sleeping powder");
addflag(lastrace->flags, F_DOESNTMOVE, B_TRUE, NA, NA, NULL); addflag(lastrace->flags, F_DOESNTMOVE, B_TRUE, NA, NA, NULL);
addflag(lastrace->flags, F_NOPRINTS, B_TRUE, NA, NA, NULL);
addflag(lastrace->flags, F_MOVESPEED, SP_NORMAL, NA, NA, ""); addflag(lastrace->flags, F_MOVESPEED, SP_NORMAL, NA, NA, "");
addflag(lastrace->flags, F_HITDICE, NA, NA, NA, "1d4"); addflag(lastrace->flags, F_HITDICE, NA, NA, NA, "1d4");
addflag(lastrace->flags, F_NOSPELLS, B_TRUE, NA, NA, NULL); addflag(lastrace->flags, F_NOSPELLS, B_TRUE, NA, NA, NULL);
@ -8337,6 +8347,7 @@ void initrace(void) {
addflag(lastrace->flags, F_SIZE, SZ_MEDIUM, NA, NA, NULL); addflag(lastrace->flags, F_SIZE, SZ_MEDIUM, NA, NA, NULL);
addflag(lastrace->flags, F_NOCORPSE, B_TRUE, NA, NA, NULL); addflag(lastrace->flags, F_NOCORPSE, B_TRUE, NA, NA, NULL);
addflag(lastrace->flags, F_DOESNTMOVE, B_TRUE, NA, NA, NULL); addflag(lastrace->flags, F_DOESNTMOVE, B_TRUE, NA, NA, NULL);
addflag(lastrace->flags, F_NOPRINTS, B_TRUE, NA, NA, NULL);
addflag(lastrace->flags, F_MOVESPEED, SP_NORMAL, NA, NA, ""); addflag(lastrace->flags, F_MOVESPEED, SP_NORMAL, NA, NA, "");
addflag(lastrace->flags, F_HITDICE, NA, NA, NA, "2d4"); addflag(lastrace->flags, F_HITDICE, NA, NA, NA, "2d4");
addflag(lastrace->flags, F_HASATTACK, OT_CLAWS, 6, NA, NULL); addflag(lastrace->flags, F_HASATTACK, OT_CLAWS, 6, NA, NULL);
@ -9078,8 +9089,9 @@ void initrace(void) {
addflag(lastrace->flags, F_HITDICE, NA, NA, NA, "3d4+1"); addflag(lastrace->flags, F_HITDICE, NA, NA, NA, "3d4+1");
addflag(lastrace->flags, F_HASATTACK, OT_TEETH, 4, NA, NULL); addflag(lastrace->flags, F_HASATTACK, OT_TEETH, 4, NA, NULL);
addflag(lastrace->flags, F_SPELLCASTTEXT, OT_NONE, NA, NA, NULL); // don't announce spellcasting addflag(lastrace->flags, F_SPELLCASTTEXT, OT_NONE, NA, NA, NULL); // don't announce spellcasting
addflag(lastrace->flags, F_STARTSKILL, SK_CLIMBING, PR_MASTER, NA, NULL); addflag(lastrace->flags, F_SPIDERCLIMB, B_TRUE, NA, NA, NULL);
addflag(lastrace->flags, F_CANWILL, OT_S_WEB, 3, 3, "pw:1;range:4;"); addflag(lastrace->flags, F_CANWILL, OT_S_WEB, 3, 3, "pw:1;range:4;");
addflag(lastrace->flags, F_CANWILL, OT_A_CLIMB, NA, NA, "pw:10;");
addflag(lastrace->flags, F_CASTCHANCE, 60, NA, NA, NULL); addflag(lastrace->flags, F_CASTCHANCE, 60, NA, NA, NULL);
addflag(lastrace->flags, F_NOSPELLS, B_TRUE, NA, NA, NULL); addflag(lastrace->flags, F_NOSPELLS, B_TRUE, NA, NA, NULL);
addflag(lastrace->flags, F_DTVULN, DT_LIGHT, NA, NA, NULL); addflag(lastrace->flags, F_DTVULN, DT_LIGHT, NA, NA, NULL);
@ -9089,7 +9101,7 @@ void initrace(void) {
addflag(lastrace->flags, F_HOMEOB, NA, NA, NA, "web"); addflag(lastrace->flags, F_HOMEOB, NA, NA, NA, "web");
addflag(lastrace->flags, F_HOMELEVOB, NA, NA, NA, "1-10 webs"); addflag(lastrace->flags, F_HOMELEVOB, NA, NA, NA, "1-10 webs");
addflag(lastrace->flags, F_NOCTURNAL, B_TRUE, NA, NA, NULL); addflag(lastrace->flags, F_NOCTURNAL, B_TRUE, NA, NA, NULL);
addflag(lastrace->flags, F_NOFLEE, B_TRUE, NA, NA, NULL); addflag(lastrace->flags, F_FLEEONHPPCT, 25, NA, NA, "");
addrace(R_SPIDERFUNNELWEB, "giant funnelweb", 5, 'S', C_MAGENTA, MT_FLESH, RC_ANIMAL, "Like a giant spider... but extremely venomous."); addrace(R_SPIDERFUNNELWEB, "giant funnelweb", 5, 'S', C_MAGENTA, MT_FLESH, RC_ANIMAL, "Like a giant spider... but extremely venomous.");
setbodytype(lastrace, BT_SPIDER); setbodytype(lastrace, BT_SPIDER);
lastrace->baseid = R_SPIDER; lastrace->baseid = R_SPIDER;
@ -9099,7 +9111,7 @@ void initrace(void) {
addflag(lastrace->flags, F_ACTIONSPEED, SP_NORMAL, NA, NA, ""); addflag(lastrace->flags, F_ACTIONSPEED, SP_NORMAL, NA, NA, "");
addflag(lastrace->flags, F_SIZE, SZ_HUMAN, NA, NA, NULL); addflag(lastrace->flags, F_SIZE, SZ_HUMAN, NA, NA, NULL);
addflag(lastrace->flags, F_NOSMELL, B_TRUE, NA, NA, NULL); addflag(lastrace->flags, F_NOSMELL, B_TRUE, NA, NA, NULL);
addflag(lastrace->flags, F_STARTSKILL, SK_CLIMBING, PR_MASTER, NA, NULL); addflag(lastrace->flags, F_SPIDERCLIMB, B_TRUE, NA, NA, NULL);
addflag(lastrace->flags, F_MOVESPEED, SP_NORMAL, NA, NA, ""); addflag(lastrace->flags, F_MOVESPEED, SP_NORMAL, NA, NA, "");
addflag(lastrace->flags, F_HITDICE, NA, NA, NA, "5d4+1"); addflag(lastrace->flags, F_HITDICE, NA, NA, NA, "5d4+1");
addflag(lastrace->flags, F_HASATTACK, OT_TEETH, 4, NA, NULL); addflag(lastrace->flags, F_HASATTACK, OT_TEETH, 4, NA, NULL);
@ -9107,6 +9119,7 @@ void initrace(void) {
addflag(lastrace->flags, F_HITCONFERVALS, P_VENOM, 3, NA, NULL); // strong! addflag(lastrace->flags, F_HITCONFERVALS, P_VENOM, 3, NA, NULL); // strong!
addflag(lastrace->flags, F_SPELLCASTTEXT, OT_NONE, NA, NA, NULL); // don't announce spellcasting addflag(lastrace->flags, F_SPELLCASTTEXT, OT_NONE, NA, NA, NULL); // don't announce spellcasting
addflag(lastrace->flags, F_CANWILL, OT_S_WEB, 3, 3, "pw:5;range:2;"); addflag(lastrace->flags, F_CANWILL, OT_S_WEB, 3, 3, "pw:5;range:2;");
addflag(lastrace->flags, F_CANWILL, OT_A_CLIMB, NA, NA, "pw:10;");
addflag(lastrace->flags, F_CASTCHANCE, 60, NA, NA, NULL); addflag(lastrace->flags, F_CASTCHANCE, 60, NA, NA, NULL);
addflag(lastrace->flags, F_NOSPELLS, B_TRUE, NA, NA, NULL); addflag(lastrace->flags, F_NOSPELLS, B_TRUE, NA, NA, NULL);
addflag(lastrace->flags, F_DTVULN, DT_LIGHT, NA, NA, NULL); addflag(lastrace->flags, F_DTVULN, DT_LIGHT, NA, NA, NULL);
@ -9116,7 +9129,7 @@ void initrace(void) {
addflag(lastrace->flags, F_HOMEOB, NA, NA, NA, "web"); addflag(lastrace->flags, F_HOMEOB, NA, NA, NA, "web");
addflag(lastrace->flags, F_HOMELEVOB, NA, NA, NA, "20-30 webs"); addflag(lastrace->flags, F_HOMELEVOB, NA, NA, NA, "20-30 webs");
addflag(lastrace->flags, F_NOCTURNAL, B_TRUE, NA, NA, NULL); addflag(lastrace->flags, F_NOCTURNAL, B_TRUE, NA, NA, NULL);
addflag(lastrace->flags, F_NOFLEE, B_TRUE, NA, NA, NULL); addflag(lastrace->flags, F_FLEEONHPPCT, 25, NA, NA, "");
addrace(R_SPIDERREDBACK, "giant redback", 5, 'S', C_RED, MT_FLESH, RC_ANIMAL, "A version of a giant spider with a highly painful bite."); addrace(R_SPIDERREDBACK, "giant redback", 5, 'S', C_RED, MT_FLESH, RC_ANIMAL, "A version of a giant spider with a highly painful bite.");
setbodytype(lastrace, BT_SPIDER); setbodytype(lastrace, BT_SPIDER);
lastrace->baseid = R_SPIDER; lastrace->baseid = R_SPIDER;
@ -9126,7 +9139,7 @@ void initrace(void) {
addflag(lastrace->flags, F_STARTATT, A_AGI, AT_GTAVERAGE, NA, NULL); addflag(lastrace->flags, F_STARTATT, A_AGI, AT_GTAVERAGE, NA, NULL);
addflag(lastrace->flags, F_ACTIONSPEED, SP_NORMAL, NA, NA, ""); addflag(lastrace->flags, F_ACTIONSPEED, SP_NORMAL, NA, NA, "");
addflag(lastrace->flags, F_SIZE, SZ_HUMAN, NA, NA, NULL); addflag(lastrace->flags, F_SIZE, SZ_HUMAN, NA, NA, NULL);
addflag(lastrace->flags, F_STARTSKILL, SK_CLIMBING, PR_MASTER, NA, NULL); addflag(lastrace->flags, F_SPIDERCLIMB, B_TRUE, NA, NA, NULL);
addflag(lastrace->flags, F_MOVESPEED, SP_NORMAL, NA, NA, ""); addflag(lastrace->flags, F_MOVESPEED, SP_NORMAL, NA, NA, "");
addflag(lastrace->flags, F_HITDICE, NA, NA, NA, "4d4+1"); addflag(lastrace->flags, F_HITDICE, NA, NA, NA, "4d4+1");
addflag(lastrace->flags, F_HASATTACK, OT_TEETH, 4, NA, NULL); addflag(lastrace->flags, F_HASATTACK, OT_TEETH, 4, NA, NULL);
@ -9134,6 +9147,7 @@ void initrace(void) {
addflag(lastrace->flags, F_HITCONFERVALS, DT_POISON, NA, NA, "1d2"); addflag(lastrace->flags, F_HITCONFERVALS, DT_POISON, NA, NA, "1d2");
addflag(lastrace->flags, F_SPELLCASTTEXT, OT_NONE, NA, NA, NULL); // don't announce spellcasting addflag(lastrace->flags, F_SPELLCASTTEXT, OT_NONE, NA, NA, NULL); // don't announce spellcasting
addflag(lastrace->flags, F_CANWILL, OT_S_WEB, 3, 3, "pw:7;range:3;"); addflag(lastrace->flags, F_CANWILL, OT_S_WEB, 3, 3, "pw:7;range:3;");
addflag(lastrace->flags, F_CANWILL, OT_A_CLIMB, NA, NA, "pw:10;");
addflag(lastrace->flags, F_CASTCHANCE, 60, NA, NA, NULL); addflag(lastrace->flags, F_CASTCHANCE, 60, NA, NA, NULL);
addflag(lastrace->flags, F_NOSPELLS, B_TRUE, NA, NA, NULL); addflag(lastrace->flags, F_NOSPELLS, B_TRUE, NA, NA, NULL);
addflag(lastrace->flags, F_DTVULN, DT_LIGHT, NA, NA, NULL); addflag(lastrace->flags, F_DTVULN, DT_LIGHT, NA, NA, NULL);
@ -9143,7 +9157,7 @@ void initrace(void) {
addflag(lastrace->flags, F_HOMEOB, NA, NA, NA, "web"); addflag(lastrace->flags, F_HOMEOB, NA, NA, NA, "web");
addflag(lastrace->flags, F_HOMELEVOB, NA, NA, NA, "10-20 webs"); addflag(lastrace->flags, F_HOMELEVOB, NA, NA, NA, "10-20 webs");
addflag(lastrace->flags, F_NOCTURNAL, B_TRUE, NA, NA, NULL); addflag(lastrace->flags, F_NOCTURNAL, B_TRUE, NA, NA, NULL);
addflag(lastrace->flags, F_NOFLEE, B_TRUE, NA, NA, NULL); addflag(lastrace->flags, F_FLEEONHPPCT, 25, NA, NA, "");
addrace(R_WOLFYOUNG, "young wolf", 10, 'd', C_GREY, MT_FLESH, RC_ANIMAL, "Immature wolves."); addrace(R_WOLFYOUNG, "young wolf", 10, 'd', C_GREY, MT_FLESH, RC_ANIMAL, "Immature wolves.");
setbodytype(lastrace, BT_QUADRAPED); setbodytype(lastrace, BT_QUADRAPED);
addbodypart(lastrace, BP_TAIL, NULL); addbodypart(lastrace, BP_TAIL, NULL);
@ -9928,10 +9942,9 @@ void initrace(void) {
addflag(lastrace->flags, F_ACTIONSPEED, SP_NORMAL, NA, NA, ""); addflag(lastrace->flags, F_ACTIONSPEED, SP_NORMAL, NA, NA, "");
addflag(lastrace->flags, F_HASATTACK, OT_TEETH, 5, NA, NULL); addflag(lastrace->flags, F_HASATTACK, OT_TEETH, 5, NA, NULL);
addflag(lastrace->flags, F_NOINJURIES, B_TRUE, NA, NA, NULL); addflag(lastrace->flags, F_NOINJURIES, B_TRUE, NA, NA, NULL);
addflag(lastrace->flags, F_STARTOBDT, 50, DT_CHOP, NA, NULL); addflag(lastrace->flags, F_STARTOBWEPSK, 50, SK_AXES, NA, NULL);
addflag(lastrace->flags, F_STARTOB, 25, NA, NA, "buckler"); addflag(lastrace->flags, F_STARTOB, 25, NA, NA, "buckler");
addflag(lastrace->flags, F_DTVULN, DT_BASH, NA, NA, NULL); addflag(lastrace->flags, F_DTVULN, DT_BASH, NA, NA, NULL);
addflag(lastrace->flags, F_DTRESIST, DT_SLASH, NA, NA, NULL);
addflag(lastrace->flags, F_DTRESIST, DT_PIERCE, NA, NA, NULL); addflag(lastrace->flags, F_DTRESIST, DT_PIERCE, NA, NA, NULL);
addflag(lastrace->flags, F_HUMANOID, B_TRUE, NA, NA, NULL); addflag(lastrace->flags, F_HUMANOID, B_TRUE, NA, NA, NULL);
addflag(lastrace->flags, F_DEAF, B_TRUE, NA, NA, NULL); addflag(lastrace->flags, F_DEAF, B_TRUE, NA, NA, NULL);
@ -10413,7 +10426,7 @@ void initskills(void) {
addskilldesc(SK_SS_ALLOMANCY, PR_EXPERT, "Allows you to cast Allomancy spells up to level 5.", B_FALSE); addskilldesc(SK_SS_ALLOMANCY, PR_EXPERT, "Allows you to cast Allomancy spells up to level 5.", B_FALSE);
addskilldesc(SK_SS_ALLOMANCY, PR_MASTER, "Allows you to cast Allomancy spells up to level 6.", B_FALSE); addskilldesc(SK_SS_ALLOMANCY, PR_MASTER, "Allows you to cast Allomancy spells up to level 6.", B_FALSE);
addskill(SK_SS_MENTAL, "Psionics", "Boosts casting of spells from this school.", 50); addskill(SK_SS_MENTAL, "Psionics", "Boosts casting of spells from this school.", 50);
addskilldesc(SK_SS_MENTAL, PR_INEPT, "- Each rank gives you a 10%% chance to learn a new psionic ability when levelling up.", B_FALSE); addskilldesc(SK_SS_MENTAL, PR_INEPT, "- Each rank gives you a 10% chance to learn a new psionic ability when levelling up.", B_FALSE);
addskilldesc(SK_SS_MENTAL, PR_NOVICE, "Allows you to cast Psionic spells up to level 1.", B_FALSE); addskilldesc(SK_SS_MENTAL, PR_NOVICE, "Allows you to cast Psionic spells up to level 1.", B_FALSE);
addskilldesc(SK_SS_MENTAL, PR_BEGINNER, "Allows you to cast Psionic spells up to level 2.", B_FALSE); addskilldesc(SK_SS_MENTAL, PR_BEGINNER, "Allows you to cast Psionic spells up to level 2.", B_FALSE);
addskilldesc(SK_SS_MENTAL, PR_ADEPT, "Allows you to cast Psionic spells up to level 3.", B_FALSE); addskilldesc(SK_SS_MENTAL, PR_ADEPT, "Allows you to cast Psionic spells up to level 3.", B_FALSE);

Binary file not shown.

23
defs.h
View File

@ -4,6 +4,9 @@
// MACROS // MACROS
#define MAXOF(a,b) (a > b ? a : b) #define MAXOF(a,b) (a > b ? a : b)
#define OB1(o,one,many) (o->amt == 1) ? one : many
#define OBS1(o) (o->amt == 1) ? "s" : ""
#define OBNOS1(o) (o->amt == 1) ? "" : "s"
// #define PRACTICETIME 15 // #attempts it takes to learn new weapon skill // #define PRACTICETIME 15 // #attempts it takes to learn new weapon skill
@ -386,8 +389,10 @@ enum COLOUR {
C_BOLDGREEN = 14, C_BOLDGREEN = 14,
C_DARKGREY = 15, C_DARKGREY = 15,
}; };
#define BLUEBG 30 #define BLACKBG 0
#define GREENBG 50 #define BLUEBG 16
#define GREENBG 32
#define REDBG 48
enum CASTTYPE { enum CASTTYPE {
CT_NORMAL = 0, CT_NORMAL = 0,
@ -1169,6 +1174,7 @@ enum OBTYPE {
OT_POT_SANCTUARY, OT_POT_SANCTUARY,
OT_POT_SLEEP, OT_POT_SLEEP,
OT_POT_SPEED, OT_POT_SPEED,
OT_POT_SPIDERCLIMB,
OT_POT_WATER, OT_POT_WATER,
OT_POT_JUICE, OT_POT_JUICE,
// soup from recipes // soup from recipes
@ -1368,6 +1374,7 @@ enum OBTYPE {
// -- summoning // -- summoning
OT_S_CREATEFOOD, OT_S_CREATEFOOD,
OT_S_FLOATINGDISC, OT_S_FLOATINGDISC,
OT_S_FRIENDS,
OT_S_GLYPHWARDING, OT_S_GLYPHWARDING,
OT_S_CLEARLEVEL, OT_S_CLEARLEVEL,
OT_S_CREATEMONSTER, OT_S_CREATEMONSTER,
@ -2369,6 +2376,10 @@ enum FLAG {
// calculation // calculation
F_STARTOBRND, // val0 = %chance of starting with a random ob F_STARTOBRND, // val0 = %chance of starting with a random ob
// v1 = depth modifier. can use 'RANDOM' // v1 = depth modifier. can use 'RANDOM'
F_STARTOBWEPSK, // val0 = %chance of starting with wepskill val1
// v1 = wepskill of object
// optional val2 = addition to map depth for rarity
// calculation
F_CONTAINER, // this object is a container - you can use 'o' F_CONTAINER, // this object is a container - you can use 'o'
// to take stuff out or put it in. // to take stuff out or put it in.
F_HOLDING, // this container is a xxx of holding and makes objects F_HOLDING, // this container is a xxx of holding and makes objects
@ -2587,6 +2598,7 @@ enum FLAG {
F_NOINJURIES, // this race cannot sustain injuries. F_NOINJURIES, // this race cannot sustain injuries.
F_NOPACK, // this race cannot hold objects F_NOPACK, // this race cannot hold objects
F_NOSPELLS, // this race cannot cast spells F_NOSPELLS, // this race cannot cast spells
F_NOPRINTS, // this race doesn't leave footprints
F_INDUCEFEAR, // causes fear when you attack it F_INDUCEFEAR, // causes fear when you attack it
F_POISONCORPSE, // lf's corpse will be poisonous F_POISONCORPSE, // lf's corpse will be poisonous
F_AUTOCREATEOB, // produces obtype 'text' wherever it walks, v0=radius F_AUTOCREATEOB, // produces obtype 'text' wherever it walks, v0=radius
@ -2724,6 +2736,7 @@ enum FLAG {
F_RISEASGHOST, // become a ghost when you die. F_RISEASGHOST, // become a ghost when you die.
F_SEEINDARK, // nightvis range is val0 F_SEEINDARK, // nightvis range is val0
F_SEEINVIS, // can see invisible things F_SEEINVIS, // can see invisible things
F_SPIDERCLIMB, // lf can climb at 100% success rate
F_SILENTMOVE, // lf makes no noise when walking/flying F_SILENTMOVE, // lf makes no noise when walking/flying
F_STABILITY, // doesn't slip over F_STABILITY, // doesn't slip over
F_STAMREGEN, // boost stamina regeneration at 'text' per turn F_STAMREGEN, // boost stamina regeneration at 'text' per turn
@ -3394,6 +3407,11 @@ typedef struct lifeform_s {
// your nightvision is increased by eyeadj / 10 // your nightvision is increased by eyeadj / 10
// max is MAX_EYEADJ // max is MAX_EYEADJ
int damlastturn; // for hp bar. not saved.
int mplastturn; // for mp bar. not saved.
float stamlastturn; // for stam bar. not saved.
int bartimer; // not saved.
// set to TRUE after lf has being created // set to TRUE after lf has being created
int born; int born;
@ -3608,6 +3626,7 @@ enum BRAND {
BR_SHADOWS, BR_SHADOWS,
BR_SLOTH, BR_SLOTH,
BR_SPEED, BR_SPEED,
BR_SPIDERCLIMB,
BR_STEALTH, BR_STEALTH,
BR_POWER, BR_POWER,
BR_SWIFTNESS, BR_SWIFTNESS,

View File

@ -2,9 +2,11 @@ defs.h:
add F_WHATEVER add F_WHATEVER
io.c: io.c:
update describeob() for when an object confers this property update makedesc_ob() for when an object confers this property
update showlfstats() to describe the property update showlfstats() to show temporarily gaining the property
update makedesc_race() to show the property as a racial characteristic
(strength/bonus)
update announceflaggain() to describe adding it update announceflaggain() to describe adding it
update announceflagloss() to describe losing it update announceflagloss() to describe losing it

6
flag.c
View File

@ -1108,6 +1108,9 @@ void timeeffectsflag(flag_t *f, int howlong) {
case F_FLYING: case F_FLYING:
warn("Your ability to fly is starting to expire..."); warn("Your ability to fly is starting to expire...");
break; break;
case F_SPIDERCLIMB:
warn("Your skin is becoming less adhesive..."); more();
break;
default: // no message default: // no message
break; break;
} }
@ -1153,6 +1156,9 @@ void timeeffectsflag(flag_t *f, int howlong) {
case F_LEVITATING: case F_LEVITATING:
warn("Your levitation is about to expire!"); more(); warn("Your levitation is about to expire!"); more();
break; break;
case F_SPIDERCLIMB:
warn("Your skin adhesion is about to expire!"); more();
break;
case F_POLYMORPHED: case F_POLYMORPHED:
warn("You are about to revert to your original form!"); more(); warn("You are about to revert to your original form!"); more();
break; break;

25
god.c
View File

@ -206,7 +206,7 @@ void angergod(enum RACE rid, int amt, enum GODANGERREASON why) {
case 2: case 2:
// summon undead // summon undead
msg("\"Destroy him, my pets!\""); msg("\"Destroy him, my pets!\"");
summonlfs(god, player->cell, RC_UNDEAD, SZ_ANY, AL_EVIL, 3, PERMENANT, B_FALSE); summonlfs(god, player->cell, R_NONE, RC_UNDEAD, SZ_ANY, AL_EVIL, 3, PERMENANT, B_FALSE);
break; break;
} }
break; break;
@ -250,15 +250,14 @@ void angergod(enum RACE rid, int amt, enum GODANGERREASON why) {
o = (object_t *)poss[rnd(0,nposs-1)]; o = (object_t *)poss[rnd(0,nposs-1)];
// damage it // damage it
getobname(o, obname, o->amt); getobname(o, obname, o->amt);
msg("Your %s %s struck by divine force!", (o->amt == 1) ? "is" : "are", msg("Your %s %s struck by divine force!", OB1(o, "is", "are"), noprefix(obname));
noprefix(obname));
takedamage(o, roll("2d4"), DT_DIRECT); takedamage(o, roll("2d4"), DT_DIRECT);
} }
break; break;
case 2: case 2:
// summon holy creautes // summon holy creautes
msg("\"Destroy him, my pets!\""); msg("\"Destroy him, my pets!\"");
summonlfs(god, player->cell, RC_ANY, SZ_ANY, AL_GOOD, 3, PERMENANT, B_FALSE); summonlfs(god, player->cell, R_NONE, RC_ANY, SZ_ANY, AL_GOOD, 3, PERMENANT, B_FALSE);
break; break;
} }
break; break;
@ -683,7 +682,7 @@ int godgiftmaybe(enum RACE rid, int fromtemple) {
addflag(o->flags, F_GODGIFT, god->race->id, NA, NA, NULL); addflag(o->flags, F_GODGIFT, god->race->id, NA, NA, NULL);
if (haslos(player, player->cell)) { if (haslos(player, player->cell)) {
getobname(o, buf, o->amt); getobname(o, buf, o->amt);
msg("%s appear%s!", buf, (o->amt == 1) ? "s" : ""); msg("%s appear%s!", buf, OBS1(o));
} else { } else {
msg("You hear something hitting the ground."); msg("You hear something hitting the ground.");
} }
@ -814,7 +813,7 @@ int prayto(lifeform_t *lf, lifeform_t *god) {
if (iscursed(o) && (o->blessknown)) { if (iscursed(o) && (o->blessknown)) {
char buf[BUFLEN]; char buf[BUFLEN];
getobname(o, buf, o->amt); getobname(o, buf, o->amt);
msg("%s explode%s in a shower of sparks!",buf, (o->amt == 1) ? "s" : ""); msg("%s explode%s in a shower of sparks!",buf, OBS1(o));
removeob(o,ALL); removeob(o,ALL);
donesomething = B_TRUE; donesomething = B_TRUE;
} }
@ -875,17 +874,19 @@ int prayto(lifeform_t *lf, lifeform_t *god) {
break; break;
case R_GODDEATH: case R_GODDEATH:
msg("\"Behold, the power of death!\""); msg("\"Behold, the power of death!\"");
for (l = lf->cell->map->lf ; l ; l = l->next) { for (i = 1; i < lf->nlos; i++) {
if ((l != lf) && haslof(lf->cell, l->cell, LOF_WALLSTOP, NULL)) { lifeform_t *who;
if (isundead(l)) { who = lf->los[i]->lf;
makepeaceful(l); if (who && !areallies(lf, who)) {
if (isundead(who)) {
makepeaceful(who);
} else { } else {
castspell(god, OT_S_PAIN, l, NULL, l->cell, NULL, NULL); castspell(god, OT_S_PAIN, who, NULL, who->cell, NULL, NULL);
castspell(god, OT_S_DRAINLIFE, who, NULL, who->cell, NULL, NULL);
} }
} }
} }
dospelleffects(god, OT_S_ANIMATEDEAD, 10, lf, NULL, lf->cell, B_UNCURSED, NULL, B_TRUE); dospelleffects(god, OT_S_ANIMATEDEAD, 10, lf, NULL, lf->cell, B_UNCURSED, NULL, B_TRUE);
dospelleffects(god, OT_S_DARKNESS, 10, lf, NULL, lf->cell, B_UNCURSED, NULL, B_TRUE);
break; break;
case R_GODTHIEVES: case R_GODTHIEVES:
if (isinbattle(lf)) { if (isinbattle(lf)) {

302
io.c
View File

@ -1702,6 +1702,12 @@ int announceflaggain(lifeform_t *lf, flag_t *f) {
msg("^%c%s %s",getlfcol(lf, CC_VBAD), lfname, isplayer(lf) ? "feel slow and sluggish." : "looks slow and sluggish."); msg("^%c%s %s",getlfcol(lf, CC_VBAD), lfname, isplayer(lf) ? "feel slow and sluggish." : "looks slow and sluggish.");
donesomething = B_TRUE; donesomething = B_TRUE;
break; break;
case F_SPIDERCLIMB:
if (isplayer(lf)) { // don't know if monsters get it
msg("Your skin becomes adhesive!");
donesomething = B_TRUE;
}
break;
case F_SPRINTING: case F_SPRINTING:
msg("%s %s sprinting!",lfname, isplayer(lf) ? "start" : "starts"); msg("%s %s sprinting!",lfname, isplayer(lf) ? "start" : "starts");
donesomething = B_TRUE; donesomething = B_TRUE;
@ -2283,6 +2289,12 @@ int announceflagloss(lifeform_t *lf, flag_t *f) {
msg("%s %s",lfname, isplayer(lf) ? "speed back up." : "speeds back up."); msg("%s %s",lfname, isplayer(lf) ? "speed back up." : "speeds back up.");
donesomething = B_TRUE; donesomething = B_TRUE;
break; break;
case F_SPIDERCLIMB:
if (isplayer(lf)) {
msg("Your skin is no longet adhesive.");
donesomething = B_TRUE;
}
break;
case F_SPRINTING: case F_SPRINTING:
if (isplayer(lf)) { // don't know if monsters lose it (but you'll see them get exhausted) if (isplayer(lf)) { // don't know if monsters lose it (but you'll see them get exhausted)
msg("You stop sprinting."); msg("You stop sprinting.");
@ -2395,11 +2407,11 @@ int announceobflaggain(object_t *o, flag_t *f) {
switch (f->id) { switch (f->id) {
case F_ONFIRE: case F_ONFIRE:
donesomething = B_TRUE; donesomething = B_TRUE;
if (o->birthtime != curtime) msg("%s catch%s on fire.",prefix, (o->amt == 1) ? "es" : ""); if (o->birthtime != curtime) msg("%s catch%s on fire.",prefix, OB1(o, "es", ""));
break; break;
case F_PRODUCESLIGHT: case F_PRODUCESLIGHT:
donesomething = B_TRUE; donesomething = B_TRUE;
if (o->birthtime != curtime) msg("%s start%s glowing!",prefix, (o->amt == 1) ? "s" : ""); if (o->birthtime != curtime) msg("%s start%s glowing!",prefix, OBS1(o));
break; break;
default: // no message default: // no message
break; break;
@ -2454,7 +2466,7 @@ void announceobflagloss(object_t *o, flag_t *f) {
msg("%s %s no longer glowing.",prefix,isare); msg("%s %s no longer glowing.",prefix,isare);
break; break;
case F_WET: case F_WET:
msg("%s %s now dry.",prefix, (o->amt == 1) ? "is" : "are"); msg("%s %s now dry.",prefix, OB1(o,"is","are"));
break; break;
default: // no message default: // no message
break; break;
@ -3279,25 +3291,29 @@ void updatestatus(void) {
// returns true if view changed // returns true if view changed
int updateviewfor(cell_t *cell) { int updateviewfor(cell_t *cell) {
int oldvx,oldvy; int oldvx,oldvy;
int w,h;
oldvx = viewx; oldvx = viewx;
oldvy = viewy; oldvy = viewy;
getmaxyx(gamewin, h, w);
// calculate viewport if required // calculate viewport if required
if ((viewx == -9999) || (viewy == -9999)) { if ((viewx == -9999) || (viewy == -9999)) {
// try to centre player // try to centre player
viewx = cell->x - (SCREENW/2); viewx = cell->x - (w/2);
viewy = cell->y - (SCREENH/2); viewy = cell->y - (h/2);
} }
while ((cell->x - viewx) >= ((SCREENW / 3)*2)) { while ((cell->x - viewx) >= ((w / 3)*2)) {
viewx++; viewx++;
} }
while ((cell->y - viewy) >= ((SCREENH / 3)*2)) { while ((cell->y - viewy) >= ((h / 3)*2)) {
viewy++; viewy++;
} }
while ((cell->x - viewx) <= (SCREENW/3)) { while ((cell->x - viewx) <= (w/3)) {
viewx--; viewx--;
} }
while ((cell->y - viewy) <= (SCREENH/3)) { while ((cell->y - viewy) <= (h/3)) {
viewy--; viewy--;
} }
@ -3683,6 +3699,11 @@ void docomms(lifeform_t *lf) {
addchoice(&prompt, 'n', "(nothing)", NULL, NULL, NULL); addchoice(&prompt, 'n', "(nothing)", NULL, NULL, NULL);
ch = getchoice(&prompt); ch = getchoice(&prompt);
if ((ch == 'n') || (ch == '\0')) {
msg("Cancelled.");
return;
}
switch (ch) { switch (ch) {
case 'a': case 'a':
snprintf(buf, BUFLEN, "Tell %s to attack who?",lfname); snprintf(buf, BUFLEN, "Tell %s to attack who?",lfname);
@ -3698,6 +3719,12 @@ void docomms(lifeform_t *lf) {
} }
getlfname(lf2, lfname2); getlfname(lf2, lfname2);
msg("You say \"Attack %s!\" to %s.",isplayer(lf2) ? "me" : lfname2, lfname); msg("You say \"Attack %s!\" to %s.",isplayer(lf2) ? "me" : lfname2, lfname);
if (lfhasflag(c->lf, F_RAGE) || !canhear(c->lf, player->cell, SV_SHOUT)) {
msg("%s doesn't respond.", lfname);
break;
}
if (lf == lf2) { if (lf == lf2) {
// won't attack itself // won't attack itself
msg("%s looks confused at your command.", lfname); msg("%s looks confused at your command.", lfname);
@ -3719,6 +3746,10 @@ void docomms(lifeform_t *lf) {
break; break;
case 'c': case 'c':
msg("You say \"Come here!\" to %s.",lfname); msg("You say \"Come here!\" to %s.",lfname);
if (lfhasflag(c->lf, F_RAGE) || !canhear(c->lf, player->cell, SV_SHOUT)) {
msg("%s doesn't respond.", lfname);
break;
}
// find adjacent cell // find adjacent cell
c = getrandomadjcell(player->cell, WE_WALKABLE, B_ALLOWEXPAND); c = getrandomadjcell(player->cell, WE_WALKABLE, B_ALLOWEXPAND);
if (c) { if (c) {
@ -3792,12 +3823,8 @@ void docomms(lifeform_t *lf) {
makeknown(o->type->id); makeknown(o->type->id);
getobname(o, newobname, o->amt); getobname(o, newobname, o->amt);
msg("%s points at your pack.", lfname); msg("%s points at your pack.", lfname);
msg("Hey I recognise %s %s.", msg("Hey I recognise %s %s.", OB1(o, "that", "those"), oldobname);
(o->amt == 1) ? "that" : "those", msg("%s %s.", OB1(o, "It's", "They're"), newobname);
oldobname);
msg("%s %s.",
(o->amt == 1) ? "It's" : "They're",
newobname);
} }
} else { // nothing } else { // nothing
sayphrase(lf, SP_BEGTHANKS, SV_TALK, NA, NULL); sayphrase(lf, SP_BEGTHANKS, SV_TALK, NA, NULL);
@ -3875,16 +3902,21 @@ void docomms(lifeform_t *lf) {
// stop attacking all current targets first... // stop attacking all current targets first...
killflagsofid(lf->flags, F_TARGETLF); killflagsofid(lf->flags, F_TARGETLF);
msg("You say \"Go over there!\" to %s.", lfname); msg("You say \"Go over there!\" to %s.", lfname);
if (lfhasflag(c->lf, F_RAGE) || !canhear(c->lf, player->cell, SV_SHOUT)) {
msg("%s doesn't respond.", lfname);
break;
}
aigoto(lf, c, MR_OTHER, NULL, DEF_AIFOLLOWTIME); aigoto(lf, c, MR_OTHER, NULL, DEF_AIFOLLOWTIME);
break; break;
case 'j': case 'j':
// charisma check to see if they'll join you. // charisma check to see if they'll join you.
msg("You say \"Join me on my quest!\" to %s.", lfname); msg("You say \"Join me on my quest!\" to %s.", lfname);
if (lfhasflag(c->lf, F_RAGE) || !canhear(c->lf, player->cell, SV_SHOUT)) {
msg("%s doesn't respond.", lfname);
break;
}
recruit(lf); recruit(lf);
break; break;
case 'n':
msg("Cancelled.");
return;
case 'p': case 'p':
// can we afford this? // can we afford this?
if (givemoney(player, lf, moneyowing)) { if (givemoney(player, lf, moneyowing)) {
@ -3924,6 +3956,11 @@ void docomms(lifeform_t *lf) {
} }
break; break;
case 'r': case 'r':
msg("You say \"Get some rest.\" to %s.", lfname);
if (lfhasflag(c->lf, F_RAGE) || !canhear(c->lf, player->cell, SV_SHOUT)) {
msg("%s doesn't respond.", lfname);
break;
}
f = isresting(lf); f = isresting(lf);
if (f) { if (f) {
stopresting(lf); stopresting(lf);
@ -3974,10 +4011,18 @@ void docomms(lifeform_t *lf) {
break; break;
case '<': case '<':
msg("You say \"Stay close!\" to %s.", lfname); msg("You say \"Stay close!\" to %s.", lfname);
if (lfhasflag(c->lf, F_RAGE) || !canhear(c->lf, player->cell, SV_SHOUT)) {
msg("%s doesn't respond.", lfname);
break;
}
setfollowdistance(lf, 1, 3); setfollowdistance(lf, 1, 3);
break; break;
case '>': case '>':
msg("You say \"Keep your distance!\" to %s.", lfname); msg("You say \"Keep your distance!\" to %s.", lfname);
if (lfhasflag(c->lf, F_RAGE) || !canhear(c->lf, player->cell, SV_SHOUT)) {
msg("%s doesn't respond.", lfname);
break;
}
setfollowdistance(lf, 3, 5); setfollowdistance(lf, 3, 5);
break; break;
} }
@ -4135,10 +4180,8 @@ void doeat(obpile_t *op) {
for (o = player->cell->obpile->first; o ; o = o->next) { for (o = player->cell->obpile->first; o ; o = o->next) {
if (caneat(player, o)) { if (caneat(player, o)) {
getobname(o, obname, o->amt); getobname(o, obname, o->amt);
snprintf(buf, BUFLEN, "There %s %s here. Eat %s", snprintf(buf, BUFLEN, "There %s %s here. Eat %s", OB1(o,"is","are"),
(o->amt == 1) ? "is" : "are", obname, OB1(o,"it","one"));
obname,
(o->amt == 1) ? "it" : "one");
ch = askchar(buf, "yn","n", B_TRUE, B_FALSE); ch = askchar(buf, "yn","n", B_TRUE, B_FALSE);
if (ch == 'y') { if (ch == 'y') {
eatob = o; eatob = o;
@ -4298,7 +4341,7 @@ void dolook(cell_t *where, int onpurpose) {
if (f) { if (f) {
// doens't matter if you're blind // doens't matter if you're blind
getobname(o, buf, o->amt); getobname(o, buf, o->amt);
msg("There %s %s here%c", (o->amt == 1) ? "is" : "are", buf, f->text[0]); msg("There %s %s here%c", OB1(o,"is","are"), buf, f->text[0]);
interrupt(player); interrupt(player);
seensomething = B_TRUE; seensomething = B_TRUE;
} else { } else {
@ -4505,11 +4548,10 @@ char *makedesc_ob(object_t *o, char *retbuf) {
if (o->material->id != MT_NOTHING) { if (o->material->id != MT_NOTHING) {
float obw; float obw;
if (o->material->id == MT_FOOD) { if (o->material->id == MT_FOOD) {
snprintf(buf, BUFLEN, "%s %s food product%s, ",(o->amt == 1) ? "It is a" : "They are", snprintf(buf, BUFLEN, "%s %s food product%s, ", OB1(o,"It is a","They are"),
getsizetext(getobsize(o)), getsizetext(getobsize(o)), OBNOS1(o));
(o->amt == 1) ? "" : "s");
} else { } else {
snprintf(buf, BUFLEN, "%s %s sized, made from %s, ",(o->amt == 1) ? "It is" : "They are", snprintf(buf, BUFLEN, "%s %s sized, made from %s, ",OB1(o,"It is","They are"),
getsizetext(getobsize(o)), getsizetext(getobsize(o)),
o->material->name); o->material->name);
} }
@ -4552,7 +4594,7 @@ char *makedesc_ob(object_t *o, char *retbuf) {
throwrange = getmaxthrowrange(player, o); throwrange = getmaxthrowrange(player, o);
if (throwrange >= 1) { if (throwrange >= 1) {
sprintf(buf, "@You could throw %s %d metres.",(o->amt == 1) ? "it" : "one", throwrange); sprintf(buf, "@You could throw %s %d metres.", OB1(o,"it","one"), throwrange);
} else { } else {
sprintf(buf, "@It is too heavy for you to throw."); sprintf(buf, "@It is too heavy for you to throw.");
} }
@ -4565,9 +4607,9 @@ char *makedesc_ob(object_t *o, char *retbuf) {
if (lfhasflag(player, F_EXTRAINFO) || lfhasflag(player, F_OMNIPOTENT)) { if (lfhasflag(player, F_EXTRAINFO) || lfhasflag(player, F_OMNIPOTENT)) {
int dam; int dam;
dam = getthrowdam(o); dam = getthrowdam(o);
sprintf(buf, "@%s good for throwing [base damage %d].",(o->amt == 1) ? "It is" : "They are", dam); sprintf(buf, "@%s good for throwing [base damage %d].",OB1(o,"It is","They are"), dam);
} else { } else {
sprintf(buf, "@%s good for throwing.", (o->amt == 1) ? "It is" : "They are"); sprintf(buf, "@%s good for throwing.", OB1(o,"It is","They are"));
} }
strncat(retbuf, buf, HUGEBUFLEN); strncat(retbuf, "\n", HUGEBUFLEN); strncat(retbuf, buf, HUGEBUFLEN); strncat(retbuf, "\n", HUGEBUFLEN);
} }
@ -4587,15 +4629,15 @@ char *makedesc_ob(object_t *o, char *retbuf) {
int basenutr; int basenutr;
basenutr = getnutritionbase(o); basenutr = getnutritionbase(o);
sprintf(buf, "%s edible, and %s %s.\n", sprintf(buf, "%s edible, and %s %s.\n",
(o->amt == 1) ? "It is" : "They are", OB1(o,"It is","They are"),
(o->amt == 1) ? "is" : "are each", OB1(o,"is","are each"),
getfillingname(basenutr)); getfillingname(basenutr));
strncat(retbuf, buf, HUGEBUFLEN); strncat(retbuf, buf, HUGEBUFLEN);
if (hasflagval(o->flags, F_OBHPDRAIN, NA, DT_DECAY, NA, NULL)) { if (hasflagval(o->flags, F_OBHPDRAIN, NA, DT_DECAY, NA, NULL)) {
// don't show "it will rot" if it's already rotten (and you know this) // don't show "it will rot" if it's already rotten (and you know this)
if (isrotting(o) && ( (getattrbracket(getattr(player, A_IQ), A_IQ, NULL) >= AT_GTAVERAGE) || getskill(player, SK_COOKING)) ) { if (isrotting(o) && ( (getattrbracket(getattr(player, A_IQ), A_IQ, NULL) >= AT_GTAVERAGE) || getskill(player, SK_COOKING)) ) {
} else { } else {
sprintf(buf, "%s will decay and go bad over time.\n", (o->amt == 1) ? "It" : "They" ); sprintf(buf, "%s will decay and go bad over time.\n", OB1(o,"It","They"));
strncat(retbuf, buf, HUGEBUFLEN); strncat(retbuf, buf, HUGEBUFLEN);
} }
} }
@ -5196,7 +5238,7 @@ char *makedesc_ob(object_t *o, char *retbuf) {
} }
f = hasflag(o->flags, F_ARMOURPIERCE); f = hasflag(o->flags, F_ARMOURPIERCE);
if (f && f->known) { if (f && f->known) {
sprintf(buf, "Armour will not reduce %s damage.\n",(o->amt == 1) ? "its" : "their"); sprintf(buf, "Armour will not reduce %s damage.\n",OB1(o,"its","their"));
strncat(retbuf, buf, HUGEBUFLEN); strncat(retbuf, buf, HUGEBUFLEN);
} }
f = hasflag(o->flags, F_BALANCE); f = hasflag(o->flags, F_BALANCE);
@ -5546,6 +5588,10 @@ char *makedesc_ob(object_t *o, char *retbuf) {
sprintf(buf2, "%s will slow down your movement.\n", buf); sprintf(buf2, "%s will slow down your movement.\n", buf);
strncat(retbuf, buf2, HUGEBUFLEN); strncat(retbuf, buf2, HUGEBUFLEN);
break; break;
case F_SPIDERCLIMB:
sprintf(buf2, "%s allows you to adhere to walls.\n", buf);
strncat(retbuf, buf2, HUGEBUFLEN);
break;
case F_TREMORSENSE: case F_TREMORSENSE:
sprintf(buf2, "%s allows you to 'see' by sensing vibrations around you.\n", buf); sprintf(buf2, "%s allows you to 'see' by sensing vibrations around you.\n", buf);
strncat(retbuf, buf2, HUGEBUFLEN); strncat(retbuf, buf2, HUGEBUFLEN);
@ -5619,21 +5665,21 @@ char *makedesc_ob(object_t *o, char *retbuf) {
} }
if (hasflag(o->flags, F_NOBLESS)) { if (hasflag(o->flags, F_NOBLESS)) {
sprintf(buf, "%s cannot be blessed or cursed.\n", (o->amt == 1) ? "It" : "They" ); sprintf(buf, "%s cannot be blessed or cursed.\n", OB1(o,"It","They") );
strncat(retbuf, buf, HUGEBUFLEN); strncat(retbuf, buf, HUGEBUFLEN);
} else { } else {
if (isblessknown(o)) { if (isblessknown(o)) {
if (o->blessed == B_BLESSED) { if (o->blessed == B_BLESSED) {
sprintf(buf, "%s a blessing bestowed upon %s.\n", sprintf(buf, "%s a blessing bestowed upon %s.\n",
(o->amt == 1) ? "It has" : "They have", OB1(o,"It has","They have"),
(o->amt == 1) ? "it" : "them"); OB1(o,"it","them"));
strncat(retbuf, buf, HUGEBUFLEN); strncat(retbuf, buf, HUGEBUFLEN);
} else if (o->blessed == B_CURSED) { } else if (o->blessed == B_CURSED) {
sprintf(buf, "%s cursed.\n", (o->amt == 1) ? "It is" : "They are"); sprintf(buf, "%s cursed.\n", OB1(o,"It is","They are"));
strncat(retbuf, buf, HUGEBUFLEN); strncat(retbuf, buf, HUGEBUFLEN);
} }
} else { } else {
sprintf(buf, "%s might be blessed or cursed.\n", (o->amt == 1) ? "It" : "They"); sprintf(buf, "%s might be blessed or cursed.\n", OB1(o,"It","They"));
strncat(retbuf, buf, HUGEBUFLEN); strncat(retbuf, buf, HUGEBUFLEN);
} }
} }
@ -5648,9 +5694,9 @@ char *makedesc_ob(object_t *o, char *retbuf) {
if (showcontents) { if (showcontents) {
if (o->type->id == OT_SPELLBOOK) { if (o->type->id == OT_SPELLBOOK) {
sprintf(buf, "\n%s contain%s the following spells:\n", (o->amt == 1) ? "It" : "They", (o->amt == 1) ? "s" : ""); sprintf(buf, "\n%s contain%s the following spells:\n", OB1(o,"It","They"), OBS1(o));
} else { } else {
sprintf(buf, "\n%s currently contain%s:\n", (o->amt == 1) ? "It" : "They", (o->amt == 1) ? "s" : ""); sprintf(buf, "\n%s currently contain%s:\n", OB1(o,"It","They"), OBS1(o));
} }
strncat(retbuf, buf, HUGEBUFLEN); strncat(retbuf, buf, HUGEBUFLEN);
@ -5884,8 +5930,9 @@ char *makedesc_race(enum RACE rid, char *retbuf, int showextra) {
case F_SEEINDARK: sprintf(buf, "Darkvision (range %d)", f->val[0]); break; case F_SEEINDARK: sprintf(buf, "Darkvision (range %d)", f->val[0]); break;
case F_SEEINVIS: sprintf(buf, "Can see invisible things"); break; case F_SEEINVIS: sprintf(buf, "Can see invisible things"); break;
case F_SILENTMOVE: sprintf(buf, "Moves silently"); break; case F_SILENTMOVE: sprintf(buf, "Moves silently"); break;
case F_SPIDERCLIMB: sprintf(buf, "Adheres to walls"); break;
case F_STABILITY: sprintf(buf, "Will not fall on slippery ground."); break; case F_STABILITY: sprintf(buf, "Will not fall on slippery ground."); break;
case F_STARTSKILL: sprintf(buf, "%s %s", getskillname(f->val[0]), getskilllevelname(f->val[1])); break; case F_STARTSKILL: sprintf(buf, "%s %s", getskilllevelname(f->val[1]), getskillname(f->val[0])); break;
case F_STENCH: sprintf(buf, "Emits a foul odour which affects others"); break; case F_STENCH: sprintf(buf, "Emits a foul odour which affects others"); break;
case F_TREMORSENSE: sprintf(buf, "Can sense vibrations (range %d)", f->val[0]); break; case F_TREMORSENSE: sprintf(buf, "Can sense vibrations (range %d)", f->val[0]); break;
case F_VISRANGEMOD: if (f->val[0] > 0) sprintf(buf, "Enhanced vision range (+%d)", f->val[0]); break; case F_VISRANGEMOD: if (f->val[0] > 0) sprintf(buf, "Enhanced vision range (+%d)", f->val[0]); break;
@ -6475,9 +6522,9 @@ void dooperate(obpile_t *op) {
strcpy(verb, getoperateverb(o)); strcpy(verb, getoperateverb(o));
capitalise(verb); capitalise(verb);
snprintf(buf, BUFLEN, "There %s %s here. %s %s", snprintf(buf, BUFLEN, "There %s %s here. %s %s",
(o->amt == 1) ? "is" : "are", OB1(o,"is","are"),
obname, verb, obname, verb,
(o->amt == 1) ? "it" : "one"); OB1(o,"it","one"));
ch = askchar(buf, "yn","n", B_TRUE, B_FALSE); ch = askchar(buf, "yn","n", B_TRUE, B_FALSE);
if (ch == 'y') { if (ch == 'y') {
operate(player, o, NULL); operate(player, o, NULL);
@ -6788,10 +6835,8 @@ void doquaff(obpile_t *op) {
} else { } else {
strcpy(drink, "Drink from"); strcpy(drink, "Drink from");
} }
snprintf(buf, BUFLEN, "There %s %s here. %s %s", snprintf(buf, BUFLEN, "There %s %s here. %s %s", OB1(o,"is","are"),
(o->amt == 1) ? "is" : "are", obname, drink, OB1(o,"it","one"));
obname, drink,
(o->amt == 1) ? "it" : "one");
ch = askchar(buf, "yn","n", B_TRUE, B_FALSE); ch = askchar(buf, "yn","n", B_TRUE, B_FALSE);
if (ch == 'y') { if (ch == 'y') {
liquid = o; liquid = o;
@ -7083,7 +7128,7 @@ void dothrow(obpile_t *op) {
if (getcelldist(player->cell, where) > maxdist) { if (getcelldist(player->cell, where) > maxdist) {
if (maxdist < 1) { if (maxdist < 1) {
msg("%s is too heavy for you to throw!",buf, (o->amt == 1) ? "is" : "are"); msg("%s is too heavy for you to throw!",buf, OB1(o,"is","are"));
} else { } else {
msg("You can't throw %s that far!",buf); msg("You can't throw %s that far!",buf);
} }
@ -7194,6 +7239,91 @@ void drawunviscell(cell_t *cell, int x, int y) {
} }
*/ */
// draw a bar as follows, with coloured background:
//
// 0123456789
// title:[ 11 / 23 ]
void drawbar(WINDOW *win, char *title, int cur, int max, int realmax, int lossamt, enum COLOUR textcol, enum COLOUR textcolwithbg, int barbg, int lossbg) {
float fcur, fmax,curpct,losspct = 0;
char buf[BUFLEN];
char numbuf[BUFLEN];
char numbuffull[BUFLEN];
char *p;
int numpad,i;
fcur = cur;
fmax = max;
curpct = (fcur / fmax) * 100;
if ((cur > 0) && (curpct < 10)) curpct = 10;
if ((cur != max) && (curpct > 90)) curpct = 90;
if (lossamt > 0) {
losspct = ((float)lossamt / fmax) * 100;
if (losspct < 10) losspct = 10;
}
if (curpct + losspct > 100) {
losspct = 100 - curpct;
}
// construct number text to fit into 10 chars
sprintf(numbuf, "%d/%d",cur,max);
if (max != realmax) strcat(numbuf, "*");
numpad = (10 - strlen(numbuf)) / 2;
p = numbuffull;
for ( i = 0; i < 10; i++) {
if (i < numpad) {
*p = ' ';
} else {
int idx;
idx = i - numpad;
if (idx < strlen(numbuf)) {
*p = numbuf[idx];
} else {
*p = ' ';
}
}
p++;
}
*p = '\0';
// show prefix
sprintf(buf, "^n%s[",title);
textwithcol(win, buf);
// show background bar and text
p = numbuffull;
for (i = 0; i < 10; i++){
enum COLOUR bgcol = BLACKBG;
int thispct;
// select bg colour...
thispct = (i+1)*10;
if (thispct <= curpct) {
bgcol = barbg;
} else if (thispct <= curpct + losspct) {
bgcol = lossbg;
} else {
bgcol = BLACKBG;
}
// set colour
if ((cur == 0) && (max != 0)) {
setcol(win, C_ORANGE+bgcol);
} else if (bgcol == BLACKBG) {
setcol(win, textcol+bgcol);
} else {
setcol(win, textcolwithbg+bgcol);
}
// show this char
waddch(win, *p);
// inc char pointer
p++;
}
// show suffix
setcol(win, C_GREY);
waddch(win, ']');
waddch(win, ' ');
waddch(win, ' ');
}
void drawglyph(glyph_t *g, int x, int y) { void drawglyph(glyph_t *g, int x, int y) {
int col; int col;
if ((gamemode == GM_GAMESTARTED) && lfhasflag(player, F_RAGE)) { if ((gamemode == GM_GAMESTARTED) && lfhasflag(player, F_RAGE)) {
@ -7355,7 +7485,7 @@ void initgfx(void) {
init_pair(C_ORANGE, COLOR_RED, COLOR_BLACK); init_pair(C_ORANGE, COLOR_RED, COLOR_BLACK);
init_pair(C_DARKGREY, COLOR_BLACK, COLOR_BLACK); init_pair(C_DARKGREY, COLOR_BLACK, COLOR_BLACK);
// 30 through 45 // 16 through 31
init_pair(BLUEBG+C_BLACK, COLOR_BLACK, COLOR_BLUE); init_pair(BLUEBG+C_BLACK, COLOR_BLACK, COLOR_BLUE);
init_pair(BLUEBG+C_RED, COLOR_RED, COLOR_BLUE); init_pair(BLUEBG+C_RED, COLOR_RED, COLOR_BLUE);
init_pair(BLUEBG+C_GREEN, COLOR_GREEN, COLOR_BLUE); init_pair(BLUEBG+C_GREEN, COLOR_GREEN, COLOR_BLUE);
@ -7373,7 +7503,7 @@ void initgfx(void) {
init_pair(BLUEBG+C_BOLDGREEN, COLOR_GREEN, COLOR_BLUE); init_pair(BLUEBG+C_BOLDGREEN, COLOR_GREEN, COLOR_BLUE);
init_pair(BLUEBG+C_ORANGE, COLOR_RED, COLOR_BLUE); init_pair(BLUEBG+C_ORANGE, COLOR_RED, COLOR_BLUE);
// 50 through 65 // 32 through 47
init_pair(GREENBG+C_BLACK, COLOR_BLACK, COLOR_GREEN); init_pair(GREENBG+C_BLACK, COLOR_BLACK, COLOR_GREEN);
init_pair(GREENBG+C_RED, COLOR_RED, COLOR_GREEN); init_pair(GREENBG+C_RED, COLOR_RED, COLOR_GREEN);
init_pair(GREENBG+C_GREEN, COLOR_GREEN, COLOR_GREEN); init_pair(GREENBG+C_GREEN, COLOR_GREEN, COLOR_GREEN);
@ -7390,6 +7520,23 @@ void initgfx(void) {
init_pair(GREENBG+C_BOLDMAGENTA, COLOR_MAGENTA, COLOR_GREEN); init_pair(GREENBG+C_BOLDMAGENTA, COLOR_MAGENTA, COLOR_GREEN);
init_pair(GREENBG+C_BOLDGREEN, COLOR_GREEN, COLOR_GREEN); init_pair(GREENBG+C_BOLDGREEN, COLOR_GREEN, COLOR_GREEN);
init_pair(GREENBG+C_ORANGE, COLOR_RED, COLOR_GREEN); init_pair(GREENBG+C_ORANGE, COLOR_RED, COLOR_GREEN);
// 48 through 63
init_pair(REDBG+C_BLACK, COLOR_BLACK, COLOR_RED);
init_pair(REDBG+C_RED, COLOR_RED, COLOR_RED);
init_pair(REDBG+C_GREEN, COLOR_GREEN, COLOR_RED);
init_pair(REDBG+C_BROWN, COLOR_YELLOW, COLOR_RED);
init_pair(REDBG+C_YELLOW, COLOR_YELLOW, COLOR_RED);
init_pair(REDBG+C_BLUE, COLOR_BLUE, COLOR_RED);
init_pair(REDBG+C_MAGENTA, COLOR_MAGENTA, COLOR_RED);
init_pair(REDBG+C_CYAN, COLOR_CYAN, COLOR_RED);
init_pair(REDBG+C_GREY, COLOR_WHITE, COLOR_RED);
init_pair(REDBG+C_YELLOW, COLOR_YELLOW, COLOR_RED);
init_pair(REDBG+C_WHITE, COLOR_WHITE, COLOR_RED);
init_pair(REDBG+C_BOLDCYAN, COLOR_CYAN, COLOR_RED);
init_pair(REDBG+C_BOLDBLUE, COLOR_BLUE, COLOR_RED);
init_pair(REDBG+C_BOLDMAGENTA, COLOR_MAGENTA, COLOR_RED);
init_pair(REDBG+C_BOLDGREEN, COLOR_GREEN, COLOR_RED);
init_pair(REDBG+C_ORANGE, COLOR_RED, COLOR_RED);
noecho(); noecho();
// TODO: change back to raw mode, or make this a switch // TODO: change back to raw mode, or make this a switch
@ -8690,6 +8837,9 @@ void msg_real(char *format, ... ) {
} }
int needsbold(enum COLOUR col) { int needsbold(enum COLOUR col) {
if (col >= REDBG) col -= REDBG;
if (col >= GREENBG) col -= GREENBG;
if (col >= BLUEBG) col -= BLUEBG;
switch (col) { switch (col) {
case C_YELLOW: case C_YELLOW:
case C_WHITE: case C_WHITE:
@ -8716,7 +8866,7 @@ void drawstatus(void) {
//char mpbuf[BUFLEN]; //char mpbuf[BUFLEN];
char waitbuf[BUFLEN]; char waitbuf[BUFLEN];
//char pname[BUFLEN]; //char pname[BUFLEN];
char maxmpstr[BUFLEN]; //char maxmpstr[BUFLEN];
flag_t *f; flag_t *f;
enum ATTRIB a; enum ATTRIB a;
int myatt[MAXATTS]; int myatt[MAXATTS];
@ -8728,6 +8878,13 @@ void drawstatus(void) {
// FIRST LINE // FIRST LINE
wmove(statwin, 0, 0); wmove(statwin, 0, 0);
// hp
drawbar(statwin, "HP", player->hp, player->maxhp, player->maxhp, player->damlastturn, C_GREY, C_BLUE, GREENBG, REDBG);
// mp
drawbar(statwin, "MP", player->mp, getmaxmp(player), player->maxmp, player->mplastturn, C_GREY, C_GREY, BLUEBG, REDBG);
// stamina
drawbar(statwin, "SP", getstamina(player), getmaxstamina(player), getmaxstamina(player), ceil(player->stamlastturn), C_GREY, C_GREY, BLUEBG, REDBG);
// gun target ? // gun target ?
f = hasflag(player->flags, F_GUNTARGET); f = hasflag(player->flags, F_GUNTARGET);
if (f) { if (f) {
@ -8748,6 +8905,7 @@ void drawstatus(void) {
wattron(statwin, A_BOLD); wprintw(statwin, "] "); wattroff(statwin, A_BOLD); wattron(statwin, A_BOLD); wprintw(statwin, "] "); wattroff(statwin, A_BOLD);
*/ */
/*
// HP // HP
wattron(statwin, A_BOLD); wprintw(statwin, "HP:"); wattroff(statwin, A_BOLD); wattron(statwin, A_BOLD); wprintw(statwin, "HP:"); wattroff(statwin, A_BOLD);
setcol(statwin, getpctcol(player->hp, player->maxhp)); setcol(statwin, getpctcol(player->hp, player->maxhp));
@ -8780,7 +8938,19 @@ void drawstatus(void) {
wprintw(statwin, "%d",getstamina(player)); wprintw(statwin, "%d",getstamina(player));
unsetcol(statwin, getpctcol(getstamina(player), (int)getmaxstamina(player))); unsetcol(statwin, getpctcol(getstamina(player), (int)getmaxstamina(player)));
wprintw(statwin, "/%d ",(int)getmaxstamina(player)); wprintw(statwin, "/%d ",(int)getmaxstamina(player));
*/
wattron(statwin, A_BOLD); wprintw(statwin, "AR:"); wattroff(statwin, A_BOLD);
snprintf(buf, BUFLEN, "%d ", getarmourrating(player, NULL, NULL, NULL));
wprintw(statwin, buf);
wattron(statwin, A_BOLD); wprintw(statwin, "EV:"); wattroff(statwin, A_BOLD);
wprintw(statwin, "%d ", getevasion(player));
wattron(statwin, A_BOLD); wprintw(statwin, "$:"); wattroff(statwin, A_BOLD);
snprintf(buf, BUFLEN, "%d ", countmoney(player->pack));
wprintw(statwin, buf);
wattron(statwin, A_BOLD); wprintw(statwin, "Xp:"); wattroff(statwin, A_BOLD); wattron(statwin, A_BOLD); wprintw(statwin, "Xp:"); wattroff(statwin, A_BOLD);
snprintf(buf, BUFLEN, "%d", player->level); snprintf(buf, BUFLEN, "%d", player->level);
@ -8797,9 +8967,10 @@ void drawstatus(void) {
} }
wattron(statwin, A_BOLD); wprintw(statwin, " Trn:"); wattroff(statwin, A_BOLD); wattron(statwin, A_BOLD); wprintw(statwin, " Trn:"); wattroff(statwin, A_BOLD);
wprintw(statwin, "%d/%d%%", player->skillpoints, wprintw(statwin, "%d/%d%% ", player->skillpoints,
(int) ((float)player->skillxp / (float)getspforpoint(player) * 100.0) ); (int) ((float)player->skillxp / (float)getspforpoint(player) * 100.0) );
// blinded? // blinded?
if (isblind(player) && !lfhasflag(player, F_ASLEEP)) { if (isblind(player) && !lfhasflag(player, F_ASLEEP)) {
setcol(statwin, C_RED); setcol(statwin, C_RED);
@ -9062,16 +9233,6 @@ void drawstatus(void) {
//redraw(); //redraw();
wmove(statwin, 2, 0); wmove(statwin, 2, 0);
wattron(statwin, A_BOLD); wprintw(statwin, "AR:"); wattroff(statwin, A_BOLD);
snprintf(buf, BUFLEN, "%d ", getarmourrating(player, NULL, NULL, NULL));
wprintw(statwin, buf);
wattron(statwin, A_BOLD); wprintw(statwin, "EV:"); wattroff(statwin, A_BOLD);
wprintw(statwin, "%d ", getevasion(player));
wattron(statwin, A_BOLD); wprintw(statwin, "$:"); wattroff(statwin, A_BOLD);
snprintf(buf, BUFLEN, "%d ", countmoney(player->pack));
wprintw(statwin, buf);
for (a = 0; a < MAXATTS; a++) { for (a = 0; a < MAXATTS; a++) {
wattron(statwin, A_BOLD); wprintw(statwin, "%s:",getattrabbrev(a)); wattroff(statwin, A_BOLD); wattron(statwin, A_BOLD); wprintw(statwin, "%s:",getattrabbrev(a)); wattroff(statwin, A_BOLD);
@ -9355,7 +9516,6 @@ void showlfstats(lifeform_t *lf, int showall) {
char actbuf[BUFLEN],movebuf[BUFLEN]; char actbuf[BUFLEN],movebuf[BUFLEN];
int h; int h;
char buf[BUFLEN],buf2[BUFLEN]; char buf[BUFLEN],buf2[BUFLEN];
char *descbuf = NULL;
job_t *j; job_t *j;
flag_t *f; flag_t *f;
//char *ftext= "%13s: "; //char *ftext= "%13s: ";
@ -9888,7 +10048,9 @@ void showlfstats(lifeform_t *lf, int showall) {
y = y2 + 1; y = y2 + 1;
} }
/*
if (!isplayer(lf)) { if (!isplayer(lf)) {
char *descbuf = NULL;
int x=0; int x=0;
// description first. // description first.
descbuf = malloc(HUGEBUFLEN * sizeof(char)); descbuf = malloc(HUGEBUFLEN * sizeof(char));
@ -9899,6 +10061,7 @@ void showlfstats(lifeform_t *lf, int showall) {
getyx(mainwin, y, x); getyx(mainwin, y, x);
} }
*/
// knowledge? // knowledge?
if (lf != player) { if (lf != player) {
char knowstring[BUFLEN]; char knowstring[BUFLEN];
@ -10653,6 +10816,16 @@ void showlfstats(lifeform_t *lf, int showall) {
mvwprintw(mainwin, y, 0, "%s can see invisible things.", you(lf)); mvwprintw(mainwin, y, 0, "%s can see invisible things.", you(lf));
y++; y++;
} }
f = lfhasknownflag(lf, F_SPIDERCLIMB);
if (f && (f->known) && (f->lifetime != FROMRACE)) {
mvwprintw(mainwin, y, 0, "%s adhesive skin allows %s to climb walls.", your(lf), you(lf));
y++;
}
f = lfhasknownflag(lf, F_STABILITY);
if (f && (f->known) && (f->lifetime != FROMRACE)) {
mvwprintw(mainwin, y, 0, "%s will not fall on slippery ground.", you(lf));
y++;
}
f = lfhasknownflag(lf, F_XRAYVIS); f = lfhasknownflag(lf, F_XRAYVIS);
if (f && (f->known) && (f->lifetime != FROMRACE)) { if (f && (f->known) && (f->lifetime != FROMRACE)) {
mvwprintw(mainwin, y, 0, "%s can see through walls.", you(lf)); mvwprintw(mainwin, y, 0, "%s can see through walls.", you(lf));
@ -11483,6 +11656,7 @@ void wrapprint(WINDOW *win, int *y, int *x, char *format, ... ) {
vsnprintf( buf, HUGEBUFLEN, format, args ); vsnprintf( buf, HUGEBUFLEN, format, args );
va_end(args); va_end(args);
if (!strlen(buf)) return;
// remember the amount of spaces at the end // remember the amount of spaces at the end
p = buf + strlen(buf) - 1; p = buf + strlen(buf) - 1;

1
io.h
View File

@ -73,6 +73,7 @@ void dothrow(obpile_t *op);
int dowear(obpile_t *op); int dowear(obpile_t *op);
int doweild(obpile_t *op); int doweild(obpile_t *op);
int downline(int *y, int h, char *heading, char *subheading, char *bottomstring, char *cmdchars, char *retchar); int downline(int *y, int h, char *heading, char *subheading, char *bottomstring, char *cmdchars, char *retchar);
void drawbar(WINDOW *win, char *title, int cur, int max, int realmax, int lossamt, enum COLOUR textcol, enum COLOUR textcolwithbg, int barbg, int lossbg);
void drawglyph(glyph_t *g, int x, int y); void drawglyph(glyph_t *g, int x, int y);
//void drawunviscell(cell_t *cell, int x, int y); //void drawunviscell(cell_t *cell, int x, int y);
//void drawcellwithcontents(cell_t *cell, int x, int y); //void drawcellwithcontents(cell_t *cell, int x, int y);

155
lf.c
View File

@ -1014,10 +1014,12 @@ int canreach(lifeform_t *lf, lifeform_t *victim, int *reachpenalty) {
// harder to hit something which is climbing above you // harder to hit something which is climbing above you
if (isclimbing(victim) && !isclimbing(lf)) { if (isclimbing(victim) && !isclimbing(lf)) {
if (getskill(lf, SK_CLIMBING) != PR_MASTER) { if (getskill(lf, SK_CLIMBING) != PR_MASTER) {
if (!lfhasflag(lf, F_SPIDERCLIMB)) {
sizetoreach = SZ_LARGE; sizetoreach = SZ_LARGE;
} }
} }
} }
}
if (sizetoreach == SZ_ANY) { if (sizetoreach == SZ_ANY) {
if (reachpenalty) *reachpenalty = 0; if (reachpenalty) *reachpenalty = 0;
@ -1935,7 +1937,7 @@ int check_rest_ok(lifeform_t *lf) {
msg("You cannot rest while levitating in mid-air!"); msg("You cannot rest while levitating in mid-air!");
break; break;
case E_MONSTERNEARBY: case E_MONSTERNEARBY:
msg("You cannot rest - there are monsters nearby!"); msg("You cannot rest - there are monsters in view!");
break; break;
default: default:
msg("You cannot rest for some reason."); msg("You cannot rest for some reason.");
@ -4304,10 +4306,6 @@ void gainhp(lifeform_t *lf, int amt) {
int gained = B_FALSE; int gained = B_FALSE;
int maxed = B_FALSE; int maxed = B_FALSE;
if (isplayer(lf)) {
statdirty = B_TRUE;
}
if (lf->hp < lf->maxhp) { if (lf->hp < lf->maxhp) {
lf->hp += amt; lf->hp += amt;
gained = B_TRUE; gained = B_TRUE;
@ -4319,6 +4317,10 @@ void gainhp(lifeform_t *lf, int amt) {
} }
if (isplayer(lf)) { if (isplayer(lf)) {
if (gained) {
player->damlastturn = 0;
statdirty = B_TRUE;
}
if (maxed) { if (maxed) {
msg("^gYou are now fully healed."); msg("^gYou are now fully healed.");
} }
@ -4422,6 +4424,7 @@ void gainmp(lifeform_t *lf, int amt) {
msg("^GYour mana is now fully restored."); msg("^GYour mana is now fully restored.");
} }
if (gained) { if (gained) {
player->mplastturn = 0;
statdirty = B_TRUE; statdirty = B_TRUE;
drawstatus(); drawstatus();
updatestatus(); updatestatus();
@ -4782,7 +4785,13 @@ void getwhowillfollow(lifeform_t *lf, object_t *stairob, lifeform_t **adjally, i
if (ok) { // still ok? if (ok) { // still ok?
adjally[*nadjallies] = c->lf; adjally[*nadjallies] = c->lf;
if (seen) seen[*nadjallies] = cansee(lf, c->lf); if (seen) {
if (areallies(lf, c->lf)) {
seen[*nadjallies] = B_TRUE;
} else {
seen[*nadjallies] = cansee(lf, c->lf);
}
}
(*nadjallies)++; (*nadjallies)++;
if (*nadjallies >= MAXFOLLOWLFS) return; if (*nadjallies >= MAXFOLLOWLFS) return;
} }
@ -8269,7 +8278,7 @@ flag_t *giveskill(lifeform_t *lf, enum SKILL id) {
} }
} else if (id == SK_CLIMBING) { } else if (id == SK_CLIMBING) {
newf = hasflagval(lf->flags, F_CANWILL, OT_A_CLIMB, NA, NA, NULL); newf = hasflagval(lf->flags, F_CANWILL, OT_A_CLIMB, NA, NA, NULL);
if (!newf) { if (!newf || (newf->lifetime > 0)) {
newf = addflag(lf->flags, F_CANWILL, OT_A_CLIMB, NA, NA, NULL); newf = addflag(lf->flags, F_CANWILL, OT_A_CLIMB, NA, NA, NULL);
newf->lifetime = FROMSKILL; newf->lifetime = FROMSKILL;
} }
@ -8648,7 +8657,7 @@ void givestartobs(lifeform_t *lf, object_t *targob, flagpile_t *fp) {
} }
// if (getrandomobofsize(targmap, buf, maxobsize)) { // if (getrandomobofsize(targmap, buf, maxobsize)) {
if (real_getrandomob(targmap, buf, targmap->depth + depthmod, NA, maxobsize, B_TRUE, OC_NONE, DT_NONE)) { if (real_getrandomob(targmap, buf, targmap->depth + depthmod, NA, maxobsize, SK_NONE, B_TRUE, OC_NONE, DT_NONE)) {
if (isshop && strstr(buf, "gold coin")) strcpy(buf, "potion of water"); if (isshop && strstr(buf, "gold coin")) strcpy(buf, "potion of water");
o = addob(op, buf); o = addob(op, buf);
} }
@ -8660,13 +8669,13 @@ void givestartobs(lifeform_t *lf, object_t *targob, flagpile_t *fp) {
snprintf(buf2, BUFLEN, "calling startobdt"); snprintf(buf2, BUFLEN, "calling startobdt");
} }
depthmod = val[1]; depthmod = val[2];
switch (depthmod) { switch (depthmod) {
case NA: depthmod = 0; break; case NA: depthmod = 0; break;
case RANDOM: depthmod = rnd(0,MAXDEPTH); break; case RANDOM: depthmod = rnd(0,MAXDEPTH); break;
default: break; default: break;
} }
if (real_getrandomob(targmap, buf, targmap->depth + depthmod, NA, maxobsize, B_TRUE, OC_NONE, val[1], DT_NONE)) { if (real_getrandomob(targmap, buf, targmap->depth + depthmod, NA, maxobsize, SK_NONE, B_TRUE, OC_NONE, val[1], DT_NONE)) {
if (db) snprintf(buf2, BUFLEN, "finished startobdt successfuly."); if (db) snprintf(buf2, BUFLEN, "finished startobdt successfuly.");
if (isshop && strstr(buf, "gold coin")) strcpy(buf, "potion of water"); if (isshop && strstr(buf, "gold coin")) strcpy(buf, "potion of water");
o = addob(op, buf); o = addob(op, buf);
@ -8675,6 +8684,27 @@ void givestartobs(lifeform_t *lf, object_t *targob, flagpile_t *fp) {
} }
//assert(strlen(buf) > 0); //assert(strlen(buf) > 0);
} }
} else if (id == F_STARTOBWEPSK) {
if (rnd(1,100) <= val[0]) {
int depthmod;
if (db) {
snprintf(buf2, BUFLEN, "calling startobwepsk");
}
depthmod = val[2];
switch (depthmod) {
case NA: depthmod = 0; break;
case RANDOM: depthmod = rnd(0,MAXDEPTH); break;
default: break;
}
if (real_getrandomob(targmap, buf, targmap->depth + depthmod, NA, maxobsize, val[1], B_TRUE, OC_NONE, DT_NONE)) {
if (db) snprintf(buf2, BUFLEN, "finished startobwepsk successfuly.");
o = addob(op, buf);
} else {
if (db) snprintf(buf2, BUFLEN, "finished startobwepsk, failed.");
}
//assert(strlen(buf) > 0);
}
} else if (id == F_STARTOBCLASS) { } else if (id == F_STARTOBCLASS) {
if (rnd(1,100) <= val[0]) { if (rnd(1,100) <= val[0]) {
int depthmod; int depthmod;
@ -8691,7 +8721,7 @@ void givestartobs(lifeform_t *lf, object_t *targob, flagpile_t *fp) {
//obdb = B_TRUE; //obdb = B_TRUE;
//if (getrandomobwithclass(targmap, val[1], buf, val[2])) { //if (getrandomobwithclass(targmap, val[1], buf, val[2])) {
if (real_getrandomob(targmap, buf, getmapdifficulty(targmap) + depthmod, NA, maxobsize, B_TRUE, if (real_getrandomob(targmap, buf, getmapdifficulty(targmap) + depthmod, NA, maxobsize, SK_NONE, B_TRUE,
val[1], OC_NONE, DT_NONE)) { val[1], OC_NONE, DT_NONE)) {
if (db) snprintf(buf2, BUFLEN, "finished startobclass, success."); if (db) snprintf(buf2, BUFLEN, "finished startobclass, success.");
if (isshop && strstr(buf, "gold coin")) strcpy(buf, "potion of water"); if (isshop && strstr(buf, "gold coin")) strcpy(buf, "potion of water");
@ -8729,6 +8759,7 @@ void givestartobs(lifeform_t *lf, object_t *targob, flagpile_t *fp) {
killflagsofid(fp, F_STARTOB); killflagsofid(fp, F_STARTOB);
killflagsofid(fp, F_STARTOBDT); killflagsofid(fp, F_STARTOBDT);
killflagsofid(fp, F_STARTOBCLASS); killflagsofid(fp, F_STARTOBCLASS);
killflagsofid(fp, F_STARTOBWEPSK);
// SPECIAL CASES // SPECIAL CASES
if (lf) { if (lf) {
@ -10437,6 +10468,10 @@ lifeform_t *real_addlf(cell_t *cell, enum RACE rid, int level, int controller) {
a->alive = B_TRUE; a->alive = B_TRUE;
a->lastdam = strdup("nothing"); a->lastdam = strdup("nothing");
a->lastdamtype = DT_NONE; a->lastdamtype = DT_NONE;
a->damlastturn = 0;
a->mplastturn = 0;
a->stamlastturn = 0;
a->bartimer = 0;
a->killverb = strdup("Killed"); a->killverb = strdup("Killed");
if ((gamemode == GM_GAMESTARTED) && a->prev) { if ((gamemode == GM_GAMESTARTED) && a->prev) {
a->timespent = a->prev->timespent + 1; a->timespent = a->prev->timespent + 1;
@ -10636,6 +10671,10 @@ object_t *addtrail(lifeform_t *lf, cell_t *where, int dir, int doprints, int dos
return NULL; return NULL;
} }
if (lfhasflag(lf, F_NOPRINTS)) {
doprints = B_FALSE;
}
// footprints first // footprints first
if (doprints) { if (doprints) {
if (!isairborne(lf) && !lfhasflag(lf, F_NONCORPOREAL)) { if (!isairborne(lf) && !lfhasflag(lf, F_NONCORPOREAL)) {
@ -11641,6 +11680,8 @@ int losehp_real(lifeform_t *lf, int amt, enum DAMTYPE damtype, lifeform_t *froml
// stop hiding // stop hiding
killflagsofid(lf->flags, F_HIDING); killflagsofid(lf->flags, F_HIDING);
// methods of knocking unconscious
if (!isundead(lf)) {
// merciful weapons // merciful weapons
if (fromob) { if (fromob) {
f = hasflag(fromob->flags, F_MERCIFUL); f = hasflag(fromob->flags, F_MERCIFUL);
@ -11657,6 +11698,7 @@ int losehp_real(lifeform_t *lf, int amt, enum DAMTYPE damtype, lifeform_t *froml
if (!ko) { if (!ko) {
if (damtype == DT_BASH) { if (damtype == DT_BASH) {
int hpleftafterdam; int hpleftafterdam;
// if this damage would reduce the lf to between -1 and 0 hp
hpleftafterdam = lf->hp - amt; hpleftafterdam = lf->hp - amt;
if ((lf->hp > 1) && (hpleftafterdam >= -5) && (hpleftafterdam <= 0)) { if ((lf->hp > 1) && (hpleftafterdam >= -5) && (hpleftafterdam <= 0)) {
if (onein(2)) { if (onein(2)) {
@ -11666,8 +11708,9 @@ int losehp_real(lifeform_t *lf, int amt, enum DAMTYPE damtype, lifeform_t *froml
} }
} }
} }
}
// large damage? // large damage will be stopped by a ring of miracles
if ((amt >= (lf->maxhp / 2)) && (amt >= 20)) { if ((amt >= (lf->maxhp / 2)) && (amt >= 20)) {
if (useringofmiracles(lf, 1)) { if (useringofmiracles(lf, 1)) {
return 0; return 0;
@ -11683,6 +11726,16 @@ int losehp_real(lifeform_t *lf, int amt, enum DAMTYPE damtype, lifeform_t *froml
msg("[%s takes %d dam]",lfname, amt); msg("[%s takes %d dam]",lfname, amt);
} }
// remember the amt of damage
if (isplayer(lf)) {
if (lf->bartimer == 2) {
lf->damlastturn += amt;
} else {
lf->damlastturn = amt;
lf->bartimer = 2;
}
}
// take damage // take damage
lf->hp -= amt; lf->hp -= amt;
@ -11908,6 +11961,14 @@ int losehp_real(lifeform_t *lf, int amt, enum DAMTYPE damtype, lifeform_t *froml
} }
void losemp(lifeform_t *lf, int amt) { void losemp(lifeform_t *lf, int amt) {
if (isplayer(lf)) {
if (lf->bartimer == 2) {
lf->mplastturn += amt;
} else {
lf->mplastturn = amt;
lf->bartimer = 2;
}
}
lf->mp -= amt; lf->mp -= amt;
if (lf->mp < 0) { if (lf->mp < 0) {
@ -12328,6 +12389,19 @@ void modstamina(lifeform_t *lf, float howmuch) {
return; return;
} }
if (isplayer(lf)) {
if (howmuch < 0) {
if (lf->bartimer == 2) {
lf->stamlastturn += fabs(howmuch);
} else {
lf->stamlastturn = fabs(howmuch);
lf->bartimer = 2;
}
} else if (howmuch > 0) {
lf->stamlastturn = 0;
}
}
orig = getstamina(lf); orig = getstamina(lf);
lf->stamina += howmuch; lf->stamina += howmuch;
limitf(&(lf->stamina), 0, getmaxstamina(lf)); limitf(&(lf->stamina), 0, getmaxstamina(lf));
@ -12711,10 +12785,10 @@ int pickup(lifeform_t *lf, object_t *what, int howmany, int fromground, int want
msg("You can't pick up %s!",obname); msg("You can't pick up %s!",obname);
break; break;
case E_TOOBIG: case E_TOOBIG:
msg("%s %s too large for you to lift.",obname, (what->amt == 1) ? "is" : "are"); msg("%s %s too large for you to lift.",obname, OB1(what,"is","are"));
break; break;
case E_TOOHEAVY: case E_TOOHEAVY:
msg("%s %s too heavy to lift!",obname, (what->amt == 1) ? "is" : "are"); msg("%s %s too heavy to lift!",obname, OB1(what,"is","are"));
break; break;
case E_GRAVBOOSTED: case E_GRAVBOOSTED:
msg("The %s feels too heavy to lift!",noprefix(obname)); msg("The %s feels too heavy to lift!",noprefix(obname));
@ -13167,23 +13241,26 @@ int recruit(lifeform_t *lf) {
} else { } else {
int result; int result;
int difficulty; int difficulty;
int minmult,maxmult;
difficulty = 20 + ((gethitdice(player) - gethitdice(lf))*2); difficulty = 20 + ((gethitdice(player) - gethitdice(lf))*2);
if (real_skillcheck(player, A_CHA, difficulty, 0, &result)) { if (real_skillcheck(player, A_CHA, difficulty, 0, &result)) {
minmult = 10;
maxmult = 20;
// passed // passed
askingprice = rnd(gethitdice(lf)*5, gethitdice(lf)*20 );
addflag(lf->flags, F_HIREPRICE, askingprice, NA, NA, NULL);
} else { } else {
if (difficulty - result >= 10) { if (difficulty - result >= 10) {
// very expensive // very expensive
askingprice = rnd(gethitdice(lf)*20, gethitdice(lf)*30 ); minmult = 20;
addflag(lf->flags, F_HIREPRICE, askingprice, NA, NA, NULL); maxmult = 30;
} else { } else {
// expensive // expensive
askingprice = rnd(gethitdice(lf)*10, gethitdice(lf)*25 ); minmult = 15;
maxmult = 25;
}
}
askingprice = rnd(gethitdice(lf)*minmult, gethitdice(lf)*maxmult );
addflag(lf->flags, F_HIREPRICE, askingprice, NA, NA, NULL); addflag(lf->flags, F_HIREPRICE, askingprice, NA, NA, NULL);
} }
}
}
if (askingprice != 0) { if (askingprice != 0) {
// modify for same job // modify for same job
@ -14482,6 +14559,11 @@ int real_skillcheck(lifeform_t *lf, enum CHECKTYPE ct, int diff, int mod, int *r
othermod += f->val[0]; othermod += f->val[0];
} }
} }
// autopass if we have spiderclimb skill.
if (lfhasflag(lf, F_SPIDERCLIMB)) {
othermod = diff;
}
} else if (ct == SC_DODGE) { } else if (ct == SC_DODGE) {
if (attrib) { if (attrib) {
// ie. -2 to 2 // ie. -2 to 2
@ -14826,6 +14908,8 @@ void startlfturn(lifeform_t *lf) {
// update where player knows // update where player knows
// (but without a map you will then slowly forget it) // (but without a map you will then slowly forget it)
if (isplayer(lf)) { if (isplayer(lf)) {
// update line of sight if required
if (lf->losdirty) precalclos(lf);
updateknowncells(); updateknowncells();
} else { } else {
// ai start of turn code // ai start of turn code
@ -14964,7 +15048,7 @@ void startlfturn(lifeform_t *lf) {
case PR_MASTER: lossamt = 0; break; case PR_MASTER: lossamt = 0; break;
} }
if (lossamt) modstamina(lf, -lossamt); if (lossamt) modstamina(lf, -lossamt);
} else if (isclimbing(lf) && isplayer(lf)) { } else if (isclimbing(lf) && !lfhasflag(lf, F_SPIDERCLIMB)) {
int lossamt; int lossamt;
// players lose stamina based on climbing skill // players lose stamina based on climbing skill
// monsters don't lose stamina to climb. // monsters don't lose stamina to climb.
@ -15089,13 +15173,13 @@ void startlfturn(lifeform_t *lf) {
moveob(o, c->obpile, o->amt); moveob(o, c->obpile, o->amt);
if (isplayer(lf)) { if (isplayer(lf)) {
getobname(o, buf, o->amt); getobname(o, buf, o->amt);
msg("^wYour %s flies out of your hands!",noprefix(buf), (o->amt == 1) ? "flies" : "fly"); msg("^wYour %s %s out of your hands!",noprefix(buf), OB1(o,"flies","fly"));
} else if (cansee(player, lf)) { } else if (cansee(player, lf)) {
char lfname[BUFLEN]; char lfname[BUFLEN];
getobname(o, buf, o->amt); getobname(o, buf, o->amt);
getlfname(lf, lfname); getlfname(lf, lfname);
msg("%s%s %s flies out of its hands!",lfname, getpossessive(lfname), msg("%s%s %s flies out of its hands!",lfname, getpossessive(lfname),
noprefix(buf), (o->amt == 1) ? "flies" : "fly"); noprefix(buf), OB1(o,"flies","fly"));
} }
} }
} }
@ -15369,6 +15453,10 @@ void startlfturn(lifeform_t *lf) {
} }
} }
// if you are stunned and flying, you fall
if (isairborne(lf) && lfhasflag(lf, F_STUNNED)) {
fall_from_air(lf);
}
f = hasflag(lf->flags, F_POISONED); f = hasflag(lf->flags, F_POISONED);
if (f) { if (f) {
@ -16248,7 +16336,9 @@ int tryclimb(lifeform_t *lf, cell_t *where, char *towhat) {
msg("%s reaches %s.", towhat); msg("%s reaches %s.", towhat);
} }
// train climbing // train climbing
if (!lfhasflag(lf, F_SPIDERCLIMB)) {
practice(lf, SK_CLIMBING, 1); practice(lf, SK_CLIMBING, 1);
}
// continue... // continue...
} else { } else {
// you fall. // you fall.
@ -16316,8 +16406,7 @@ int touch(lifeform_t *lf, object_t *o) {
if (!gloves) { if (!gloves) {
if (isplayer(lf)) { if (isplayer(lf)) {
msg("^bThe %s burn%s you as you touch %s!",noprefix(obname), msg("^bThe %s burn%s you as you touch %s!",noprefix(obname),
(o->amt == 1) ? "s" : "", OBS1(o), OB1(o, "it", "them") ) ;
(o->amt == 1) ? "it" : "them" );
o->blessknown = B_TRUE; o->blessknown = B_TRUE;
} else if (cansee(player, lf)) { } else if (cansee(player, lf)) {
msg("%s touches %s then recoils in pain!",lfname, obname); msg("%s touches %s then recoils in pain!",lfname, obname);
@ -16937,6 +17026,15 @@ int validateraces(void) {
printf("ERROR in race '%s' - F_HASATTACK with no DR\n", r->name); printf("ERROR in race '%s' - F_HASATTACK with no DR\n", r->name);
goterror = B_TRUE; goterror = B_TRUE;
} }
} else if (f->id == F_NOFLEE) {
if (lfhasflag(lf, F_FLEEONHPPCT)) {
printf("ERROR in race '%s' - has both F_NOFLEE and F_FLEEONHPPCT.\n", r->name);
goterror = B_TRUE;
}
if (lfhasflag(lf, F_FLEEONDAM)) {
printf("ERROR in race '%s' - has both F_NOFLEE and F_FLEEONDAM.\n", r->name);
goterror = B_TRUE;
}
} else if (f->id == F_STARTOB) { } else if (f->id == F_STARTOB) {
if (!f->text || (strlen(f->text) == 0)) { if (!f->text || (strlen(f->text) == 0)) {
printf("ERROR in race '%s' - F_STARTOB with zero length text.\n", r->name); printf("ERROR in race '%s' - F_STARTOB with zero length text.\n", r->name);
@ -16990,6 +17088,11 @@ int validateraces(void) {
printf("ERROR in race '%s' - has both NOSMELL and ENHANCESMELL.\n", r->name); printf("ERROR in race '%s' - has both NOSMELL and ENHANCESMELL.\n", r->name);
goterror = B_TRUE; goterror = B_TRUE;
} }
} else if (f->id == F_STARTOBWEPSK) {
if (!findskill(f->val[1])) {
printf("ERROR in race '%s' - STARTOBWEPSK with invalid weapon skill.\n", r->name);
goterror = B_TRUE;
}
} }
} // end foreach flag } // end foreach flag

47
map.c
View File

@ -472,7 +472,7 @@ object_t *addrandomob(cell_t *c) {
return NULL; return NULL;
} }
if (real_getrandomob(c->map, buf, NA, c->habitat->id, SZ_MAX, B_FALSE, OC_NONE, DT_NONE)) { if (real_getrandomob(c->map, buf, NA, c->habitat->id, SZ_MAX, SK_NONE, B_FALSE, OC_NONE, DT_NONE)) {
if (db) dblog("adding rand obj %s to cell %d,%d",buf,c->x,c->y); if (db) dblog("adding rand obj %s to cell %d,%d",buf,c->x,c->y);
o = addob(c->obpile, buf); o = addob(c->obpile, buf);
} }
@ -1898,7 +1898,7 @@ void createdungeon(map_t *map, int depth, map_t *parentmap, int exitdir, object_
cell = getrandomcell(map); cell = getrandomcell(map);
setcelltype(cell, emptycell); setcelltype(cell, emptycell);
cell->visited = B_TRUE; cell->visited = B_TRUE;
//if (db) printf("- Starting (%d,%d)\n",cell->x, cell->y); if (db) printf("- Starting (%d,%d)\n",cell->x, cell->y);
lastdir = D_UNKNOWN; lastdir = D_UNKNOWN;
done = B_FALSE; done = B_FALSE;
@ -1910,7 +1910,7 @@ void createdungeon(map_t *map, int depth, map_t *parentmap, int exitdir, object_
dir = D_NONE; dir = D_NONE;
while (dir == D_NONE) { while (dir == D_NONE) {
int badcount; int badcount;
//if (db) printf("- At (%d,%d), moved %d, finding new direction...\n",cell->x, cell->y, moved); if (db) printf("- At (%d,%d), moved %d, finding new direction...\n",cell->x, cell->y, moved);
dir = getnewdigdir(cell, lastdir, (moved < 2) ? 0 : turnpct, &moved); dir = getnewdigdir(cell, lastdir, (moved < 2) ? 0 : turnpct, &moved);
@ -1928,19 +1928,19 @@ void createdungeon(map_t *map, int depth, map_t *parentmap, int exitdir, object_
while (!isempty(cell)) { while (!isempty(cell)) {
cell = getrandomcell(map); cell = getrandomcell(map);
} }
//if (db) printf("--- Couldn't find a valid direction. Jumped to (%d,%d).\n",cell->x, cell->y); if (db) printf("--- Couldn't find a valid direction. Jumped to (%d,%d).\n",cell->x, cell->y);
// pick a new random dir // pick a new random dir
dir = getnewdigdir(cell, lastdir, turnpct, &moved); dir = getnewdigdir(cell, lastdir, turnpct, &moved);
} }
if (!done) { if (!done) {
//if (db) printf("- Digging %s from (%d,%d).\n",getdirname(dir),cell->x, cell->y); if (db) printf("- Digging %s from (%d,%d).\n",getdirname(dir),cell->x, cell->y);
} }
} }
if (!done) { if (!done) {
// move to adjacent cell in the given direction // move to adjacent cell in the given direction
cell = getcellindir(cell, dir); cell = getcellindir(cell, dir);
//if (db) printf("- Now at (%d,%d)\n",cell->x, cell->y); if (db) printf("- Now at (%d,%d)\n",cell->x, cell->y);
moved++; moved++;
// blank it // blank it
@ -1951,7 +1951,7 @@ void createdungeon(map_t *map, int depth, map_t *parentmap, int exitdir, object_
cell_t *thiscell; cell_t *thiscell;
thiscell = getcellindir(cell, d); thiscell = getcellindir(cell, d);
if (thiscell) { if (thiscell) {
//if (db) printf("* Marking surrounding cell in dir %d (%d,%d) as visited.\n",d, thiscell->x, thiscell->y); if (db) printf("* Marking surrounding cell in dir %d (%d,%d) as visited.\n",d, thiscell->x, thiscell->y);
thiscell->visited = B_TRUE; thiscell->visited = B_TRUE;
} }
} }
@ -1975,7 +1975,7 @@ void createdungeon(map_t *map, int depth, map_t *parentmap, int exitdir, object_
} }
} }
//printf("%d unused cell(s)\n",unused); if (db) dblog("%d unused cell(s)\n",unused);
//dumpmap(map); //dumpmap(map);
//getchar(); //getchar();
@ -4061,7 +4061,7 @@ void dumpmap(map_t *map, int showrooms) {
int x,y; int x,y;
cell_t *cell; cell_t *cell;
char ch; char ch;
printf("dump of map '%s' (%d x %d):\n",map->name, map->w, map->h); dblog("dump of map '%s' (%d x %d):\n",map->name, map->w, map->h);
// top reference row // top reference row
dblog_nocr(" "); dblog_nocr(" ");
@ -4542,7 +4542,7 @@ int getnewdigdir(cell_t *cell, int lastdir, int turnpct, int *moved) {
int i; int i;
int turned = B_FALSE; int turned = B_FALSE;
cell_t *newcell; cell_t *newcell;
int db = B_FALSE; int db = B_TRUE;
char err[BUFLEN]; char err[BUFLEN];
// haven't tried any dirs yet // haven't tried any dirs yet
@ -4571,10 +4571,10 @@ int getnewdigdir(cell_t *cell, int lastdir, int turnpct, int *moved) {
} }
// now validate the direction // now validate the direction
if (db) printf("--- Trying %s...\n",getdirname(dir)); if (db) dblog("--- Trying %s...\n",getdirname(dir));
if (tried[dir] == B_TRUE) { // already found this dir to be invalid if (tried[dir] == B_TRUE) { // already found this dir to be invalid
lastdir = D_UNKNOWN; lastdir = D_UNKNOWN;
if (db) printf("--- Already know %s is invalid.\n",getdirname(dir)); if (db) dblog("--- Already know %s is invalid.\n",getdirname(dir));
} else { } else {
// check 1 cell ahead // check 1 cell ahead
newcell = getcellindir(cell, dir); newcell = getcellindir(cell, dir);
@ -4605,26 +4605,26 @@ int getnewdigdir(cell_t *cell, int lastdir, int turnpct, int *moved) {
} }
if (!isnewcellok(newcell, err)) { if (!isnewcellok(newcell, err)) {
if (db) printf("--- %s %s!\n",getdirname(dir), err); if (db) dblog("--- %s %s!\n",getdirname(dir), err);
tried[dir] = B_TRUE; tried[dir] = B_TRUE;
lastdir = D_UNKNOWN; lastdir = D_UNKNOWN;
numtries++; numtries++;
} else if (!isnewcellok(newcell1, err)) { } else if (!isnewcellok(newcell1, err)) {
if (db) printf("--- %s %s!\n",getdirname(dir), err); if (db) dblog("--- %s %s!\n",getdirname(dir), err);
tried[dir] = B_TRUE; tried[dir] = B_TRUE;
lastdir = D_UNKNOWN; lastdir = D_UNKNOWN;
numtries++; numtries++;
} else if (!isnewcellok(newcell2, err)) { } else if (!isnewcellok(newcell2, err)) {
if (db) printf("--- %s %s!\n",getdirname(dir), err); if (db) dblog("--- %s %s!\n",getdirname(dir), err);
tried[dir] = B_TRUE; tried[dir] = B_TRUE;
lastdir = D_UNKNOWN; lastdir = D_UNKNOWN;
numtries++; numtries++;
} else { // ok } else { // ok
if (db) printf("--- %s %s!\n",getdirname(dir), err); if (db) dblog("--- %s %s!\n",getdirname(dir), err);
foundvaliddir = B_TRUE; foundvaliddir = B_TRUE;
} }
} else { } else {
if (db) printf("--- %s %s!\n",getdirname(dir), err); if (db) dblog("--- %s %s!\n",getdirname(dir), err);
tried[dir] = B_TRUE; tried[dir] = B_TRUE;
lastdir = D_UNKNOWN; lastdir = D_UNKNOWN;
numtries++; numtries++;
@ -6078,10 +6078,11 @@ int unlinkstairsto(map_t *unlinkmap) {
void updateknowncells(void) { void updateknowncells(void) {
int x,y; //int x,y;
map_t *map; //map_t *map;
//object_t *wep; //object_t *wep;
//int seenundead = B_FALSE; //int seenundead = B_FALSE;
int i;
// you don't remember cells when you're flying, unless you // you don't remember cells when you're flying, unless you
// have a magic map or photographic memory. // have a magic map or photographic memory.
@ -6089,6 +6090,7 @@ void updateknowncells(void) {
return; return;
} }
/*
map = player->cell->map; map = player->cell->map;
//wep = getweapon(player); //wep = getweapon(player);
@ -6100,14 +6102,13 @@ void updateknowncells(void) {
//if ((player->cell == cell) || haslos(player, cell)) { //if ((player->cell == cell) || haslos(player, cell)) {
if (haslos(player, cell)) { if (haslos(player, cell)) {
setcellknown(cell, B_FALSE); setcellknown(cell, B_FALSE);
/*
if (cell->lf && lfhasflag(cell->lf, F_UNDEAD)) {
seenundead = B_TRUE;
} }
*/
} }
} }
} }
*/
for (i = 0; i < player->nlos; i++) {
setcellknown(player->los[i], B_FALSE);
} }
} }

4
move.c
View File

@ -1298,9 +1298,9 @@ int movelf(lifeform_t *lf, cell_t *newcell) {
char obname[BUFLEN]; char obname[BUFLEN];
getobname(o,obname,o->amt); getobname(o,obname,o->amt);
if (isplayer(lf)) { if (isplayer(lf)) {
msg("%s grab%s you!",obname,(o->amt == 1) ? "s" : ""); msg("%s grab%s you!",obname,OBS1(o));
} else if (cansee(player, lf)) { } else if (cansee(player, lf)) {
msg("%s grab%s %s!",obname, (o->amt == 1) ? "s" : "", lfname); msg("%s grab%s %s!",obname, OBS1(o), lfname);
} }
} }
} // end foreach object in cell } // end foreach object in cell

18
nexus.c
View File

@ -875,6 +875,16 @@ void donextturn(map_t *map) {
drawcursor(); drawcursor();
// find out what player wants to do // find out what player wants to do
handleinput(); handleinput();
if (who->bartimer) {
who->bartimer--;
if (who->bartimer == 0) {
who->damlastturn = 0;
who->mplastturn = 0;
who->stamlastturn = 0;
statdirty = B_TRUE;
drawstatus();
}
}
} else { } else {
//char lfname[BUFLEN]; //char lfname[BUFLEN];
//char buf[BUFLEN]; //char buf[BUFLEN];
@ -1046,6 +1056,11 @@ int init(void) {
initjobs(); initjobs();
initrace(); initrace();
// open log file (want to do this before digging the first map)
logfile = fopen("log.txt","wt");
fprintf(logfile, "\n\n\n====== NEW LOGFILE ====\n");
// create the dungeon layout
initmap(); initmap();
gamemode = GM_VALIDATION; gamemode = GM_VALIDATION;
@ -1056,9 +1071,6 @@ int init(void) {
return B_TRUE; return B_TRUE;
} }
// open log file
logfile = fopen("log.txt","wt");
fprintf(logfile, "\n\n\n====== NEW LOGFILE ====\n");
// load in vaults // load in vaults
loadvaults(); loadvaults();

123
objects.c
View File

@ -2474,6 +2474,11 @@ int changemat(object_t *o, enum MATERIAL mat) {
// inherit flags from new material // inherit flags from new material
copyflags(o->flags, m->flags, FROMMAT); copyflags(o->flags, m->flags, FROMMAT);
// other stuff...
if (mat != MT_FLESH) {
killflagsofid(o->flags, F_ISMEAT);
}
if (mat == MT_ICE) { if (mat == MT_ICE) {
obmod_t *om; obmod_t *om;
// if it turned to ice.. // if it turned to ice..
@ -2744,10 +2749,10 @@ int doobdieconvert(object_t *o, int wantannounce) {
} else if (oblastdamtype(o) == DT_DECAY) { } else if (oblastdamtype(o) == DT_DECAY) {
// don't announce devay death while traning // don't announce devay death while traning
if (!lfhasflag(player, F_TRAINING)) { if (!lfhasflag(player, F_TRAINING)) {
snprintf(desc, BUFLEN, "%s completed rotted away", (o->amt == 1) ? "has" : "have"); snprintf(desc, BUFLEN, "%s completed rotted away", OB1(o,"has","have"));
} }
} else { } else {
snprintf(desc, BUFLEN, "%s destroyed", (o->amt == 1) ? "is" : "are"); snprintf(desc, BUFLEN, "%s destroyed", OB1(o,"is","are"));
} }
if (strstr(o->type->name, "stain") || (o->type->id == OT_ROASTMEAT)) { if (strstr(o->type->name, "stain") || (o->type->id == OT_ROASTMEAT)) {
assert(0 == 1); assert(0 == 1);
@ -2865,14 +2870,14 @@ void explodeob(object_t *o, flag_t *f, int bigness) {
// announce // announce
if (o->pile->owner) { if (o->pile->owner) {
if (isplayer(o->pile->owner)) { if (isplayer(o->pile->owner)) {
msg("Your %s explode%s!", noprefix(obname), (o->amt == 1) ? "s" : ""); msg("Your %s explode%s!", noprefix(obname),OBS1(o));
} else if (cansee(player, o->pile->owner)) { } else if (cansee(player, o->pile->owner)) {
char lfname[BUFLEN]; char lfname[BUFLEN];
getlfname(o->pile->owner, lfname); getlfname(o->pile->owner, lfname);
msg("%s%s %s explode%s!", lfname, getpossessive(lfname), noprefix(obname), (o->amt == 1) ? "s" : ""); msg("%s%s %s explode%s!", lfname, getpossessive(lfname), noprefix(obname),OBS1(o));
} }
} else if (haslos(player, c)) { } else if (haslos(player, c)) {
msg("%s explode%s!", obname, (o->amt == 1) ? "s" : ""); msg("%s explode%s!", obname,OBS1(o));
} }
explodecells(c, dam * o->amt, bigness ? B_TRUE : B_FALSE, o, bigness ? 1 : 0, DT_COMPASS, B_FALSE); explodecells(c, dam * o->amt, bigness ? B_TRUE : B_FALSE, o, bigness ? 1 : 0, DT_COMPASS, B_FALSE);
@ -2889,17 +2894,17 @@ void extinguish(object_t *o) {
if (o->pile->owner) { if (o->pile->owner) {
if (isplayer(o->pile->owner)) { if (isplayer(o->pile->owner)) {
msg("Your %s %s extinguished.", noprefix(obname), msg("Your %s %s extinguished.", noprefix(obname),
(o->amt == 1) ? "is" : "are"); OB1(o,"is","are"));
} else if (cansee(player, o->pile->owner)) { } else if (cansee(player, o->pile->owner)) {
char lfname[BUFLEN]; char lfname[BUFLEN];
getlfname(o->pile->owner, lfname); getlfname(o->pile->owner, lfname);
msg("%s%s %s %s extinguished.", lfname, getpossessive(lfname), noprefix(obname), msg("%s%s %s %s extinguished.", lfname, getpossessive(lfname), noprefix(obname),
(o->amt == 1) ? "is" : "are"); OB1(o,"is","are"));
} }
} else if (o->pile->where && haslos(player, o->pile->where)) { } else if (o->pile->where && haslos(player, o->pile->where)) {
getobname(o, obname, o->amt); getobname(o, obname, o->amt);
msg("%s %s extinguished.", obname, msg("%s %s extinguished.", obname,
(o->amt == 1) ? "is" : "are"); OB1(o,"is","are"));
} }
killflag(f); killflag(f);
} }
@ -4806,7 +4811,7 @@ char *real_getobname(object_t *o, char *buf, int count, int wantpremods, int wan
case OT_RING_STR: case OT_RING_STR:
f = hasflag(o->flags, F_EQUIPCONFER); f = hasflag(o->flags, F_EQUIPCONFER);
if (f) { if (f) {
snprintf(buf2, BUFLENSMALL, "+%d ",f->val[2]); snprintf(buf2, BUFLENSMALL, "%s%d ",(f->val[2] < 0) ? "-" : "+", abs(f->val[2]));
strcat(localbuf, buf2); strcat(localbuf, buf2);
} }
break; break;
@ -5167,10 +5172,11 @@ objecttype_t *getoppositestairs(objecttype_t *ot) {
return findot(f->val[0]); return findot(f->val[0]);
} }
//char *real_getrandomob(map_t *map, char *buf, int cond, int cval, int forcedepth, int forcehabitat, enum LFSIZE maxsize) {
// varargs are: // varargs are:
// OC_CLASS1, OC_CLAS2, OC_NONE, ..., DT_DAMTYPE1, DT_DAMTYPE2, .., DT_NONE // OC_CLASS1, OC_CLAS2, OC_NONE, ..., DT_DAMTYPE1, DT_DAMTYPE2, .., DT_NONE
char *real_getrandomob(map_t *map, char *buf, int forcedepth, int forcehabitat, enum LFSIZE maxsize, int forpickup, ... ) { //
// no objectclass given then it will be picked randomly, or (if wepsk isn't sk_none) set to oc_weapon.
char *real_getrandomob(map_t *map, char *buf, int forcedepth, int forcehabitat, enum LFSIZE maxsize, enum SKILL wepsk, int forpickup, ... ) {
va_list args; va_list args;
objecttype_t *ot; objecttype_t *ot;
objecttype_t *poss[MAXRANDOMOBCANDIDATES]; objecttype_t *poss[MAXRANDOMOBCANDIDATES];
@ -5199,6 +5205,7 @@ char *real_getrandomob(map_t *map, char *buf, int forcedepth, int forcehabitat,
habitat_t *hab; habitat_t *hab;
char habname[BUFLEN]; char habname[BUFLEN];
int rrmoddir = -1; int rrmoddir = -1;
skill_t *wantsk = NULL;
if (!db) db = obdb; if (!db) db = obdb;
@ -5216,6 +5223,10 @@ char *real_getrandomob(map_t *map, char *buf, int forcedepth, int forcehabitat,
} }
va_end(args); va_end(args);
if (wepsk) {
wantsk = findskill(wepsk);
}
if (forcehabitat != NA) { if (forcehabitat != NA) {
hab = findhabitat(forcehabitat); hab = findhabitat(forcehabitat);
} else if (map) { } else if (map) {
@ -5245,7 +5256,11 @@ char *real_getrandomob(map_t *map, char *buf, int forcedepth, int forcehabitat,
// no obclass given? pick one randomly. // no obclass given? pick one randomly.
if (!nwantclass) { if (!nwantclass) {
if (wantsk) {
wantclass[0] = OC_WEAPON;
} else {
wantclass[0] = getrandomobclass(hab->id); wantclass[0] = getrandomobclass(hab->id);
}
nwantclass = 1; nwantclass = 1;
} }
@ -5254,6 +5269,10 @@ char *real_getrandomob(map_t *map, char *buf, int forcedepth, int forcehabitat,
raritymin,raritymax,wantrr, habname); raritymin,raritymax,wantrr, habname);
if (db || partdb) { if (db || partdb) {
char dbuf[BUFLEN]; char dbuf[BUFLEN];
if (wantsk) {
sprintf(dbuf, " must have wepskill: %s", wantsk->name);
dblog("%s", dbuf);
}
if (nwantclass) { if (nwantclass) {
objectclass_t *oc = NULL; objectclass_t *oc = NULL;
sprintf(dbuf, " must have obclass: "); sprintf(dbuf, " must have obclass: ");
@ -5353,6 +5372,17 @@ char *real_getrandomob(map_t *map, char *buf, int forcedepth, int forcehabitat,
} }
} }
// matches wanted weapon skill?
if (wantsk) {
if (ot->id == OT_QUICKBLADE) {
dblog("xxx");
}
if (!hasflagval(ot->flags, F_USESSKILL, wantsk->id, NA, NA, NULL)) {
condok = B_FALSE;
if (db) dblog(" %s doesn't use correct weapon skill.", ot->name);
}
}
if (forpickup) { if (forpickup) {
if (hasflag(ot->flags, F_NOPICKUP)) { if (hasflag(ot->flags, F_NOPICKUP)) {
condok = B_FALSE; condok = B_FALSE;
@ -5518,21 +5548,21 @@ char *real_getrandomob(map_t *map, char *buf, int forcedepth, int forcehabitat,
} }
char *getrandomob(map_t *map, char *buf) { char *getrandomob(map_t *map, char *buf) {
return real_getrandomob(map, buf, NA, NA, SZ_MAX, B_FALSE, OC_NONE, DT_NONE); return real_getrandomob(map, buf, NA, NA, SZ_MAX, SK_NONE, B_FALSE, OC_NONE, DT_NONE);
} }
char *getrandomobofsize(map_t *map, char *buf, enum LFSIZE maxsize) { char *getrandomobofsize(map_t *map, char *buf, enum LFSIZE maxsize) {
return real_getrandomob(map, buf, NA, NA, maxsize, B_FALSE, OC_NONE, DT_NONE); return real_getrandomob(map, buf, NA, NA, maxsize, SK_NONE, B_FALSE, OC_NONE, DT_NONE);
} }
char *getrandomobwithdt(map_t *map, enum DAMTYPE damtype, char *buf) { char *getrandomobwithdt(map_t *map, enum DAMTYPE damtype, char *buf) {
return real_getrandomob(map, buf, NA, NA, SZ_MAX, B_TRUE, OC_NONE, damtype, DT_NONE); return real_getrandomob(map, buf, NA, NA, SZ_MAX, SK_NONE, B_TRUE, OC_NONE, damtype, DT_NONE);
} }
char *getrandomobwithclass(map_t *map, enum OBCLASS cid, char *buf, int depthmod) { char *getrandomobwithclass(map_t *map, enum OBCLASS cid, char *buf, int depthmod) {
//return real_getrandomob(map, buf, RO_OBCLASS, cid, map->depth + depthmod); //return real_getrandomob(map, buf, RO_OBCLASS, cid, map->depth + depthmod);
if (depthmod == NA) depthmod = 0; if (depthmod == NA) depthmod = 0;
return real_getrandomob(map, buf, getmapdifficulty(map) + depthmod, NA, SZ_MAX, B_FALSE, cid, OC_NONE, DT_NONE); return real_getrandomob(map, buf, getmapdifficulty(map) + depthmod, NA, SZ_MAX, SK_NONE, B_FALSE, cid, OC_NONE, DT_NONE);
} }
enum OBCLASS getrandomobclass(enum HABITAT hab) { enum OBCLASS getrandomobclass(enum HABITAT hab) {
@ -7017,7 +7047,7 @@ void makewet(object_t *o, int amt) {
} else { } else {
// rust // rust
if (haslos(player, loc) && !isdead(player)) { if (haslos(player, loc) && !isdead(player)) {
msg("%s rust%s.",obnamefull, (o->amt == 1) ? "s" : ""); msg("%s rust%s.",obnamefull,OBS1(o));
} }
f = addflag(o->flags, F_RUSTED, amt, NA, NA, NULL); f = addflag(o->flags, F_RUSTED, amt, NA, NA, NULL);
} }
@ -7031,7 +7061,7 @@ void makewet(object_t *o, int amt) {
// make wetter // make wetter
/* /*
if (haslos(player, loc)) { if (haslos(player, loc)) {
msg("%s get%s wetter.",obnamefull, (o->amt == 1) ? "s" : ""); msg("%s get%s wetter.",obnamefull,OBS1(o));
} }
*/ */
f->val[0] += amt; f->val[0] += amt;
@ -7052,7 +7082,7 @@ void makewet(object_t *o, int amt) {
} }
if (doannounce) { if (doannounce) {
msg("%s get%s wet.",obnamefull, (o->amt == 1) ? "s" : ""); msg("%s get%s wet.",obnamefull,OBS1(o));
} }
} }
f = addflag(o->flags, F_WET, amt, TM_WETTIME, NA, NULL); f = addflag(o->flags, F_WET, amt, TM_WETTIME, NA, NULL);
@ -7093,7 +7123,7 @@ object_t *real_moveob(object_t *src, obpile_t *dst, int howmany, int stackok) {
getobname(src, obname, src->amt); getobname(src, obname, src->amt);
getobname(pit, pitname, 1); getobname(pit, pitname, 1);
msg("%s fall%s down %s.", obname, (src->amt == 1) ? "s" : "", pitname); msg("%s fall%s down %s.", obname, OBS1(src), pitname);
} }
dst = newcell->obpile; dst = newcell->obpile;
} }
@ -7348,10 +7378,10 @@ void obdie(object_t *o) {
snprintf(desc, BUFLEN, "%s", f->text); snprintf(desc, BUFLEN, "%s", f->text);
} else if (oblastdamtype(o) == DT_DECAY) { } else if (oblastdamtype(o) == DT_DECAY) {
if (!lfhasflag(player, F_TRAINING)) { if (!lfhasflag(player, F_TRAINING)) {
snprintf(desc, BUFLEN, "%s completely rotted away", (o->amt == 1) ? "has" : "have" ); snprintf(desc, BUFLEN, "%s completely rotted away", OB1(o,"has","have") );
} }
} else { } else {
snprintf(desc, BUFLEN, "%s destroyed", (o->amt == 1) ? "is" : "are"); snprintf(desc, BUFLEN, "%s destroyed", OB1(o,"is","are"));
} }
if (strlen(desc)) { if (strlen(desc)) {
@ -7645,8 +7675,7 @@ int obsfallthrough(cell_t *c, object_t *pit) {
if (haslos(player, c)) { if (haslos(player, c)) {
// player can see the top of the hole // player can see the top of the hole
getobname(oo,obname, oo->amt); getobname(oo,obname, oo->amt);
msg("%s %s%s through %s.", obname, verb, msg("%s %s%s through %s.", obname, verb, OBS1(oo),
(oo->amt == 1) ? "s" : "",
downholename); downholename);
} }
@ -7663,9 +7692,7 @@ int obsfallthrough(cell_t *c, object_t *pit) {
if (haslos(player, belowcell)) { if (haslos(player, belowcell)) {
// player can see the bottom of the hole // player can see the bottom of the hole
getobname(oo,obname, oo->amt); getobname(oo,obname, oo->amt);
msg("%s %s%s through %s.", obname, verb, msg("%s %s%s through %s.", obname, verb, OBS1(oo), upholename);
(oo->amt == 1) ? "s" : "",
upholename);
} }
// does the object hit anyone? // does the object hit anyone?
@ -7678,9 +7705,7 @@ int obsfallthrough(cell_t *c, object_t *pit) {
char lfname[BUFLEN]; char lfname[BUFLEN];
getobname(oo,obname, oo->amt); getobname(oo,obname, oo->amt);
getlfname(lf, lfname); getlfname(lf, lfname);
msg("%s hit%s %s!", obname, msg("%s hit%s %s!", obname, OBS1(oo), lfname);
(oo->amt == 1) ? "s" : "",
lfname);
} }
snprintf(dambuf, BUFLEN, "a falling %s", oo->type->name); snprintf(dambuf, BUFLEN, "a falling %s", oo->type->name);
losehp(lf, getthrowdam(oo) * 6, DT_PROJECTILE, NULL, dambuf); losehp(lf, getthrowdam(oo) * 6, DT_PROJECTILE, NULL, dambuf);
@ -8244,7 +8269,8 @@ int operate(lifeform_t *lf, object_t *o, cell_t *where) {
removeob(oo, 1); removeob(oo, 1);
break; break;
case OT_FOUNTAIN: case OT_FOUNTAIN:
if (onein(ONEIN_FOUNTAINDRYUP)) { if (hasflagval(oo->flags, F_LINKOB, OT_POT_EXPERIENCE, NA, NA, NULL) ||
onein(ONEIN_FOUNTAINDRYUP)) {
cell_t *loc; cell_t *loc;
loc = getoblocation(oo); loc = getoblocation(oo);
if (haslos(player, loc)) { if (haslos(player, loc)) {
@ -9357,6 +9383,13 @@ void potioneffects(lifeform_t *lf, enum OBTYPE oid, object_t *o, enum BLESSTYPE
} }
if (seen) *seen = B_TRUE; if (seen) *seen = B_TRUE;
break; break;
case OT_POT_SPIDERCLIMB:
i = geteffecttime(20,50,potblessed);
addtempflag(lf->flags, F_SPIDERCLIMB, B_TRUE, NA, NA, NULL, i);
if (!lfhasflagval(lf, F_CANWILL, OT_A_CLIMB, NA, NA, NULL)) {
addtempflag(lf->flags, F_CANWILL, OT_A_CLIMB, NA, NA, NULL, i);
}
break;
case OT_POT_WATER: case OT_POT_WATER:
switch (potblessed) { switch (potblessed) {
case B_BLESSED: case B_BLESSED:
@ -9541,10 +9574,8 @@ int readsomething(lifeform_t *lf, object_t *o) {
if (o->type->obclass->id == OC_BOOK) { if (o->type->obclass->id == OC_BOOK) {
// is this a spellbook? // is this a spellbook?
if (o->type->id == OT_SPELLBOOK) { if (o->type->id == OT_SPELLBOOK) {
// if so, always id it. // if so, only id it if we can understand it.
// note though that we can only actually LEARN willid = B_FALSE;
// the spell if we are skilled in that school.
willid = B_TRUE;
} else { } else {
// ie. a manual // ie. a manual
willid = B_TRUE; willid = B_TRUE;
@ -9928,6 +9959,17 @@ int readsomething(lifeform_t *lf, object_t *o) {
return B_FALSE; return B_FALSE;
} }
// player now knows what it is - id it!
if (isplayer(lf) && !isknown(o)) {
identify(o);
o->blessknown = B_TRUE;
real_getobname(o, obname, 1, B_FALSE, B_TRUE, B_FALSE, B_TRUE, B_FALSE); // don't adjust for blindness
// tell the player
msg("This is %s!",obname);
more();
drawmsg();
}
// we are skilled in the right school. now ask which spell to learn. // we are skilled in the right school. now ask which spell to learn.
initprompt(&prompt, "Which spell will you try to learn?"); initprompt(&prompt, "Which spell will you try to learn?");
for (oo = o->contents->first ;oo ; oo = oo->next) { for (oo = o->contents->first ;oo ; oo = oo->next) {
@ -10271,8 +10313,7 @@ int shatter(object_t *o, int hitlf, char *damstring, lifeform_t *fromlf) {
strcpy(prefix, ""); strcpy(prefix, "");
} }
msg("%s%s shatter%s!",prefix, strlen(prefix) ? noprefix(obname) : obname, msg("%s%s shatter%s!",prefix, strlen(prefix) ? noprefix(obname) : obname, OBS1(o));
(o->amt == 1) ? "s" : "");
seen = B_TRUE; seen = B_TRUE;
} else { } else {
@ -10592,7 +10633,7 @@ int real_takedamage(object_t *o, int howmuch, int damtype, int wantannounce) {
if (haslos(player, c)) { if (haslos(player, c)) {
char buf[BUFLEN]; char buf[BUFLEN];
getobname(o, buf, o->amt); getobname(o, buf, o->amt);
msg("%s %s lit.", buf, (o->amt == 1) ? "is" : "are"); msg("%s %s lit.", buf, OB1(o,"is","are"));
} }
turnon(NULL, o); turnon(NULL, o);
@ -10627,7 +10668,7 @@ int real_takedamage(object_t *o, int howmuch, int damtype, int wantannounce) {
// announce // announce
getobname(o, obname, o->amt); getobname(o, obname, o->amt);
if (isplayer(owner)) { if (isplayer(owner)) {
msg("Your %s burn%s you!", noprefix(obname), (o->amt == 1) ? "s" : ""); msg("Your %s burn%s you!", noprefix(obname),OBS1(o));
} else if (cansee(player, owner)) { } else if (cansee(player, owner)) {
char lfname[BUFLEN]; char lfname[BUFLEN];
getlfname(owner, lfname); getlfname(owner, lfname);
@ -11706,10 +11747,10 @@ void timeeffectsob(object_t *o) {
// object can't go anywhere - it disintegrates. // object can't go anywhere - it disintegrates.
if (owner && cansee(player, owner)) { if (owner && cansee(player, owner)) {
msg("%s%s vanish%s in a surge of %s power!", ownername, getpossessive(ownername), msg("%s%s vanish%s in a surge of %s power!", ownername, getpossessive(ownername),
obname, (o->amt == 1) ? "es" : "", obname, OB1(o,"es",""),
(o->blessed = B_CURSED) ? "holy" : "evil"); (o->blessed = B_CURSED) ? "holy" : "evil");
} else if (haslos(player, location)) { } else if (haslos(player, location)) {
msg("%s vanish%s in a surge of %s power!", obname, (o->amt == 1) ? "es" : "", msg("%s vanish%s in a surge of %s power!", obname, OB1(o,"es",""),
(o->blessed = B_CURSED) ? "holy" : "evil"); (o->blessed = B_CURSED) ? "holy" : "evil");
} }
removeob(o, o->amt); removeob(o, o->amt);
@ -11778,7 +11819,7 @@ void timeeffectsob(object_t *o) {
if (willvanish) { if (willvanish) {
// vanish. // vanish.
if (haslos(player, location)) { if (haslos(player, location)) {
msg("%s vanish%s.", obname, (o->amt == 1) ? "es" : ""); msg("%s vanish%s.", obname, OB1(o,"es",""));
} }
killob(o); killob(o);
return; return;

View File

@ -127,7 +127,7 @@ char *getobhurtname(object_t *o, enum DAMTYPE damtype);
float getobweight(object_t *o); float getobweight(object_t *o);
float getobunitweight(object_t *o); float getobunitweight(object_t *o);
objecttype_t *getoppositestairs(objecttype_t *ot); objecttype_t *getoppositestairs(objecttype_t *ot);
char *real_getrandomob(map_t *map, char *buf, int forcedepth, int forcehabitat, enum LFSIZE maxsize, int forpickup, ... ); char *real_getrandomob(map_t *map, char *buf, int forcedepth, int forcehabitat, enum LFSIZE maxsize, enum SKILL wepsk, int forpickup, ... );
char *getrandomob(map_t *map, char *buf); char *getrandomob(map_t *map, char *buf);
char *getrandomobofsize(map_t *map, char *buf, enum LFSIZE maxsize); char *getrandomobofsize(map_t *map, char *buf, enum LFSIZE maxsize);
char *getrandomobwithdt(map_t *map, enum DAMTYPE damtype, char *buf); char *getrandomobwithdt(map_t *map, enum DAMTYPE damtype, char *buf);

42
shops.c
View File

@ -318,7 +318,7 @@ enum SHOPRETURN shopdonate(lifeform_t *lf, object_t *vm, int starty, char *topte
case OT_TEMPLE: wantflag = F_NONE; wantoc = OC_MONEY; break; case OT_TEMPLE: wantflag = F_NONE; wantoc = OC_MONEY; break;
default: wantflag = F_NONE; wantoc = OC_NONE; break; default: wantflag = F_NONE; wantoc = OC_NONE; break;
} }
o = doaskobject(lf->pack, "What will you donate?", &count, B_FALSE, B_FALSE, AO_NONE, wantflag, F_NONE); o = doaskobject(lf->pack, "What will you donate?", &count, B_TRUE, B_FALSE, B_FALSE, '\0', AO_NONE, wantflag, F_NONE);
// validate it // validate it
if (o) { if (o) {
@ -329,9 +329,28 @@ enum SHOPRETURN shopdonate(lifeform_t *lf, object_t *vm, int starty, char *topte
return SR_CONTINUE; return SR_CONTINUE;
} }
} }
// confirm count for gold
if (o->type->obclass->id == OC_MONEY) {
char answer[BUFLEN],buf[BUFLEN];
sprintf(buf, "How much money will you donate (you have $%d)?", o->amt);
askstring(buf, '?', answer, BUFLEN, NULL);
count = atoi(answer);
if (count <= 0) {
return SR_CONTINUE;
}
if (count > o->amt) count = o->amt;
}
// okay it! // okay it!
if ((wantoc != OC_NONE) && (o->type->obclass->id != wantoc)) { if ((wantoc != OC_NONE) && (o->type->obclass->id != wantoc)) {
msg("Sorry, we can't accept that!"); more(); msg("Sorry, we can't accept that!"); more();
} else {
int goldgiven = 0;
if (o->type->id == OT_GOLD) {
givemoney(lf, NULL, count);
(*ndonated)++;
goldgiven += count;
} else { } else {
object_t *newob; object_t *newob;
char let; char let;
@ -343,8 +362,23 @@ enum SHOPRETURN shopdonate(lifeform_t *lf, object_t *vm, int starty, char *topte
newob = moveob(o, vm->contents, count); newob = moveob(o, vm->contents, count);
newob->letter = let; newob->letter = let;
(*ndonated)++; (*ndonated)++;
}
if ((vm->type->id == OT_TEMPLE) && goldgiven) {
flag_t *f;
f = hasflag(o->flags, F_LINKGOD);
if (f) {
lifeform_t *god = NULL;
god = findgod(f->val[0]);
msg("%s appreciates your kind donation.", god->race->name);
modpiety(god->race->id, (goldgiven/2));
} else {
msg("We appreciate your kind donation.");
}
} else {
msg("Thanks!"); more(); msg("Thanks!"); more();
} }
}
} else { } else {
return SR_BACK; return SR_BACK;
} }
@ -524,7 +558,13 @@ enum SHOPRETURN shoppurchase(lifeform_t *lf, object_t *vm, int starty, char *top
for (o = vm->contents->first ; o ; o = o->next) { for (o = vm->contents->first ; o ; o = o->next) {
char obname[BUFLEN]; char obname[BUFLEN];
// get the name of the object // get the name of the object
if (gettechlevel(o->type->id) > getskill(player, SK_TECHUSAGE)) {
// unidentifie tech - hide the name
real_getobname(o, obname, o->amt, B_TRUE, B_TRUE, B_TRUE, B_TRUE, B_FALSE);
} else {
// anything else - show the real name
real_getobname(o, obname, o->amt, B_TRUE, B_TRUE, B_TRUE, B_TRUE, B_TRUE); real_getobname(o, obname, o->amt, B_TRUE, B_TRUE, B_TRUE, B_TRUE, B_TRUE);
}
snprintf(buf, BUFLEN, "%c - %s", o->letter, obname); snprintf(buf, BUFLEN, "%c - %s", o->letter, obname);
snprintf(buf2, BUFLEN, "%-60s$%d",buf,(int)getshopprice(o, player)); snprintf(buf2, BUFLEN, "%-60s$%d",buf,(int)getshopprice(o, player));
mvwprintw(mainwin, y, 0, "%s", buf2); mvwprintw(mainwin, y, 0, "%s", buf2);

89
spell.c
View File

@ -609,7 +609,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef
char yn; char yn;
char ques[BUFLEN]; char ques[BUFLEN];
getobname(o, obname, o->amt); getobname(o, obname, o->amt);
sprintf(ques, "There %s %s here. Cook it?", (o->amt == 1) ? "is" : "are",obname); sprintf(ques, "There %s %s here. Cook it?", OB1(o,"is","are"),obname);
yn = askchar(ques, "yn","n", B_TRUE, B_FALSE); yn = askchar(ques, "yn","n", B_TRUE, B_FALSE);
if (yn == 'y') { if (yn == 'y') {
corpse = o; corpse = o;
@ -1075,7 +1075,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef
} }
return B_TRUE; return B_TRUE;
} else if (!isdualweilding(user)) { } else if (!isdualweilding(user)) {
if (isplayer(user)) msg("You need two be dual-weilding to perform an attack flurry!"); if (isplayer(user)) msg("You need to be dual-weilding to perform an attack flurry!");
return B_TRUE; return B_TRUE;
} }
@ -2873,6 +2873,7 @@ int abilityeffects(lifeform_t *user, enum OBTYPE abilid, cell_t *targcell, lifef
} }
} }
addchoice(&prompt, '-', "(nothing)", NULL, NULL, NULL); addchoice(&prompt, '-', "(nothing)", NULL, NULL, NULL);
prompt.maycancel = B_TRUE;
if (prompt.nchoices == 1) { if (prompt.nchoices == 1) {
msg("You don't have anything which you can inspect."); msg("You don't have anything which you can inspect.");
@ -3035,7 +3036,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
if (haslos(player, caster->cell)) { if (haslos(player, caster->cell)) {
msg("The pentagram pulses red."); msg("The pentagram pulses red.");
} }
if (summonlfs(caster, caster->cell, RC_DEMON, SZ_ANY, AL_NONE, 1, PERMENANT, B_FALSE)) { if (summonlfs(caster, caster->cell, R_NONE, RC_DEMON, SZ_ANY, AL_NONE, 1, PERMENANT, B_FALSE)) {
if (isplayer(caster) || cansee(player, caster)) { if (isplayer(caster) || cansee(player, caster)) {
msg("An other-worldly demon appears!"); msg("An other-worldly demon appears!");
} }
@ -3641,21 +3642,21 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
if (target) { if (target) {
if (isplayer(target)) { if (isplayer(target)) {
getobname(targob, obname, targob->amt); getobname(targob, obname, targob->amt);
msg("^%cYour %s vanish%s!", getlfcol(target, CC_VBAD), noprefix(obname), (targob->amt == 1) ? "es" : ""); msg("^%cYour %s vanish%s!", getlfcol(target, CC_VBAD), noprefix(obname), OB1(targob,"es",""));
if (seenbyplayer) *seenbyplayer = B_TRUE; if (seenbyplayer) *seenbyplayer = B_TRUE;
} else if (isplayer(caster)) { } else if (isplayer(caster)) {
char targname[BUFLEN]; char targname[BUFLEN];
getlfname(target, targname); getlfname(target, targname);
getobname(targob, obname, targob->amt); getobname(targob, obname, targob->amt);
msg("%s%s %s appear%s in your pack!", targname, getpossessive(targname), msg("%s%s %s appear%s in your pack!", targname, getpossessive(targname),
noprefix(obname), (targob->amt == 1) ? "es" : ""); noprefix(obname), OB1(targob,"es",""));
if (seenbyplayer) *seenbyplayer = B_TRUE; if (seenbyplayer) *seenbyplayer = B_TRUE;
} else if (cansee(player, target)) { } else if (cansee(player, target)) {
char targname[BUFLEN]; char targname[BUFLEN];
getlfname(target, targname); getlfname(target, targname);
getobname(targob, obname, targob->amt); getobname(targob, obname, targob->amt);
msg("^%c%s%s %s vanish%s!", getlfcol(target, CC_VBAD), targname, getpossessive(targname), noprefix(obname), msg("^%c%s%s %s vanish%s!", getlfcol(target, CC_VBAD), targname, getpossessive(targname), noprefix(obname),
(targob->amt == 1) ? "es" : ""); OB1(targob,"es",""));
if (seenbyplayer) *seenbyplayer = B_TRUE; if (seenbyplayer) *seenbyplayer = B_TRUE;
} }
} }
@ -4548,7 +4549,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
if (seenthiscell) { if (seenthiscell) {
if (!hasflag(o->flags, F_OBDIETEXT)) { if (!hasflag(o->flags, F_OBDIETEXT)) {
getobname(o, obname, o->amt); getobname(o, obname, o->amt);
msg("%s crumble%s to dust!", obname, (o->amt == 1) ? "s" : ""); msg("%s crumble%s to dust!", obname, OBS1(o));
} }
if (seenbyplayer) *seenbyplayer = B_TRUE; if (seenbyplayer) *seenbyplayer = B_TRUE;
} }
@ -4665,7 +4666,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
(o->type->id == OT_TRAPGAS)) { (o->type->id == OT_TRAPGAS)) {
char obname[BUFLEN]; char obname[BUFLEN];
getobname(o, obname, o->amt); getobname(o, obname, o->amt);
msg("%s %s revealed!", obname, (o->amt == 1) ? "is" : "are"); msg("%s %s revealed!", obname, OB1(o,"is","are"));
npoisoned++; npoisoned++;
killflagsofid(o->flags, F_SECRET); killflagsofid(o->flags, F_SECRET);
} else { } else {
@ -4698,7 +4699,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
if (ispoisoned || isdecayed) { if (ispoisoned || isdecayed) {
char obname[BUFLEN]; char obname[BUFLEN];
getobname(o, obname, o->amt); getobname(o, obname, o->amt);
msg("%s %s %s!", obname, (o->amt == 1) ? "is" : "are", msg("%s %s %s!", obname, OB1(o,"is","are"),
ispoisoned ? "poisoned" : "rotted"); ispoisoned ? "poisoned" : "rotted");
npoisoned++; npoisoned++;
} }
@ -4854,13 +4855,13 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
} }
if (haslos(player, targcell) && canseeob(player, o)) { if (haslos(player, targcell) && canseeob(player, o)) {
msg("%s disappear%s!", buf, (o->amt == 1) ? "s" : ""); msg("%s disappear%s!", buf, OBS1(o));
if (seenbyplayer) *seenbyplayer = B_TRUE; if (seenbyplayer) *seenbyplayer = B_TRUE;
donesomething = B_TRUE; donesomething = B_TRUE;
} }
moveob(o, c->obpile, o->amt); moveob(o, c->obpile, o->amt);
if (haslos(player, c) && canseeob(player, o)) { if (haslos(player, c) && canseeob(player, o)) {
msg("%s appear%s nearby!", buf, (o->amt == 1) ? "s" : ""); msg("%s appear%s nearby!", buf, OBS1(o));
} }
} }
if (isplayer(caster) && !donesomething) { if (isplayer(caster) && !donesomething) {
@ -5505,7 +5506,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
msg("%s %s start%s glowing bright blue!", msg("%s %s start%s glowing bright blue!",
(o->pile->owner == caster) ? "Your" : "", (o->pile->owner == caster) ? "Your" : "",
(o->pile->owner == caster) ? noprefix(obname) : obname, (o->pile->owner == caster) ? noprefix(obname) : obname,
(o->amt == 1) ? "s" : ""); OBS1(o));
more(); more();
ch = askchar("Abort your spell?", "yn","y", B_TRUE, B_FALSE); ch = askchar("Abort your spell?", "yn","y", B_TRUE, B_FALSE);
if (ch == 'y') { if (ch == 'y') {
@ -5548,7 +5549,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
msg("%s %s freeze%s some more.", msg("%s %s freeze%s some more.",
(o->pile->owner == caster) ? "Your" : "", (o->pile->owner == caster) ? "Your" : "",
(o->pile->owner == caster) ? noprefix(obname) : obname, (o->pile->owner == caster) ? noprefix(obname) : obname,
(o->amt == 1) ? "s" : ""); OBS1(o));
} }
// restore it // restore it
f = hasflag(o->flags, F_OBHP); f = hasflag(o->flags, F_OBHP);
@ -5585,7 +5586,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
} else { } else {
if (o->pile->owner) { if (o->pile->owner) {
if (isplayer(o->pile->owner)) { if (isplayer(o->pile->owner)) {
msg("Your %s turn%s to ice!",noprefix(buf), (o->amt == 1) ? "s" : ""); msg("Your %s turn%s to ice!",noprefix(buf), OBS1(o));
if (seenbyplayer) *seenbyplayer = B_TRUE; if (seenbyplayer) *seenbyplayer = B_TRUE;
} else if (haslos(player, o->pile->owner->cell)) { } else if (haslos(player, o->pile->owner->cell)) {
getlfname(o->pile->owner, buf); getlfname(o->pile->owner, buf);
@ -5787,15 +5788,21 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
// severed body parts // severed body parts
getflags(target->flags, retflag, &nretflags, F_INJURY, F_NOBODYPART, F_NONE); getflags(target->flags, retflag, &nretflags, F_INJURY, F_NOBODYPART, F_NONE);
for (i = 0; i < nretflags; i++) { for (i = 0; i < nretflags; i++) {
enum BODYPART bpgone = BP_NONE;
if ((retflag[i]->id == F_NOBODYPART) && (retflag[i]->val[1] == B_FROMINJURY)) { if ((retflag[i]->id == F_NOBODYPART) && (retflag[i]->val[1] == B_FROMINJURY)) {
bpgone = retflag[i]->val[0];
} else if ((retflag[i]->id == F_INJURY) && (retflag[i]->lifetime == PERMENANT)) { // permenant injury
bpgone = retflag[i]->val[1];
}
if (bpgone != BP_NONE) {
if (isplayer(target)) { if (isplayer(target)) {
msg("Your %s grows back!", getbodypartname(target, retflag[i]->val[0])); msg("Your %s grows back!", getbodypartname(target, bpgone));
if (seenbyplayer) *seenbyplayer = B_TRUE; if (seenbyplayer) *seenbyplayer = B_TRUE;
} else if (cansee(player, target)) { } else if (cansee(player, target)) {
char targname[BUFLEN]; char targname[BUFLEN];
getlfname(target, targname); getlfname(target, targname);
msg("%s%s %s grows back!", targname, getpossessive(targname), msg("%s%s %s grows back!", targname, getpossessive(targname),
getbodypartname(target, retflag[i]->val[0])); getbodypartname(target, bpgone));
if (seenbyplayer) *seenbyplayer = B_TRUE; if (seenbyplayer) *seenbyplayer = B_TRUE;
} }
killflag(retflag[i]); killflag(retflag[i]);
@ -5927,7 +5934,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
getobname(o, obname, o->amt); getobname(o, obname, o->amt);
getlfname(target, lfname); getlfname(target, lfname);
msg("%s%s %s glow%s red hot!", lfname, getpossessive(lfname), msg("%s%s %s glow%s red hot!", lfname, getpossessive(lfname),
noprefix(obname), (o->amt == 1) ? "s" : ""); noprefix(obname), OBS1(o));
if (seenbyplayer) *seenbyplayer = B_TRUE; if (seenbyplayer) *seenbyplayer = B_TRUE;
} }
takedamage(o, rnd(1,4), DT_HEAT); takedamage(o, rnd(1,4), DT_HEAT);
@ -5959,7 +5966,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
if (haslos(player, targcell)) { if (haslos(player, targcell)) {
char obname[BUFLEN]; char obname[BUFLEN];
getobname(o, obname, o->amt); getobname(o, obname, o->amt);
msg("%s glow%s red hot!", obname, (o->amt == 1) ? "s" : ""); msg("%s glow%s red hot!", obname, OBS1(o));
if (seenbyplayer) *seenbyplayer = B_TRUE; if (seenbyplayer) *seenbyplayer = B_TRUE;
donesomething = B_FALSE; donesomething = B_FALSE;
} }
@ -6503,7 +6510,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
if (spellresisted(target, caster, spellid, power, seenbyplayer, B_FALSE)) { if (spellresisted(target, caster, spellid, power, seenbyplayer, B_FALSE)) {
failed = B_TRUE; failed = B_TRUE;
} else if (skillcheck(target, SC_CON, 20 + power, 0)) { } else if (skillcheck(target, SC_CON, 20 + (power*2), 0)) {
failed = B_TRUE; failed = B_TRUE;
} }
@ -7802,7 +7809,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
if (haslos(player, targcell)) { if (haslos(player, targcell)) {
char obname[BUFLEN]; char obname[BUFLEN];
getobname(retob[n], obname, retob[n]->amt); getobname(retob[n], obname, retob[n]->amt);
msg("%s flare%s up!", obname, (retob[n]->amt == 1) ? "s" : ""); msg("%s flare%s up!", obname, OBS1(retob[n]));
if (seenbyplayer) *seenbyplayer = B_TRUE; if (seenbyplayer) *seenbyplayer = B_TRUE;
} }
} // end foreach flaming ob } // end foreach flaming ob
@ -9012,14 +9019,27 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
} else if ((spellid == OT_S_SUMMONANIMALSSM) || } else if ((spellid == OT_S_SUMMONANIMALSSM) ||
(spellid == OT_S_SUMMONANIMALSMD) || (spellid == OT_S_SUMMONANIMALSMD) ||
(spellid == OT_S_SUMMONANIMALSLG) || (spellid == OT_S_SUMMONANIMALSLG) ||
(spellid == OT_S_FRIENDS) ||
(spellid == OT_S_SUMMONDEMON)) { (spellid == OT_S_SUMMONDEMON)) {
int lifetime, nwant,ngot,successrate; int lifetime, nwant,ngot,successrate;
enum LFSIZE wantsize; enum LFSIZE wantsize;
enum RACECLASS wantrc; enum RACECLASS wantrc;
enum RACE wantrace = R_NONE;
int friendly; int friendly;
lifetime = (power * 9) + rnd(1,power*2); lifetime = (power * 9) + rnd(1,power*2);
switch (spellid) { switch (spellid) {
case OT_S_FRIENDS:
switch (rnd(1,2)) {
case 1: wantrace = R_CHICKEN; break;
case 2: wantrace = R_BUTTERFLY; break;
}
wantrc = RC_ANY;
wantsize = SZ_ANY;
nwant = 8;
successrate = 100;
friendly = B_FALSE;
break;
case OT_S_SUMMONDEMON: case OT_S_SUMMONDEMON:
wantrc = RC_DEMON; wantrc = RC_DEMON;
wantsize = SZ_ANY; wantsize = SZ_ANY;
@ -9065,15 +9085,24 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
return B_TRUE; return B_TRUE;
} }
ngot = summonlfs(caster, caster->cell, wantrc, wantsize, AL_NONE, nwant, lifetime, friendly); ngot = summonlfs(caster, caster->cell, wantrace, wantrc, wantsize, AL_NONE, nwant, lifetime, friendly);
if (!ngot) { if (!ngot) {
fizzle(caster); fizzle(caster);
return B_TRUE; return B_TRUE;
} else { } else {
if (haslos(player, caster->cell)) { // intentionally not using cansee if (haslos(player, caster->cell)) { // intentionally not using cansee
if (seenbyplayer) *seenbyplayer = B_TRUE;
if (wantrace) {
race_t *r;
r = findrace(wantrace);
if (ngot == 1) {
msg("%s %s appears near %s!", needan(r->name) ? "An" : "A", r->name, castername);
} else {
msg("%s appear around %s!", makeplural(r->name), castername);
}
} else {
raceclass_t *rc; raceclass_t *rc;
rc = findraceclass(wantrc); rc = findraceclass(wantrc);
if (seenbyplayer) *seenbyplayer = B_TRUE;
if (ngot == 1) { if (ngot == 1) {
msg("%s %s appears near %s!", needan(rc->name) ? "An" : "A", rc->name, castername); msg("%s %s appears near %s!", needan(rc->name) ? "An" : "A", rc->name, castername);
} else { } else {
@ -9081,6 +9110,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
} }
} }
} }
}
} else if (spellid == OT_S_SUMMONWEAPON) { } else if (spellid == OT_S_SUMMONWEAPON) {
object_t *o; object_t *o;
targcell = caster->cell; targcell = caster->cell;
@ -9679,7 +9709,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
if (o) { if (o) {
noise(caster->cell, NULL, NC_OTHER, 1, "something hitting the ground.", NULL); noise(caster->cell, NULL, NC_OTHER, 1, "something hitting the ground.", NULL);
if (!isblind(caster)) { if (!isblind(caster)) {
msg("%s appear%s on the ground!", obname, (o->amt == 1) ? "s" : ""); msg("%s appear%s on the ground!", obname, OBS1(o));
} }
} else { } else {
// ob exists but couldn't make it appear // ob exists but couldn't make it appear
@ -10438,8 +10468,7 @@ void pullobto(object_t *o, lifeform_t *lf) {
getobname(o, obname, o->amt); getobname(o, obname, o->amt);
getlfname(lf, lfname); getlfname(lf, lfname);
if (isplayer(lf) || haslos(player, lf->cell)) { if (isplayer(lf) || haslos(player, lf->cell)) {
msg("%s %s towards %s!", obname, (o->amt == 1) ? "flies" : "fly", msg("%s %s towards %s!", obname, OB1(o,"flies","fly"), lfname);
lfname);
} }
// can we pick up the object? // can we pick up the object?
@ -10451,7 +10480,7 @@ void pullobto(object_t *o, lifeform_t *lf) {
snprintf(buf, BUFLEN, "a flying %s", noprefix(obname)); snprintf(buf, BUFLEN, "a flying %s", noprefix(obname));
if (isplayer(lf) || haslos(player, lf->cell)) { if (isplayer(lf) || haslos(player, lf->cell)) {
msg("%s %s into %s!", obname, (o->amt == 1) ? "slams" : "slam", lfname); msg("%s %s into %s!", obname, OB1(o,"slams","slam"), lfname);
} }
// where does it end up? // where does it end up?
obloc = getoblocation(o); obloc = getoblocation(o);
@ -10661,7 +10690,8 @@ void stopspell(lifeform_t *caster, enum OBTYPE spellid) {
// returns # created // returns # created
int summonlfs(lifeform_t *caster, cell_t *where, enum RACECLASS wantrc, enum LFSIZE wantsize, enum ALIGNMENT wantalign, int howmany, int lifetime, int friendly) { // pass EITHER wantrace OR wantrc + wantsize + wantalign
int summonlfs(lifeform_t *caster, cell_t *where, enum RACE wantrace, enum RACECLASS wantrc, enum LFSIZE wantsize, enum ALIGNMENT wantalign, int howmany, int lifetime, int friendly) {
lifeform_t *newlf; lifeform_t *newlf;
race_t *r = NULL; race_t *r = NULL;
enum RACE poss[MAXCANDIDATES]; enum RACE poss[MAXCANDIDATES];
@ -10670,6 +10700,10 @@ int summonlfs(lifeform_t *caster, cell_t *where, enum RACECLASS wantrc, enum LFS
int ncreated = 0; int ncreated = 0;
cell_t *c; cell_t *c;
if (wantrace) {
poss[0] = wantrace;
nposs = 1;
} else {
// determine possible types of race // determine possible types of race
for (r = firstrace ; r; r = r->next) { for (r = firstrace ; r; r = r->next) {
int ok = B_TRUE; int ok = B_TRUE;
@ -10696,6 +10730,7 @@ int summonlfs(lifeform_t *caster, cell_t *where, enum RACECLASS wantrc, enum LFS
poss[nposs++] = r->id; poss[nposs++] = r->id;
} }
} }
}
if (nposs == 0) { if (nposs == 0) {
return 0; return 0;

View File

@ -38,7 +38,7 @@ int spellresisted(lifeform_t *target, lifeform_t *caster, int spellid, int power
void stopspell(lifeform_t *caster, enum OBTYPE spellid); void stopspell(lifeform_t *caster, enum OBTYPE spellid);
void stopallspells(lifeform_t *lf); void stopallspells(lifeform_t *lf);
void stopallspellsexcept(lifeform_t *lf, ...); void stopallspellsexcept(lifeform_t *lf, ...);
int summonlfs(lifeform_t *caster, cell_t *where, enum RACECLASS wantrc, enum LFSIZE wantsize, enum ALIGNMENT wantalign, int howmany, int lifetime, int friendly); int summonlfs(lifeform_t *caster, cell_t *where, enum RACE wantrace, enum RACECLASS wantrc, enum LFSIZE wantsize, enum ALIGNMENT wantalign, int howmany, int lifetime, int friendly);
lifeform_t *validateabillf(lifeform_t *user, enum OBTYPE aid, lifeform_t **target); lifeform_t *validateabillf(lifeform_t *user, enum OBTYPE aid, lifeform_t **target);
cell_t *validatespellcell(lifeform_t *caster, cell_t **targcell, int targtype, enum OBTYPE spellid, int power, int frompot); cell_t *validatespellcell(lifeform_t *caster, cell_t **targcell, int targtype, enum OBTYPE spellid, int power, int frompot);
//lifeform_t *validatespelllf(lifeform_t *caster, lifeform_t **lf); //lifeform_t *validatespelllf(lifeform_t *caster, lifeform_t **lf);

2
text.c
View File

@ -1091,7 +1091,7 @@ void makegunaimstring(lifeform_t *lf, int lfid, char *retbuf) {
makethrowaccstring(lf, targ->cell, f, accbuf); makethrowaccstring(lf, targ->cell, f, accbuf);
killflagsofid(lf->flags, F_THROWING); killflagsofid(lf->flags, F_THROWING);
sprintf(retbuf, "%s %s", noprefix(targname), accbuf); sprintf(retbuf, "%s%s", noprefix(targname), accbuf);
} }
char *makekillertext(char *retbuf, char *killverb, char *lastdam, int wantextra) { char *makekillertext(char *retbuf, char *killverb, char *lastdam, int wantextra) {