- [+] Go to 256 colour mode!

- [+] enable it
    - [+] adjust colour enum definitions
    - [+] adjust usage of colour enums in *.c
    - [+] redo celltype colours
    - [+] redo all lf colours in data.c
    - [+] redo all object colours in data.c
    - [+] fix potioncolours etc
    - [+] get background colours working again.....
- [+] You walk down the staircase...  Invalid racename 'random' in
      vault monsterzoo
- [+] gaining/losing god bonus - only announce first one you lose/gain!
- [+] knockout bugs:
    - [+] "you knock out the pixie"... then there' s pixie corpse.
    - [+] shouldn't be able to KO robots!
- [+] don't say "you kill baba yaga's hut", say "you defeat xxx"
- [+] alignment change
    - [+] should become evil if you worship hecta
    - [+] ...and good if you worship glorana
    - [+]  -15% xp forever.
- [+] shoudl become prone when hit by falling door trap.
- [+] TEMPERATURE
    - [+] habitat->basetemperature 
        - [+] VCOLD = <=0
        - [+] COLD=1-11
        - [+] COOL=12-18
        - [+] AVERAGE = 19-22
        - [+] WARM=23-29
        - [+] HOT=30-35
        - [+] VHOT=36+
    - [+] getcelltemperature()
        - [+] start with habitat temperature
        - [+] adding/removing/moving nearby fire makes cells hotter
        - [+] adding/removing/moving nearby blizzards, hailstorms, ice
              etc make cells cooler
    - [+] getlftemp()
        - [+] start with getcelltemp
        - [+] adjust for warm/cold blood, resistances, etc
    - [+] hot  effects
        - [+] stamina is used more quickly
        - [+] ice melts very fast (turns to water)
        - [+] food goes bad very quickly
        - [+] things made of ice take damage every turn. in
              startlfturn() ?
    - [+] cold effects
        - [+] exposed body parts give  penalties to accuracy
            - [+] -2 to -4 per exposed body part (ie. max -14, -21, -28)
        - [+] no effect on furred things like bears. make them
              cold-resistant or immune.
        * [+] medium chance to shiver... chance to drop weapons
        * [+] low chance to catch cold (check cold damage code)
        - [+] nothing ever melts
        - [+] food never goes bad
        - [+] water freezes( turns to ice)
        - [+] things made of fire take _extra_ damage (in attack.c) 
    - [+] Show YOUR temperature in @@
    - [+] Show other's temp in @@ if our lore is high enough
    - [+] notify when temperature changes.
    - [+] just like igniting other fires, fires should deal fire damage
          to surrounding cells
    - [+] heat/cold should affect SURRONDING cells too.
    - [+] maybe: instead of checking cell temp every time, recalc cell
          temp whenever:
        - [+] create cells with habitat base temperature
        - [+] we add a new object
        - [+] we move an object
        - [+] we remove an object
        - [+] SAVE cell temperature now.
    - [+] show cold/hot in statusbar.
    - [+] cold announcement not working.
    - [+] change glaciate:
        - [+] create "unnatural coldness" object
    - [+] cold snap: (l2)
        - [+] create "unnatural coldness" in a radius
    - [+] heatwave (l2) or "oppressive heat"
        - [+] create "unnatural heat" in a radius
    - [+] add fur coats to creatures (ie. resistcold)
- [+] ice cave level
    - [+] walls = ice.
    - [+] floor = metal
    - [+] creation similar to swamp:
        - [+] make dungeon
        - [+] change solid walls to ice
    - [+] limit room size to small.
    - [+] floor = snow
    - [+] temperature
        - [+] base temperature is cold
    - [+] ice-themed monsters
    - [+] ice-themed objects
This commit is contained in:
Rob Pearce 2012-11-27 10:27:54 +00:00
parent d39e7ea7c1
commit e8cc823d72
21 changed files with 1495 additions and 596 deletions

View File

@ -1212,6 +1212,19 @@ int attacklf(lifeform_t *lf, lifeform_t *victim, object_t *wep, flag_t *damflag)
loreadd = slev; loreadd = slev;
} }
dam[0] = (int) ( (float)dam[0] + loreadd ); dam[0] = (int) ( (float)dam[0] + loreadd );
// extra damage to fire-based lifeforms if they are cold.
if (lf->material->id == MT_FIRE) {
enum TEMPERATURE temp;
temp = getlftemp(lf);
switch (temp) {
case T_CHILLY: dam[0] = pctof(125, dam[0]); break;
case T_COLD: dam[0] = pctof(160, dam[0]); break;
case T_VCOLD: dam[0] = pctof(200, dam[0]); break;
default: break;
}
}
} }
if (lfhasflag(lf, F_PHANTASM)) { if (lfhasflag(lf, F_PHANTASM)) {
@ -3190,6 +3203,7 @@ int rolltohit(lifeform_t *lf, lifeform_t *victim, object_t *wep, int *critical,
*critical = 1; *critical = 1;
} else { } else {
int critroll; int critroll;
int minroll = 1;
critroll = rnd(1,100); critroll = rnd(1,100);
// modify for lore level > pr_novice // modify for lore level > pr_novice
@ -3198,7 +3212,15 @@ int rolltohit(lifeform_t *lf, lifeform_t *victim, object_t *wep, int *critical,
lorebonus = ((lorelev-1)*5); // ie. up to 25% bonus lorebonus = ((lorelev-1)*5); // ie. up to 25% bonus
critroll -= lorebonus; critroll -= lorebonus;
} }
limit(&critroll, 1, 100);
if (isplayer(lf)) {
f = lfhasflag(lf, F_MINCRITCHANCE);
if (f) {
minroll = f->val[0];
}
}
limit(&critroll, minroll, 100);
if (critroll <= getcritchance(lf, wep,victim)) *critical = 1; if (critroll <= getcritchance(lf, wep,victim)) *critical = 1;
} }

675
data.c

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -11,7 +11,7 @@ random(3,3,5,5)
autodoors:100 autodoors:100
goesin:dungeon goesin:dungeon
! every cell in here has 1-3 objects and a monster ! every cell in here has 1-3 objects and a monster
scatter(1,1,-2,-2) mon:random:100% scatter(1,1,-2,-2) mon:single random:100%
scatter(1,1,-2,-2) ob:random:100% scatter(1,1,-2,-2) ob:random:100%
scatter(1,1,-2,-2) ob:random:100% scatter(1,1,-2,-2) ob:random:100%
scatter(1,1,-2,-2) ob:random:100%:50 scatter(1,1,-2,-2) ob:random:100%:50

127
defs.h
View File

@ -96,6 +96,9 @@
#define B_TRUE (-1) #define B_TRUE (-1)
#define B_MAYBE (-2) #define B_MAYBE (-2)
#define B_ADD 1
#define B_REMOVE -1
#define B_INADJCELL (-1) #define B_INADJCELL (-1)
#define B_DODAM (-1) #define B_DODAM (-1)
@ -289,6 +292,9 @@
#define MAX_ROOMW (MAX_MAPW / 3) #define MAX_ROOMW (MAX_MAPW / 3)
#define MAX_ROOMH (MAX_MAPH / 3) #define MAX_ROOMH (MAX_MAPH / 3)
#define MIN_TEMPERATURE -10
#define MAX_TEMPERATURE 45
// askobject options // askobject options
#define AO_NONE 0 #define AO_NONE 0
#define AO_INCLUDENOTHING 1 #define AO_INCLUDENOTHING 1
@ -393,6 +399,16 @@
#define MAXDIR_MAP 15 #define MAXDIR_MAP 15
enum TEMPERATURE {
T_VCOLD = -3,
T_COLD = -2,
T_CHILLY = -1,
T_NORMAL = 0,
T_WARM = 1,
T_HOT = 2,
T_VHOT = 3,
};
enum CONTAINERCONTENTS { enum CONTAINERCONTENTS {
CC_AMMO, CC_AMMO,
CC_FOOD, CC_FOOD,
@ -611,36 +627,74 @@ enum SHOPACTION {
// ncurses colours // additional colours
/*
enum ADCOLOR {
COLOR_DARKBROWN = 500,
};
*/
// ncurses colourpairs
#define C_NONE (-1) #define C_NONE (-1)
enum COLOUR { enum COLOUR {
C_RANDOM = -1, C_RANDOM = -1,
C_BLACK = 0, // regular colours
C_RED = 1, C_BLACK = 0,
C_GREEN = 2, C_RED = 1,
C_BROWN = 3, C_AQUA,
C_BLUE = 4, C_GREEN,
C_MAGENTA = 5, C_BROWN,
C_CYAN = 6, C_BLUE,
C_GREY = 7, C_INDIGO,
// bolded colours C_MAGENTA,
C_YELLOW = 8, C_PINK,
C_WHITE = 9, C_CYAN,
C_BOLDCYAN = 10, C_GREY,
C_BOLDBLUE = 11, C_YELLOW,
C_BOLDMAGENTA = 12, C_WHITE,
C_ORANGE = 13, // specific colours
C_BOLDGREEN = 14, C_BONE,
C_DARKGREY = 15, C_BRICK,
C_METAL,
C_MOSS,
C_FLESH,
C_FOG,
C_CARPET1,
C_CARPET2,
C_SMOKE,
C_WOOD,
// dark colours
C_DARKCYAN,
C_DARKBLUE,
C_DARKMAGENTA,
C_DARKYELLOW,
C_ORANGE,
C_DARKGREEN,
C_DARKGREY,
C_DARKBROWN,
C_DARKRED,
C_VDARKGREY,
// light colours
C_LIGHTBLUE,
C_LIGHTBROWN,
C_LIGHTCYAN,
C_LIGHTGREEN,
C_LIGHTMAGENTA,
C_LIGHTRED,
C_LIGHTYELLOW,
C_LAST
}; };
#define C_FIRST C_RED #define C_FIRST C_RED
#define C_LAST C_DARKGREY
#define COLBASE 64
#define BGGAP (C_LAST+1)
#define BLACKBG 0 #define BLACKBG 0
#define BLUEBG 16 #define BLUEBG (BGGAP)
#define GREENBG 32 #define GREENBG ((BGGAP*2))
#define REDBG 48 #define REDBG ((BGGAP*3))
enum CASTTYPE { enum CASTTYPE {
CT_NORMAL = 0, CT_NORMAL = 0,
@ -973,6 +1027,7 @@ enum CELLTYPE {
CT_FLOORCARPET, CT_FLOORCARPET,
CT_FLOORDURANITE, CT_FLOORDURANITE,
CT_FLOORSHOP, CT_FLOORSHOP,
CT_FLOORSNOW,
CT_FLOORTILE, CT_FLOORTILE,
CT_FLOORWOOD, CT_FLOORWOOD,
CT_GRASS, CT_GRASS,
@ -1519,6 +1574,7 @@ enum MATERIAL {
MT_CRYSTAL = 31, MT_CRYSTAL = 31,
MT_DURANITE = 32, MT_DURANITE = 32,
MT_BRICK = 33, MT_BRICK = 33,
MT_SNOW = 34,
}; };
// Object Types // Object Types
@ -1553,6 +1609,8 @@ enum OBTYPE {
OT_VSTAIRSUP, OT_VSTAIRSUP,
OT_TREEDOWN, OT_TREEDOWN,
OT_TREEUP, OT_TREEUP,
OT_ICESTAIRSDOWN,
OT_ICESTAIRSUP,
OT_TUNNELDOWN, OT_TUNNELDOWN,
OT_TUNNELUP, OT_TUNNELUP,
OT_LUNARGATE, OT_LUNARGATE,
@ -1823,6 +1881,7 @@ enum OBTYPE {
OT_S_FLAMEPILLAR, OT_S_FLAMEPILLAR,
OT_S_FLAMEBURST, OT_S_FLAMEBURST,
OT_S_GATHERFLAME, OT_S_GATHERFLAME,
OT_S_HEATWAVE,
OT_S_IMMOLATE, OT_S_IMMOLATE,
OT_S_METEOR, OT_S_METEOR,
OT_S_NEGATEFIRE, OT_S_NEGATEFIRE,
@ -1836,6 +1895,7 @@ enum OBTYPE {
OT_S_CHILL, OT_S_CHILL,
OT_S_COLDBURST, OT_S_COLDBURST,
OT_S_COLDRAY, OT_S_COLDRAY,
OT_S_COLDSNAP,
OT_S_CRYSTALARM, OT_S_CRYSTALARM,
OT_S_CRYSTALSHIELD, OT_S_CRYSTALSHIELD,
OT_S_ENDURECOLD, OT_S_ENDURECOLD,
@ -2210,11 +2270,13 @@ enum OBTYPE {
OT_FOOTPRINT, OT_FOOTPRINT,
OT_SCENT, OT_SCENT,
// effects // effects
OT_COLDNESS,
OT_DUSTCLOUD, OT_DUSTCLOUD,
OT_DUSTPUFF, OT_DUSTPUFF,
OT_FIRELARGE, OT_FIRELARGE,
OT_FIREMED, OT_FIREMED,
OT_FIRESMALL, OT_FIRESMALL,
OT_HEAT,
OT_HAILSTORM, OT_HAILSTORM,
OT_HURRICANE, OT_HURRICANE,
OT_ICEWALL, OT_ICEWALL,
@ -2740,6 +2802,8 @@ enum FLAG {
// should only be used for SCENT, not footprints. // should only be used for SCENT, not footprints.
F_NOFEEL, // when blind, don't show "you can feel xxx" F_NOFEEL, // when blind, don't show "you can feel xxx"
F_FEELTEXT, // when blind, show "you can feel"+f->text F_FEELTEXT, // when blind, show "you can feel"+f->text
F_TEMPMOD, // this object will change its cell's temperature by
// v0.
// for items in shops // for items in shops
F_VENDITEM, // causes vending machine to show this item as identified F_VENDITEM, // causes vending machine to show this item as identified
//F_SHOPITEM, // v0 is object value. //F_SHOPITEM, // v0 is object value.
@ -3098,9 +3162,10 @@ enum FLAG {
// if v0/v1 are set, only use this text if dam AMOUNT (not pct) is // if v0/v1 are set, only use this text if dam AMOUNT (not pct) is
// between v0 and v1. // between v0 and v1.
// should always be singular // should always be singular
F_KILLVERB, // text=verb for a fatal attacking. ie. "kill" "behead" F_KILLVERB, // text=verb this weapon uses for a fatal attacking.
// if v0/v1 are set, only use this text if dam PCT (not amount) is // ie. "kill" "behead"
// between v0 and v1. // if v0/v1 are set, only use this text if
// dam PCT (not amount) is between v0 and v1.
// should always be singular // should always be singular
F_OBATTACKDELAY, // how long weapon takes to attack F_OBATTACKDELAY, // how long weapon takes to attack
F_USESSKILL, // weapon needs skill sk_v0 F_USESSKILL, // weapon needs skill sk_v0
@ -3397,6 +3462,8 @@ enum FLAG {
F_ARMOURPENALTY, // lower your acc/ev by val0 due to cumbersome F_ARMOURPENALTY, // lower your acc/ev by val0 due to cumbersome
// armour. lowered by sk_armour skill. // armour. lowered by sk_armour skill.
// v0 is accuracy penalty, v1 is evasion penalty. // v0 is accuracy penalty, v1 is evasion penalty.
F_MINCRITCHANCE, // minimum critical hit chance % for this lf
// is v0.
F_MINDSHIELD, // lf is immune to psionic attacks F_MINDSHIELD, // lf is immune to psionic attacks
F_MISCASTCHANCE, // lf has +v0% chance of spell failure F_MISCASTCHANCE, // lf has +v0% chance of spell failure
F_LEVRACE, // at level v0, this race is promoted to race v1 F_LEVRACE, // at level v0, this race is promoted to race v1
@ -3745,10 +3812,14 @@ enum FLAG {
F_SACRIFICEOBMAGIC, // can sacrifice obs which are magical. F_SACRIFICEOBMAGIC, // can sacrifice obs which are magical.
// v2 = piety per ob // v2 = piety per ob
F_GETKILLEDVERB, // text = verb describing how this lf dies.
// NOTE: overrides F_KILLVERB on weapons!
F_NAME, // text = lf's name. ie. lfname = "Fred" F_NAME, // text = lf's name. ie. lfname = "Fred"
// also used for names of OT_GRIMOIRE objects // also used for names of OT_GRIMOIRE objects
F_NAMED, // text = lf's name. ie. lfname = "xat named Fred" F_NAMED, // text = lf's name. ie. lfname = "xat named Fred"
F_NOKO, // this lf cannot be knocked unconscious
F_XPMOD, // add/subtract this much from calculated xpval F_XPMOD, // add/subtract this much from calculated xpval
// for killing this monster.
F_BLOODOB, // text = type of object to drop for blood F_BLOODOB, // text = type of object to drop for blood
// corpses will inherit the FIRST one of these only. // corpses will inherit the FIRST one of these only.
F_UNSUMMONOB, // text = type of object to drop when this creature F_UNSUMMONOB, // text = type of object to drop when this creature
@ -4521,6 +4592,7 @@ enum BRANCH {
BH_WOODS, BH_WOODS,
BH_BABAYAGAHUT, BH_BABAYAGAHUT,
BH_MASTERVAULTS, BH_MASTERVAULTS,
BH_ICECAVERNS,
}; };
enum HABITAT { enum HABITAT {
@ -4536,6 +4608,7 @@ enum HABITAT {
H_BYHUT = 10, H_BYHUT = 10,
H_ANTNEST = 11, H_ANTNEST = 11,
H_MASTERVAULTS = 12, H_MASTERVAULTS = 12,
H_ICECAVE = 13,
H_ALL = 999 H_ALL = 999
}; };
@ -4607,6 +4680,7 @@ typedef struct habitat_s {
int randobpct; // % chance that 'something' is an ob rather than monster int randobpct; // % chance that 'something' is an ob rather than monster
int randvaultpct; // % chance that a room will be a vault int randvaultpct; // % chance that a room will be a vault
//int maxvisrange; //int maxvisrange;
int temperature; // base temperature. roughly corresponds to celcius
enum OBTYPE upstairtype, downstairtype; enum OBTYPE upstairtype, downstairtype;
int stairsinrooms; int stairsinrooms;
enum CELLTYPE emptycelltype,solidcelltype; enum CELLTYPE emptycelltype,solidcelltype;
@ -4778,6 +4852,7 @@ typedef struct cell_s {
//int origlittimer; //int origlittimer;
//int littimer; //int littimer;
int hp; int hp;
int temperature;
char *reason; char *reason;
char *lockedreason; char *lockedreason;

37
god.c
View File

@ -562,6 +562,7 @@ void checkgodbonus(enum RACE rid, enum PIETYLEV newlev, enum PIETYLEV oldlev) {
int nretflags,i; int nretflags,i;
enum PIETYLEV plev; enum PIETYLEV plev;
lifeform_t *god; lifeform_t *god;
int first = B_TRUE;
if (!godprayedto(rid)) return; if (!godprayedto(rid)) return;
if (newlev == oldlev) return; if (newlev == oldlev) return;
god = findgod(rid); god = findgod(rid);
@ -570,12 +571,14 @@ void checkgodbonus(enum RACE rid, enum PIETYLEV newlev, enum PIETYLEV oldlev) {
for (i = 0; i < nretflags; i++) { for (i = 0; i < nretflags; i++) {
if (newlev < oldlev) { if (newlev < oldlev) {
if ((retflag[i]->val[0] > newlev) && (retflag[i]->val[0] <= oldlev)) { if ((retflag[i]->val[0] > newlev) && (retflag[i]->val[0] <= oldlev)) {
removegodbonus(rid, retflag[i]); removegodbonus(rid, retflag[i], first);
first = B_FALSE;
} }
} else if (newlev > oldlev) { } else if (newlev > oldlev) {
// piety increased // piety increased
if ((retflag[i]->val[0] <= newlev) && (retflag[i]->val[0] > oldlev)) { if ((retflag[i]->val[0] <= newlev) && (retflag[i]->val[0] > oldlev)) {
givegodbonus(rid, retflag[i]); givegodbonus(rid, retflag[i], first);
first = B_FALSE;
} }
} }
} }
@ -867,7 +870,7 @@ enum PIETYLEV getpietylev(enum RACE rid, enum COLOUR *col, char *happiness) {
if (happiness) strcpy(happiness, "Angry"); if (happiness) strcpy(happiness, "Angry");
return PL_ANGRY; return PL_ANGRY;
} else if (piety <= 99) { // 0 - 99 } else if (piety <= 99) { // 0 - 99
if (col) *col = C_BROWN; if (col) *col = C_DARKYELLOW;
if (happiness) strcpy(happiness, "Tolerated"); if (happiness) strcpy(happiness, "Tolerated");
return PL_TOLERATED; return PL_TOLERATED;
} else if (piety <= 199) { // 100 - 199 } else if (piety <= 199) { // 100 - 199
@ -879,11 +882,11 @@ enum PIETYLEV getpietylev(enum RACE rid, enum COLOUR *col, char *happiness) {
if (happiness) strcpy(happiness, "Pleased"); if (happiness) strcpy(happiness, "Pleased");
return PL_PLEASED; return PL_PLEASED;
} else if (piety <= 399) { // 300 - 399 } else if (piety <= 399) { // 300 - 399
if (col) *col = C_BOLDGREEN; if (col) *col = C_LIGHTGREEN;
if (happiness) strcpy(happiness, "Delighted"); if (happiness) strcpy(happiness, "Delighted");
return PL_DELIGHTED; return PL_DELIGHTED;
} else { // 400+ } else { // 400+
if (col) *col = C_BOLDCYAN; if (col) *col = C_LIGHTCYAN;
if (happiness) strcpy(happiness, "Ecstatic"); if (happiness) strcpy(happiness, "Ecstatic");
return PL_ECSTATIC; return PL_ECSTATIC;
} }
@ -930,7 +933,7 @@ enum OBTYPE getrelatedgodstone(enum RACE rid) {
return OT_NONE; return OT_NONE;
} }
void givegodbonus(enum RACE rid, flag_t *bf) { void givegodbonus(enum RACE rid, flag_t *bf, int announce) {
flag_t *f; flag_t *f;
lifeform_t *god; lifeform_t *god;
int targ[3], arg = NA; int targ[3], arg = NA;
@ -941,8 +944,10 @@ void givegodbonus(enum RACE rid, flag_t *bf) {
if (!god) return; if (!god) return;
// god announcement. // god announcement.
godsay(rid, B_TRUE, getflagtext(god->flags, F_GODBONUSTEXT)); if (announce) {
more(); godsay(rid, B_TRUE, getflagtext(god->flags, F_GODBONUSTEXT));
more();
}
// increment piety so that it doesn't keep bouncing around the border. // increment piety so that it doesn't keep bouncing around the border.
modpiety(rid, PIETYPRAYLOSS); modpiety(rid, PIETYPRAYLOSS);
@ -977,8 +982,8 @@ void givegodbonus(enum RACE rid, flag_t *bf) {
case SC_SEARCH: godsay(rid, B_FALSE, "That which is hidden shall be revealed!"); break; case SC_SEARCH: godsay(rid, B_FALSE, "That which is hidden shall be revealed!"); break;
default: break; default: break;
} }
} else if (arg == F_HEAVYBLOW) { } else if (arg == F_MINCRITCHANCE) {
godsay(rid, B_FALSE, "Foes shall be driven away by your blows!"); break; godsay(rid, B_FALSE, "You shall inflict grevious injuries on your foes!"); break;
} }
} }
break; break;
@ -1012,7 +1017,7 @@ int prayedtoany(void) {
return B_FALSE; return B_FALSE;
} }
void removegodbonus(enum RACE rid, flag_t *bf) { void removegodbonus(enum RACE rid, flag_t *bf, int announce) {
int targ[3], arg = NA; int targ[3], arg = NA;
enum PIETYLEV bonuslev; enum PIETYLEV bonuslev;
enum GODBONUS bonusid; enum GODBONUS bonusid;
@ -1022,8 +1027,10 @@ void removegodbonus(enum RACE rid, flag_t *bf) {
if (!god) return; if (!god) return;
// god announcement. // god announcement.
godsay(rid, B_TRUE, getflagtext(god->flags, F_GODNOBONUSTEXT)); if (announce) {
more(); godsay(rid, B_TRUE, getflagtext(god->flags, F_GODNOBONUSTEXT));
more();
}
// parse regular rags // parse regular rags
parsegodbonusargs(bf, &bonuslev, &bonusid, &arg, targ); parsegodbonusargs(bf, &bonuslev, &bonusid, &arg, targ);
@ -2171,8 +2178,10 @@ int prayto(lifeform_t *lf, lifeform_t *god) {
if (changealign != AL_NONE) { if (changealign != AL_NONE) {
setalignment(player, changealign); setalignment(player, changealign);
msg("^gYour alignment has changed to %s!", getalignmentname(changealign)); msg("^BYour alignment has changed to %s!", getalignmentname(changealign));
more(); more();
msg("^B(you will receive -15%% XP for the next 1001 turns)");
addtempflag(player->flags, F_LEARNBOOST, -15, NA, NA, NULL, 1001);
} }

4
god.h
View File

@ -15,7 +15,7 @@ int getprayedgods(lifeform_t **retgod, int *nretgods);
lifeform_t *getrandomgod(void); lifeform_t *getrandomgod(void);
lifeform_t *getrandomprayedgod(void); lifeform_t *getrandomprayedgod(void);
enum OBTYPE getrelatedgodstone(enum RACE rid); enum OBTYPE getrelatedgodstone(enum RACE rid);
void givegodbonus(enum RACE rid, flag_t *bf); void givegodbonus(enum RACE rid, flag_t *bf, int announce);
lifeform_t *godappears(enum RACE rid, cell_t *where); lifeform_t *godappears(enum RACE rid, cell_t *where);
void god_usepoison_response(void); void god_usepoison_response(void);
int godblocked(enum RACE rid); int godblocked(enum RACE rid);
@ -30,6 +30,6 @@ void pleasegod(enum RACE rid, int amt);
void pleasegodmaybe(enum RACE rid, int amt); void pleasegodmaybe(enum RACE rid, int amt);
int prayto(lifeform_t *lf, lifeform_t *god); int prayto(lifeform_t *lf, lifeform_t *god);
int prayedtoany(void); int prayedtoany(void);
void removegodbonus(enum RACE rid, flag_t *bf); void removegodbonus(enum RACE rid, flag_t *bf, int announce);
void setpiety(enum RACE rid, int amt); void setpiety(enum RACE rid, int amt);
int uncurse_one_equipped(lifeform_t *lf, char *text); int uncurse_one_equipped(lifeform_t *lf, char *text);

347
io.c
View File

@ -1793,7 +1793,7 @@ int announceflaggain(lifeform_t *lf, flag_t *f) {
if (lf2) { if (lf2) {
getlfname(lf2, buf); getlfname(lf2, buf);
if ((f->lifetime == PERMENANT) || (f->lifetime >= 4)) { if ((f->lifetime == PERMENANT) || (f->lifetime >= 4)) {
msg("^%d%s turn%s to flee from %s!", getlfcol(lf, CC_BAD), msg("^%c%s turn%s to flee from %s!", getlfcol(lf, CC_BAD),
lfname, isplayer(lf) ? "" : "s", lfname, isplayer(lf) ? "" : "s",
(cansee(player, lf2) || isplayer(lf2)) ? buf : "something"); (cansee(player, lf2) || isplayer(lf2)) ? buf : "something");
} else { // jsut scared a little bit } else { // jsut scared a little bit
@ -1926,7 +1926,11 @@ int announceflaggain(lifeform_t *lf, flag_t *f) {
break; break;
case F_LEARNBOOST: case F_LEARNBOOST:
if (isplayer(lf)) { if (isplayer(lf)) {
msg("You feel more receptive to new knowledge!"); if (f->val[0] > 0) {
msg("^gYou feel more receptive to new knowledge!");
} else {
msg("^bYou feel less receptive to new knowledge!");
}
donesomething = B_TRUE; donesomething = B_TRUE;
} }
break; break;
@ -2703,7 +2707,11 @@ int announceflagloss(lifeform_t *lf, flag_t *f) {
break; break;
case F_LEARNBOOST: case F_LEARNBOOST:
if (isplayer(lf)) { if (isplayer(lf)) {
msg("You no longer feel receptive to new knowledge."); if (f->val[0] > 0) {
msg("You no longer feel receptive to new knowledge.");
} else {
msg("You no longer feel opposed to new knowledge.");
}
donesomething = B_TRUE; donesomething = B_TRUE;
} }
break; break;
@ -3338,9 +3346,9 @@ void listobs(WINDOW *win, object_t **mylist, int *sellist, int *selcount, int fi
setobcolour(win, mylist[i], B_FALSE); setobcolour(win, mylist[i], B_FALSE);
if (strlen(equipbuf)) { if (strlen(equipbuf)) {
setcol(win, C_BROWN); setcol(win, C_DARKYELLOW);
wprintw(win, "%s", equipbuf); wprintw(win, "%s", equipbuf);
unsetcol(win, C_BROWN); unsetcol(win, C_DARKYELLOW);
} }
if (strlen(pointsbuf)) { if (strlen(pointsbuf)) {
@ -7397,7 +7405,7 @@ char *makedesc_ob(object_t *o, char *retbuf) {
(f->val[0] == A_AGI) ? "" : "%"); (f->val[0] == A_AGI) ? "" : "%");
} }
sprintf(buf, "^%dYour low %s will decrease your %s with this weapon %s.^n\n", sprintf(buf, "^%dYour low %s will decrease your %s with this weapon %s.^n\n",
C_BROWN, C_DARKYELLOW,
getattrname(f->val[0]), getattrname(f->val[0]),
(f->val[0] == A_AGI) ? "accuracy" : "damage", (f->val[0] == A_AGI) ? "accuracy" : "damage",
howmuch); howmuch);
@ -7572,7 +7580,7 @@ char *makedesc_race(enum RACE rid, char *retbuf, int showextra, int forplayersel
case AT_GTAVERAGE: sprintf(ch, "%-4s", "+"); col = C_GREEN; break; case AT_GTAVERAGE: sprintf(ch, "%-4s", "+"); col = C_GREEN; break;
case AT_HIGH: sprintf(ch, "%-4s", "++"); col = C_GREEN; break; case AT_HIGH: sprintf(ch, "%-4s", "++"); col = C_GREEN; break;
case AT_VHIGH: sprintf(ch, "%-4s", "+++"); col = C_GREEN; break; case AT_VHIGH: sprintf(ch, "%-4s", "+++"); col = C_GREEN; break;
case AT_EXHIGH: sprintf(ch, "%-4s", "++++"); col = C_BOLDBLUE; break; case AT_EXHIGH: sprintf(ch, "%-4s", "++++"); col = C_LIGHTBLUE; break;
default: default:
case AT_AVERAGE: sprintf(ch, "%-4s", "-"); col = C_GREY; break; case AT_AVERAGE: sprintf(ch, "%-4s", "-"); col = C_GREY; break;
} }
@ -9563,9 +9571,31 @@ void doheadingsmall(WINDOW *win, int y, int x, char *format, char *heading) {
unsetcol(win, C_WHITE); unsetcol(win, C_WHITE);
} }
// wrapper for ncurses init_color
void initcol(short c, short r, short g, short b) {
int rv;
rv = init_color(COLBASE+c, r, g, b);
if (rv == ERR) {
dblog("ERROR setting colour %d to { %d,%d,%d }",c,r,g,b);
exit(1);
}
}
// wrapper for init_pair
void initcolpair(int pairidx, enum COLOUR fg, enum COLOUR bg ) {
int rv;
rv = init_pair(pairidx, COLBASE+fg, COLBASE+bg);
if (rv == ERR) {
dblog("ERROR setting colourpair %d to fg=%s bg=%s",pairidx,getcolname(fg),getcolname(bg));
exit(1);
}
}
void initgfx(void) { void initgfx(void) {
int msgwinh = 2; int msgwinh = 2;
int statwinh = 3; int statwinh = 3;
int i;
short r,g,b;
setlocale(LC_CTYPE, ""); setlocale(LC_CTYPE, "");
@ -9573,83 +9603,74 @@ void initgfx(void) {
// colour setup // colour setup
if (!has_colors()) { if (!has_colors()) {
printf("Terminal does not support colour.\n"); wprintw(mainwin,"Terminal does not support colour.\n");
hascolour = B_FALSE; hascolour = B_FALSE;
exit(1); exit(1);
} }
start_color(); if (!can_change_color()){
wprintw(mainwin,"Terminal does not support changes to colours.\n");
exit(1);
}
start_color();
dblog("colour pairs = %d", COLOR_PAIRS);
dblog("colours = %d", COLORS);
// init extra colours
initcol(C_BLACK, 0, 0, 0);
initcol(C_AQUA, 12, 672, 632);
initcol(C_RED, 1000, 0, 0);
initcol(C_GREEN, 0, 1000, 0);
initcol(C_BLUE, 0, 0, 1000);
initcol(C_INDIGO, 300, 0, 520);
initcol(C_MAGENTA, 1000, 0, 1000);
initcol(C_PINK, 820, 368, 368);
initcol(C_CYAN, 0, 1000, 1000);
initcol(C_GREY, 800, 800, 800);
initcol(C_YELLOW, 1000, 1000, 0);
initcol(C_BROWN, 584, 444, 264);
initcol(C_WHITE, 1000, 1000, 1000);
// specific colours
initcol(C_BONE, 556, 548, 448);
initcol(C_BRICK, 568, 140, 140);
initcol(C_METAL, 500, 500, 500);
initcol(C_FLESH, 952, 612, 408);
initcol(C_FOG, 812, 808, 728);
initcol(C_MOSS, 0, 748, 428);
initcol(C_CARPET1, 560, 480, 336);
initcol(C_CARPET2, 0, 556, 468);
initcol(C_SMOKE, 250, 250, 300);
initcol(C_WOOD, 384, 244, 64);
// dark cols
initcol(C_DARKCYAN, 0, 500, 500);
initcol(C_DARKBLUE, 0, 0, 500);
initcol(C_DARKMAGENTA, 500, 0, 500);
initcol(C_DARKGREEN, 0, 500, 0);
initcol(C_ORANGE, 992, 468, 196);
initcol(C_DARKGREY, 360, 360, 360);
initcol(C_VDARKGREY, 150, 150, 150);
initcol(C_DARKBROWN, 384, 244, 64);
initcol(C_DARKYELLOW, 650, 650, 0);
initcol(C_DARKRED, 500, 0, 0);
// light cols
initcol(C_LIGHTRED, 1000, 500, 500);
initcol(C_LIGHTBLUE, 500, 500, 1000);
initcol(C_LIGHTBROWN, 784, 644, 464);
initcol(C_LIGHTCYAN, 500, 1000, 1000);
initcol(C_LIGHTGREEN, 500, 1000, 500);
initcol(C_LIGHTMAGENTA, 1000, 500, 1000);
initcol(C_LIGHTYELLOW, 1000, 1000, 500);
// 0 through 15 // placeholder
init_pair(C_BLACK, COLOR_BLACK, COLOR_BLACK); initcol(C_LAST, 0, 0, 0);
init_pair(C_RED, COLOR_RED, COLOR_BLACK);
init_pair(C_GREEN, COLOR_GREEN, COLOR_BLACK);
init_pair(C_BROWN, COLOR_YELLOW, COLOR_BLACK);
init_pair(C_YELLOW, COLOR_YELLOW, COLOR_BLACK);
init_pair(C_BLUE, COLOR_BLUE, COLOR_BLACK);
init_pair(C_MAGENTA, COLOR_MAGENTA, COLOR_BLACK);
init_pair(C_CYAN, COLOR_CYAN, COLOR_BLACK);
init_pair(C_GREY, COLOR_WHITE, COLOR_BLACK);
init_pair(C_YELLOW, COLOR_YELLOW, COLOR_BLACK);
init_pair(C_WHITE, COLOR_WHITE, COLOR_BLACK);
init_pair(C_BOLDCYAN, COLOR_CYAN, COLOR_BLACK);
init_pair(C_BOLDBLUE, COLOR_BLUE, COLOR_BLACK);
init_pair(C_BOLDMAGENTA, COLOR_MAGENTA, COLOR_BLACK);
init_pair(C_BOLDGREEN, COLOR_GREEN, COLOR_BLACK);
init_pair(C_ORANGE, COLOR_RED, COLOR_BLACK);
init_pair(C_DARKGREY, COLOR_BLACK, COLOR_BLACK);
// 16 through 31 for (i = C_RED; i <= C_LAST; i++) {
init_pair(BLUEBG+C_BLACK, COLOR_BLACK, COLOR_BLUE); initcolpair(i, i, C_BLACK);
init_pair(BLUEBG+C_RED, COLOR_RED, COLOR_BLUE); init_pair(i+BLUEBG, i, COLOR_BLUE);
init_pair(BLUEBG+C_GREEN, COLOR_GREEN, COLOR_BLUE); init_pair(i+GREENBG, i, COLOR_GREEN);
init_pair(BLUEBG+C_BROWN, COLOR_YELLOW, COLOR_BLUE); init_pair(i+REDBG, i, COLOR_RED);
init_pair(BLUEBG+C_YELLOW, COLOR_YELLOW, COLOR_BLUE); }
init_pair(BLUEBG+C_BLUE, COLOR_BLUE, COLOR_BLUE);
init_pair(BLUEBG+C_MAGENTA, COLOR_MAGENTA, COLOR_BLUE);
init_pair(BLUEBG+C_CYAN, COLOR_CYAN, COLOR_BLUE);
init_pair(BLUEBG+C_GREY, COLOR_WHITE, COLOR_BLUE);
init_pair(BLUEBG+C_YELLOW, COLOR_YELLOW, COLOR_BLUE);
init_pair(BLUEBG+C_WHITE, COLOR_WHITE, COLOR_BLUE);
init_pair(BLUEBG+C_BOLDCYAN, COLOR_CYAN, COLOR_BLUE);
init_pair(BLUEBG+C_BOLDBLUE, COLOR_BLUE, COLOR_BLUE);
init_pair(BLUEBG+C_BOLDMAGENTA, COLOR_MAGENTA, COLOR_BLUE);
init_pair(BLUEBG+C_BOLDGREEN, COLOR_GREEN, COLOR_BLUE);
init_pair(BLUEBG+C_ORANGE, COLOR_RED, COLOR_BLUE);
// 32 through 47 color_content(C_WHITE,&r,&g,&b);
init_pair(GREENBG+C_BLACK, COLOR_BLACK, COLOR_GREEN); dblog("white is %d,%d,%d",r,g,b);
init_pair(GREENBG+C_RED, COLOR_RED, COLOR_GREEN);
init_pair(GREENBG+C_GREEN, COLOR_GREEN, COLOR_GREEN);
init_pair(GREENBG+C_BROWN, COLOR_YELLOW, COLOR_GREEN);
init_pair(GREENBG+C_YELLOW, COLOR_YELLOW, COLOR_GREEN);
init_pair(GREENBG+C_BLUE, COLOR_BLUE, COLOR_GREEN);
init_pair(GREENBG+C_MAGENTA, COLOR_MAGENTA, COLOR_GREEN);
init_pair(GREENBG+C_CYAN, COLOR_CYAN, COLOR_GREEN);
init_pair(GREENBG+C_GREY, COLOR_WHITE, COLOR_GREEN);
init_pair(GREENBG+C_YELLOW, COLOR_YELLOW, COLOR_GREEN);
init_pair(GREENBG+C_WHITE, COLOR_WHITE, COLOR_GREEN);
init_pair(GREENBG+C_BOLDCYAN, COLOR_CYAN, COLOR_GREEN);
init_pair(GREENBG+C_BOLDBLUE, COLOR_BLUE, COLOR_GREEN);
init_pair(GREENBG+C_BOLDMAGENTA, COLOR_MAGENTA, COLOR_GREEN);
init_pair(GREENBG+C_BOLDGREEN, COLOR_GREEN, 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
@ -9763,6 +9784,28 @@ int drop(object_t *o, int count) {
return B_FALSE; return B_FALSE;
} }
void dumpcols(void) {
int i;
int margin = 0;
int x = 0,y = 0;
char buf[BUFLEN];
cls();
for (i = C_BLACK; i < C_LAST; i++) {
wmove(mainwin, y, x);
sprintf(buf, "^%d %d. This is %s^n\n",i,i,getcolname(i));
textwithcol(mainwin, buf);
y++; x = margin;
if (y >= 18) {
y = 0;
margin = 40;
x = margin;
}
}
getch();
restoregamewindows();
}
void dumpskills(void) { void dumpskills(void) {
skill_t *sk; skill_t *sk;
char buf[BUFLEN],thisline[BUFLEN]; char buf[BUFLEN],thisline[BUFLEN];
@ -9884,15 +9927,15 @@ void forceredraw(void) {
enum COLOUR getattrcolour(enum ATTRBRACKET brack) { enum COLOUR getattrcolour(enum ATTRBRACKET brack) {
switch (brack) { switch (brack) {
case AT_EXLOW: return C_BOLDMAGENTA; case AT_EXLOW: return C_LIGHTMAGENTA;
case AT_VLOW: return C_MAGENTA; case AT_VLOW: return C_MAGENTA;
case AT_LOW: return C_RED; case AT_LOW: return C_RED;
case AT_LTAVERAGE: return C_BROWN; case AT_LTAVERAGE: return C_DARKYELLOW;
case AT_AVERAGE: return C_GREY; case AT_AVERAGE: return C_GREY;
case AT_GTAVERAGE: return C_GREEN; case AT_GTAVERAGE: return C_GREEN;
case AT_HIGH: return C_BLUE; case AT_HIGH: return C_BLUE;
case AT_VHIGH: return C_CYAN; case AT_VHIGH: return C_CYAN;
case AT_EXHIGH: return C_BOLDCYAN; case AT_EXHIGH: return C_LIGHTCYAN;
default: default:
break; break;
} }
@ -10149,10 +10192,10 @@ char getchoicestr(prompt_t *prompt, int useshortcuts, int showallatstart) {
} }
// only print if we're not off the bottom // only print if we're not off the bottom
if ((i >= first) && !atbottom) { if ((i >= first) && !atbottom) {
if (nvalid && !foundfirstvalid) setcol(mainwin, C_BOLDGREEN); if (nvalid && !foundfirstvalid) setcol(mainwin, C_LIGHTGREEN);
mvwprintw(mainwin, y, 0, "%s%s", indenttext, prompt->choice[i].desc); mvwprintw(mainwin, y, 0, "%s%s", indenttext, prompt->choice[i].desc);
y++; y++;
if (nvalid && !foundfirstvalid) unsetcol(mainwin, C_BOLDGREEN); if (nvalid && !foundfirstvalid) unsetcol(mainwin, C_LIGHTGREEN);
foundfirstvalid = B_TRUE; foundfirstvalid = B_TRUE;
} }
@ -11074,10 +11117,10 @@ int needsbold(enum COLOUR col) {
switch (col) { switch (col) {
case C_YELLOW: case C_YELLOW:
case C_WHITE: case C_WHITE:
case C_BOLDCYAN: case C_LIGHTCYAN:
case C_BOLDBLUE: case C_LIGHTBLUE:
case C_BOLDMAGENTA: case C_LIGHTMAGENTA:
case C_BOLDGREEN: case C_LIGHTGREEN:
case C_ORANGE: case C_ORANGE:
case C_DARKGREY: case C_DARKGREY:
return B_TRUE; return B_TRUE;
@ -11190,18 +11233,18 @@ void drawstatus(void) {
if (lfhasflag(player, F_HASNEWLEVEL)) { if (lfhasflag(player, F_HASNEWLEVEL)) {
wattron(statwin, A_BOLD); wprintw(statwin, "/"); wattroff(statwin, A_BOLD); wattron(statwin, A_BOLD); wprintw(statwin, "/"); wattroff(statwin, A_BOLD);
setcol(statwin, C_BOLDGREEN); setcol(statwin, C_LIGHTGREEN);
wprintw(statwin, "LevUp",xpleft); wprintw(statwin, "LevUp",xpleft);
unsetcol(statwin, C_BOLDGREEN); unsetcol(statwin, C_LIGHTGREEN);
} else { } else {
wattron(statwin, A_BOLD); wprintw(statwin, "/"); wattroff(statwin, A_BOLD); wattron(statwin, A_BOLD); wprintw(statwin, "/"); wattroff(statwin, A_BOLD);
wprintw(statwin, "%d%%",xpleft); wprintw(statwin, "%d%%",xpleft);
} }
wattron(statwin, A_BOLD); wprintw(statwin, " Trn:"); wattroff(statwin, A_BOLD); wattron(statwin, A_BOLD); wprintw(statwin, " Trn:"); wattroff(statwin, A_BOLD);
if (player->skillpoints > 0) setcol(statwin, C_BOLDGREEN); if (player->skillpoints > 0) setcol(statwin, C_LIGHTGREEN);
wprintw(statwin, "%d", player->skillpoints); wprintw(statwin, "%d", player->skillpoints);
if (player->skillpoints > 0) unsetcol(statwin, C_BOLDGREEN); if (player->skillpoints > 0) unsetcol(statwin, C_LIGHTGREEN);
wprintw(statwin, "/%d%% ", (int) ((float)player->skillxp / (float)getspforpoint(player) * 100.0) ); wprintw(statwin, "/%d%% ", (int) ((float)player->skillxp / (float)getspforpoint(player) * 100.0) );
@ -11223,9 +11266,9 @@ void drawstatus(void) {
unsetcol(statwin, C_RED); unsetcol(statwin, C_RED);
} }
if (lfhasflag(player, F_GRAVLESSENED)) { if (lfhasflag(player, F_GRAVLESSENED)) {
setcol(statwin, C_BOLDBLUE); setcol(statwin, C_LIGHTBLUE);
wprintw(statwin, " LoGrv"); wprintw(statwin, " LoGrv");
unsetcol(statwin, C_BOLDBLUE); unsetcol(statwin, C_LIGHTBLUE);
} }
if (lfhasflag(player, F_RAGE)) { if (lfhasflag(player, F_RAGE)) {
@ -11235,29 +11278,29 @@ void drawstatus(void) {
} }
if (isswimming(player)) { if (isswimming(player)) {
setcol(statwin, C_BOLDBLUE); setcol(statwin, C_LIGHTBLUE);
wprintw(statwin, " Swim"); wprintw(statwin, " Swim");
unsetcol(statwin, C_BOLDBLUE); unsetcol(statwin, C_LIGHTBLUE);
} }
if (isclimbing(player)) { if (isclimbing(player)) {
setcol(statwin, C_BOLDBLUE); setcol(statwin, C_LIGHTBLUE);
wprintw(statwin, " Climb"); wprintw(statwin, " Climb");
unsetcol(statwin, C_BOLDBLUE); unsetcol(statwin, C_LIGHTBLUE);
} }
if (isairborne(player, &height)) { if (isairborne(player, &height)) {
if (lfhasflag(player, F_FLYING)) { if (lfhasflag(player, F_FLYING)) {
setcol(statwin, C_BOLDBLUE); setcol(statwin, C_LIGHTBLUE);
wprintw(statwin, " Fly:%d",height); wprintw(statwin, " Fly:%d",height);
unsetcol(statwin, C_BOLDBLUE); unsetcol(statwin, C_LIGHTBLUE);
} else if (lfhasflag(player, F_LEVITATING)) { } else if (lfhasflag(player, F_LEVITATING)) {
setcol(statwin, C_BOLDBLUE); setcol(statwin, C_LIGHTBLUE);
wprintw(statwin, " Lev"); wprintw(statwin, " Lev");
unsetcol(statwin, C_BOLDBLUE); unsetcol(statwin, C_LIGHTBLUE);
} else { } else {
setcol(statwin, C_BOLDBLUE); setcol(statwin, C_LIGHTBLUE);
wprintw(statwin, " Hov"); // "hov"ering wprintw(statwin, " Hov"); // "hov"ering
unsetcol(statwin, C_BOLDBLUE); unsetcol(statwin, C_LIGHTBLUE);
} }
} }
@ -11347,13 +11390,12 @@ void drawstatus(void) {
} }
} }
// burdened somehow? // burdened somehow?
switch (isburdened(player)) { switch (isburdened(player)) {
case BR_BURDENED: case BR_BURDENED:
setcol(statwin, C_BROWN); setcol(statwin, C_DARKYELLOW);
wprintw(statwin, " Burdened"); wprintw(statwin, " Burdened");
unsetcol(statwin, C_BROWN); unsetcol(statwin, C_DARKYELLOW);
break; break;
case BR_STRAINED: case BR_STRAINED:
setcol(statwin, C_RED); setcol(statwin, C_RED);
@ -11369,7 +11411,6 @@ void drawstatus(void) {
break; break;
} }
if (lfhasflag(player, F_PAIN)) { if (lfhasflag(player, F_PAIN)) {
setcol(statwin, C_YELLOW); setcol(statwin, C_YELLOW);
wprintw(statwin, " Pain"); wprintw(statwin, " Pain");
@ -11383,10 +11424,10 @@ void drawstatus(void) {
strcpy(dstring, getdrunktext(f)); strcpy(dstring, getdrunktext(f));
capitalise(dstring); capitalise(dstring);
setcol(statwin, C_BROWN); setcol(statwin, C_DARKYELLOW);
//wprintw(statwin, " %s(%d)", dstring,f->lifetime); //wprintw(statwin, " %s(%d)", dstring,f->lifetime);
wprintw(statwin, " %s", dstring); wprintw(statwin, " %s", dstring);
unsetcol(statwin, C_BROWN); unsetcol(statwin, C_DARKYELLOW);
} }
f = ispoisoned(player); f = ispoisoned(player);
@ -11404,9 +11445,9 @@ void drawstatus(void) {
wprintw(statwin, " %s(bad)", pt->desc); wprintw(statwin, " %s(bad)", pt->desc);
unsetcol(statwin, C_RED); unsetcol(statwin, C_RED);
} else { } else {
setcol(statwin, C_BROWN); setcol(statwin, C_DARKYELLOW);
wprintw(statwin, " %s(mild)", pt->desc); wprintw(statwin, " %s(mild)", pt->desc);
unsetcol(statwin, C_BROWN); unsetcol(statwin, C_DARKYELLOW);
} }
} else { } else {
setcol(statwin, C_RED); setcol(statwin, C_RED);
@ -11428,10 +11469,10 @@ void drawstatus(void) {
capitalise(buf2); capitalise(buf2);
} }
if (hlev == H_STARVING) setcol(statwin, C_RED); if (hlev == H_STARVING) setcol(statwin, C_RED);
else setcol(statwin, C_BROWN); else setcol(statwin, C_DARKYELLOW);
wprintw(statwin, " %s", buf2); wprintw(statwin, " %s", buf2);
if (hlev == H_STARVING) unsetcol(statwin, C_RED); if (hlev == H_STARVING) unsetcol(statwin, C_RED);
else unsetcol(statwin, C_BROWN); else unsetcol(statwin, C_DARKYELLOW);
} }
@ -11465,6 +11506,29 @@ void drawstatus(void) {
*/ */
switch (getlftemp(player)) {
case T_VCOLD:
setcol(statwin, C_MAGENTA); wprintw(statwin, " V.Cold"); unsetcol(statwin, C_MAGENTA);
break;
case T_COLD:
setcol(statwin, C_RED); wprintw(statwin, " Cold"); unsetcol(statwin, C_RED);
break;
case T_CHILLY:
setcol(statwin, C_YELLOW); wprintw(statwin, " Chilly"); unsetcol(statwin, C_YELLOW);
break;
case T_NORMAL:
break;
case T_WARM:
setcol(statwin, C_YELLOW); wprintw(statwin, " Warm"); unsetcol(statwin, C_YELLOW);
break;
case T_HOT:
setcol(statwin, C_YELLOW); wprintw(statwin, " Hot"); unsetcol(statwin, C_YELLOW);
break;
case T_VHOT:
setcol(statwin, C_MAGENTA); wprintw(statwin, " V.Hot"); unsetcol(statwin, C_MAGENTA);
break;
}
f = hasflag(player->flags, F_AUTOCMD); f = hasflag(player->flags, F_AUTOCMD);
if (f) { if (f) {
if (strlen(waitbuf)) strcat(waitbuf, ", "); if (strlen(waitbuf)) strcat(waitbuf, ", ");
@ -11503,11 +11567,14 @@ void drawstatus(void) {
} }
//wprintw(statwin, "DLev:%d", player->cell->map->depth); //wprintw(statwin, "DLev:%d", player->cell->map->depth);
setcol(statwin, C_BROWN); //setcol(statwin, C_DARKYELLOW);
// ooooooooooooo fix.
setcol(statwin, C_WHITE);
getregionname(buf, player->cell->map, NULL, RF_WITHLEVEL); getregionname(buf, player->cell->map, NULL, RF_WITHLEVEL);
capitalise(buf); capitalise(buf);
wprintw(statwin, "%s", buf); wprintw(statwin, "%s", buf);
unsetcol(statwin, C_BROWN); //unsetcol(statwin, C_DARKYELLOW);
unsetcol(statwin, C_WHITE);
} }
@ -11616,19 +11683,23 @@ void select_new_spell(enum SPELLSCHOOL ss) {
} }
void setcol(WINDOW *win, enum COLOUR col) { void setcol(WINDOW *win, enum COLOUR col) {
/*
if (needsbold(col)) { if (needsbold(col)) {
wattron(win, A_BOLD); wattron(win, A_BOLD);
} else { } else {
wattroff(win, A_BOLD); wattroff(win, A_BOLD);
} }
*/
wattron(win, COLOR_PAIR(col)); wattron(win, COLOR_PAIR(col));
} }
void unsetcol(WINDOW *win, enum COLOUR col) { void unsetcol(WINDOW *win, enum COLOUR col) {
wattroff(win, COLOR_PAIR(col)); wattroff(win, COLOR_PAIR(col));
/*
if (needsbold(col)) { if (needsbold(col)) {
wattroff(win, A_BOLD); wattroff(win, A_BOLD);
} }
*/
} }
void setobcolour(WINDOW *win, object_t *o, int set) { void setobcolour(WINDOW *win, object_t *o, int set) {
@ -11669,7 +11740,7 @@ void setobcolour(WINDOW *win, object_t *o, int set) {
return; return;
} }
if (lfhasflag(player, F_DETECTMAGIC) && ismagical(o)) { if (lfhasflag(player, F_DETECTMAGIC) && ismagical(o)) {
funcptr(win, C_BOLDGREEN); funcptr(win, C_LIGHTGREEN);
return; return;
} }
@ -11686,7 +11757,7 @@ int showhiscoreline(void *hilitescore, int ncols, char **argv, char **colname) {
else if (streq(colname[i], "job")) job = strdup(argv[i]); else if (streq(colname[i], "job")) job = strdup(argv[i]);
else if (streq(colname[i], "killedby")) killer = strdup(argv[i]); else if (streq(colname[i], "killedby")) killer = strdup(argv[i]);
} }
if (streq(score, (char *)hilitescore)) setcol(mainwin, C_BOLDGREEN); if (streq(score, (char *)hilitescore)) setcol(mainwin, C_LIGHTGREEN);
wprintw(mainwin, HISCOREFORMAT, rank, score, name, job); wprintw(mainwin, HISCOREFORMAT, rank, score, name, job);
// last field should be wrapped with lines 2+ indented // last field should be wrapped with lines 2+ indented
@ -11694,7 +11765,7 @@ int showhiscoreline(void *hilitescore, int ncols, char **argv, char **colname) {
origy = y; origy = y;
wrapprint(mainwin, &y, &x, x, "%s", killer); wrapprint(mainwin, &y, &x, x, "%s", killer);
if (streq(score, (char *)hilitescore)) unsetcol(mainwin, C_BOLDGREEN); if (streq(score, (char *)hilitescore)) unsetcol(mainwin, C_LIGHTGREEN);
if (y == origy) { if (y == origy) {
wprintw(mainwin, "\n\n"); wprintw(mainwin, "\n\n");
@ -11869,7 +11940,7 @@ void showlfstats(lifeform_t *lf, int showall) {
} else if (lorelev == PR_MASTER) { } else if (lorelev == PR_MASTER) {
lorecol = C_GREY; // ie. no colour lorecol = C_GREY; // ie. no colour
} else { } else {
lorecol = C_BROWN; lorecol = C_DARKYELLOW;
} }
// override showall sometimes... // override showall sometimes...
@ -11909,6 +11980,9 @@ void showlfstats(lifeform_t *lf, int showall) {
y = 0; y = 0;
ch = '\0'; ch = '\0';
if (mode == '@') { if (mode == '@') {
int temp,ctemp;
getcelltemp(lf->cell, &ctemp);
temp = getlftemp(lf);
wattron(mainwin, A_UNDERLINE); wattron(mainwin, A_UNDERLINE);
if (isplayer(lf)) { if (isplayer(lf)) {
centre(mainwin, C_WHITE, 0, "CHARACTER DETAILS"); centre(mainwin, C_WHITE, 0, "CHARACTER DETAILS");
@ -12822,6 +12896,14 @@ void showlfstats(lifeform_t *lf, int showall) {
wrapprint(mainwin, &y, &x, 0, "%s %s made out of %s. ",you(lf), is(lf), mt->name); wrapprint(mainwin, &y, &x, 0, "%s %s made out of %s. ",you(lf), is(lf), mt->name);
} }
if (temp != T_NORMAL) {
if (isplayer(lf)) {
wrapprint(mainwin, &y, &x, 0, "You are feeling %s (%d degrees).", gettemperaturename(temp),ctemp);
} else if (lorelev >= PR_BEGINNER) {
wrapprint(mainwin, &y, &x, 0, "%s looks %s.", gettemperaturename(temp));
}
}
if ((y == starty) && (x == startx)) { if ((y == starty) && (x == startx)) {
wrapprint(mainwin, &y, &x, 0, "Nothing obvious."); wrapprint(mainwin, &y, &x, 0, "Nothing obvious.");
} }
@ -13674,9 +13756,18 @@ void showlfstats(lifeform_t *lf, int showall) {
} }
f = hasflag_real(lf->flags, F_DODGES, B_TRUE, NULL, FROMRACE); f = hasflag_real(lf->flags, F_DODGES, B_TRUE, NULL, FROMRACE);
if (f) { if (f) {
mvwprintw(mainwin, y, 0, "%s will automatically use your remaining stamina to dodge fatal attacks.", you(lf)); mvwprintw(mainwin, y, 0, "%s will automatically use %s remaining stamina to dodge fatal attacks.", you(lf), your(lf));
y++; y++;
} }
getflags(lf->flags, retflag, &nretflags, F_LEARNBOOST, F_NONE);
for (i = 0; i < nretflags; i++) {
f = retflag[i];
if (f && f->known) {
mvwprintw(mainwin, y, 0, "%s have a %d%% %s to earned experience points.", you(lf),
f->val[0], (f->val[0] > 0) ? "bonus" : "penalty");
y++;
}
}
f = lfhasknownflag(lf, F_MAGICARMOUR); f = lfhasknownflag(lf, F_MAGICARMOUR);
if (f && (f->known)) { if (f && (f->known)) {
@ -13705,6 +13796,12 @@ void showlfstats(lifeform_t *lf, int showall) {
isplayer(lf) ? "your" : "its", boost); isplayer(lf) ? "your" : "its", boost);
y++; y++;
} }
f = lfhasknownflag(lf, F_MINCRITCHANCE);
if (f && (f->known)) {
mvwprintw(mainwin, y, 0, "%s attacks are guided by the gods, granting a minimum %d%% criticial hit chance.",
your(lf), f->val[0]);
y++;
}
f = lfhasknownflag(lf, F_MINDSHIELD); f = lfhasknownflag(lf, F_MINDSHIELD);
if (f && (f->known)) { if (f && (f->known)) {
mvwprintw(mainwin, y, 0, "%s are protected from psionic attacks.", you(lf)); mvwprintw(mainwin, y, 0, "%s are protected from psionic attacks.", you(lf));
@ -14204,10 +14301,10 @@ void showlfstats(lifeform_t *lf, int showall) {
case C_ORANGE: strcpy(colbuf, "^T"); break; case C_ORANGE: strcpy(colbuf, "^T"); break;
case C_RED: strcpy(colbuf, "^B"); break; case C_RED: strcpy(colbuf, "^B"); break;
case C_YELLOW: strcpy(colbuf, "^w"); break; case C_YELLOW: strcpy(colbuf, "^w"); break;
case C_BROWN: strcpy(colbuf, "^b"); break; case C_DARKYELLOW: strcpy(colbuf, "^b"); break;
case C_GREEN: strcpy(colbuf, "^g"); break; case C_GREEN: strcpy(colbuf, "^g"); break;
case C_BOLDGREEN: strcpy(colbuf, "^G"); break; case C_LIGHTGREEN: strcpy(colbuf, "^G"); break;
case C_BOLDCYAN: strcpy(colbuf, "^E"); break; case C_LIGHTCYAN: strcpy(colbuf, "^E"); break;
default: case C_GREY: strcpy(colbuf, "^n"); break; default: case C_GREY: strcpy(colbuf, "^n"); break;
} }
@ -14457,9 +14554,9 @@ void tombstone(lifeform_t *lf) {
minrank = 1; minrank = 1;
maxrank = 10; maxrank = 10;
} else { } else {
setcol(mainwin, C_BOLDGREEN); setcol(mainwin, C_LIGHTGREEN);
mvwprintw(mainwin, y, 0, "You made rank #%d on the high score table!", rank); y++; mvwprintw(mainwin, y, 0, "You made rank #%d on the high score table!", rank); y++;
unsetcol(mainwin, C_BOLDGREEN); unsetcol(mainwin, C_LIGHTGREEN);
minrank = rank - 4; minrank = rank - 4;
maxrank = rank + 4; maxrank = rank + 4;
limit(&minrank, 0, NA); limit(&minrank, 0, NA);

3
io.h
View File

@ -94,6 +94,7 @@ void drawstatus(void);
int drop(object_t *o, int count); int drop(object_t *o, int count);
void dumpbuildingusage(void); void dumpbuildingusage(void);
void dumpoc(void); void dumpoc(void);
void dumpcols(void);
void dumpskills(void); void dumpskills(void);
void dumpspells(void); void dumpspells(void);
void dumpweps(void); void dumpweps(void);
@ -109,6 +110,8 @@ int haschoice(prompt_t *p, char ch);
choice_t *haschoicedata(prompt_t *p, void *data); choice_t *haschoicedata(prompt_t *p, void *data);
void doheading(WINDOW *win, int *y, int x, char *what); void doheading(WINDOW *win, int *y, int x, char *what);
void doheadingsmall(WINDOW *win, int y, int x, char *format, char *heading); void doheadingsmall(WINDOW *win, int y, int x, char *format, char *heading);
void initcol(short c, short r, short g, short b);
void initcolpair(int pairidx, enum COLOUR fg, enum COLOUR bg );
void initgfx(void); void initgfx(void);
void initprompt(prompt_t *p, char *q1); void initprompt(prompt_t *p, char *q1);
int keycodetokey(int keycode, int escseqok); int keycodetokey(int keycode, int escseqok);

220
lf.c
View File

@ -8331,11 +8331,11 @@ int gethppct(lifeform_t *lf) {
enum COLOUR gethungercol(enum HUNGER hlev) { enum COLOUR gethungercol(enum HUNGER hlev) {
enum COLOUR col = C_GREY; enum COLOUR col = C_GREY;
switch (hlev) { switch (hlev) {
case H_STUFFED: col = C_BOLDBLUE; break; case H_STUFFED: col = C_LIGHTBLUE; break;
case H_FULL: col = C_BOLDGREEN; break; case H_FULL: col = C_LIGHTGREEN; break;
case H_NONE: col = C_GREEN; break; case H_NONE: col = C_GREEN; break;
case H_PECKISH: col = C_GREY; break; case H_PECKISH: col = C_GREY; break;
case H_HUNGRY: col = C_BROWN; break; case H_HUNGRY: col = C_DARKYELLOW; break;
case H_VHUNGRY: col = C_YELLOW; break; case H_VHUNGRY: col = C_YELLOW; break;
default: case H_STARVING: col = C_RED; break; default: case H_STARVING: col = C_RED; break;
} }
@ -8510,6 +8510,7 @@ int getlfaccuracy(lifeform_t *lf, object_t *wep) {
flag_t *retflag[MAXCANDIDATES]; flag_t *retflag[MAXCANDIDATES];
int nretflags; int nretflags;
int unarmed = B_FALSE; int unarmed = B_FALSE;
enum TEMPERATURE temp;
// get weapon // get weapon
if (wep) { if (wep) {
@ -8605,6 +8606,22 @@ int getlfaccuracy(lifeform_t *lf, object_t *wep) {
} }
} }
// cold = less accuracy
temp = getlftemp(lf);
switch (temp) {
case T_CHILLY:
acc -= (getexposedlimbs(lf)*2);
break;
case T_COLD:
acc -= (getexposedlimbs(lf)*3);
break;
case T_VCOLD:
acc -= (getexposedlimbs(lf)*4);
break;
default: break;
}
// day/night boosts // day/night boosts
if (isnighttime()) { if (isnighttime()) {
f = lfhasflag(lf, F_NIGHTBOOST); f = lfhasflag(lf, F_NIGHTBOOST);
@ -8736,6 +8753,38 @@ enum LFCONDITION getlfcondition(lifeform_t *lf) {
return C_DEAD; return C_DEAD;
} }
enum TEMPERATURE getlftemp(lifeform_t *lf) {
int temp;
enum TEMPERATURE brack;
// start with cell temperature
brack = getcelltemp(lf->cell, &temp);
// cold?
if (brack < T_NORMAL) {
// adjust for warm/cold blood
if (lfhasflag(lf, F_COLDBLOOD)) {
brack = T_NORMAL;
} else if (isimmuneto(lf->flags, DT_COLD, B_FALSE)) {
brack = T_NORMAL;
} else if (isresistantto(lf->flags, DT_COLD, B_FALSE)) {
brack++; // one bracket higher
} else if (isvulnto(lf->flags, DT_COLD, B_FALSE) && (brack > T_VCOLD)) {
brack--; // one bracket lower
}
} else if (brack > T_NORMAL) {
// adjust for warm/cold blood
if (lfhasflag(lf, F_COLDBLOOD) && (brack < T_VHOT)) {
brack++;
} else if (isimmuneto(lf->flags, DT_FIRE, B_FALSE)) {
brack = T_NORMAL;
} else if (isresistantto(lf->flags, DT_FIRE, B_FALSE)) {
brack--; // one bracket lower
} else if (isvulnto(lf->flags, DT_FIRE, B_FALSE) && (brack < T_VHOT)) {
brack++; // one bracket higher
}
}
return brack;
}
// returns a value representing 'lf's height off the ground. // returns a value representing 'lf's height off the ground.
// higher value means higher // higher value means higher
int getfeetheight(lifeform_t *lf) { int getfeetheight(lifeform_t *lf) {
@ -13230,7 +13279,6 @@ int injure(lifeform_t *lf, enum BODYPART where, enum DAMTYPE damtype, enum INJUR
} }
} }
return B_FALSE; return B_FALSE;
} }
@ -13253,6 +13301,9 @@ int lfcanbekod(lifeform_t *lf) {
if (isdead(lf)) { if (isdead(lf)) {
return B_FALSE; return B_FALSE;
} }
if (lfhasflag(lf, F_NOKO)) {
return B_FALSE;
}
// note: not checking whether they are already unconscious // note: not checking whether they are already unconscious
// because merciful weapons CAN still KO them in this case. // because merciful weapons CAN still KO them in this case.
return B_TRUE; return B_TRUE;
@ -16439,7 +16490,7 @@ int losehp_real(lifeform_t *lf, int amt, enum DAMTYPE damtype, lifeform_t *froml
killflagsofid(lf->flags, F_HIDING); killflagsofid(lf->flags, F_HIDING);
// methods of knocking unconscious // methods of knocking unconscious
if (!lfcanbekod(lf)) { if (lfcanbekod(lf)) {
// merciful weapons - these will ALWAYS ko, even if // merciful weapons - these will ALWAYS ko, even if
// they are already unconscious. // they are already unconscious.
if (!ko && fromob) { if (!ko && fromob) {
@ -17600,6 +17651,7 @@ void modmorale(lifeform_t *lf, int howmuch) {
void modstamina(lifeform_t *lf, float howmuch) { void modstamina(lifeform_t *lf, float howmuch) {
float orig; float orig;
enum TEMPERATURE temp;
if (howmuch == 0) return; if (howmuch == 0) return;
@ -17613,6 +17665,15 @@ void modstamina(lifeform_t *lf, float howmuch) {
if (lfhasflag(lf, F_RAGE) && (howmuch < 0)) return; if (lfhasflag(lf, F_RAGE) && (howmuch < 0)) return;
if (lfhasflag(lf, F_CAFFEINATED) && (howmuch < 0)) return; if (lfhasflag(lf, F_CAFFEINATED) && (howmuch < 0)) return;
// hot = use stamina more quickly
temp = getlftemp(lf);
switch (temp) {
case T_WARM: howmuch = pctof(150,howmuch); break;
case T_HOT: howmuch = pctof(200,howmuch); break;
case T_VHOT: howmuch = pctof(250,howmuch); break;
default: break;
}
if (isplayer(lf)) { if (isplayer(lf)) {
if (howmuch < 0) { if (howmuch < 0) {
if (lf->bartimer == 2) { if (lf->bartimer == 2) {
@ -17629,26 +17690,28 @@ void modstamina(lifeform_t *lf, float howmuch) {
orig = getstamina(lf); orig = getstamina(lf);
lf->stamina += howmuch; lf->stamina += howmuch;
limitf(&(lf->stamina), 0, getmaxstamina(lf)); limitf(&(lf->stamina), 0, getmaxstamina(lf));
if (getstamina(lf) != orig) { if (gamemode == GM_GAMESTARTED) {
if (isplayer(lf)) { if (getstamina(lf) != orig) {
statdirty = B_TRUE; if (isplayer(lf)) {
drawstatus(); statdirty = B_TRUE;
updatestatus(); drawstatus();
if (isexhausted(lf)) { updatestatus();
msg("^BYou are exhausted."); if (isexhausted(lf)) {
} else if (orig == 0) { msg("^BYou are exhausted.");
msg("You feel less exhausted now."); } else if (orig == 0) {
msg("You feel less exhausted now.");
}
} else if (cansee(player, lf)) {
if (isexhausted(lf)) {
char lfname[BUFLEN];
char *p;
getlfname(lf, lfname);
p = strdup(lfname);
strrep(&p, "exhausted ","", NULL);
msg("%s looks exhausted.", p);
free(p);
}
} }
} else if (cansee(player, lf)) {
if (isexhausted(lf)) {
char lfname[BUFLEN];
char *p;
getlfname(lf, lfname);
p = strdup(lfname);
strrep(&p, "exhausted ","", NULL);
msg("%s looks exhausted.", p);
free(p);
}
} }
} }
@ -20829,6 +20892,24 @@ int canshoot(lifeform_t *lf, enum ERROR *why) {
return B_TRUE; return B_TRUE;
} }
void shiver(lifeform_t *lf) {
object_t *wep;
if (isplayer(lf)) {
msg("^bYou shiver uncontrollably.");
} else if (cansee(player, lf)) {
char lfname[BUFLEN];
getlfname(lf, lfname);
msg("^%c%s shivers.", getlfcol(lf, CC_BAD), lfname);
}
wep = getweapon(lf);
if (wep) {
char wname[BUFLEN];
getobname(wep, wname, 1);
drop(wep, wep->amt);
}
loseconcentration(lf);
}
int shoot(lifeform_t *lf) { int shoot(lifeform_t *lf) {
object_t *gun,*ammo; object_t *gun,*ammo;
lifeform_t *targ; lifeform_t *targ;
@ -21665,6 +21746,9 @@ void startlfturn(lifeform_t *lf) {
object_t *bloodamu = NULL; object_t *bloodamu = NULL;
enum TIMEPHASE tp; enum TIMEPHASE tp;
enum FLAG inair = F_NONE; enum FLAG inair = F_NONE;
enum TEMPERATURE temp;
int meltchance = 25,meltdam = 1;
tp = gettimephase(); tp = gettimephase();
map = lf->cell->map; map = lf->cell->map;
@ -22617,6 +22701,7 @@ void startlfturn(lifeform_t *lf) {
} }
} }
// poison effects
if (!stasis) { if (!stasis) {
getflags(lf->flags, retflag, &nretflags, F_POISONED, F_NONE); getflags(lf->flags, retflag, &nretflags, F_POISONED, F_NONE);
for (i = 0; i < nretflags; i++) { for (i = 0; i < nretflags; i++) {
@ -22757,21 +22842,7 @@ void startlfturn(lifeform_t *lf) {
// extra effects // extra effects
if (!ko && (f->val[0] == P_COLD)) { if (!ko && (f->val[0] == P_COLD)) {
if (rnd(1,100) <= 10) { if (rnd(1,100) <= 10) {
object_t *wep; shiver(lf);
if (isplayer(lf)) {
msg("^bYou shiver uncontrollably.");
} else if (cansee(player, lf)) {
char lfname[BUFLEN];
getlfname(lf, lfname);
msg("^%c%s shivers.", getlfcol(lf, CC_BAD), lfname);
}
wep = getweapon(lf);
if (wep) {
char wname[BUFLEN];
getobname(wep, wname, 1);
drop(wep, wep->amt);
}
loseconcentration(lf);
} }
} else if (f->val[0] == P_MIGRAINE) { } else if (f->val[0] == P_MIGRAINE) {
// sleeping will avoid all migraine effects // sleeping will avoid all migraine effects
@ -22819,26 +22890,65 @@ void startlfturn(lifeform_t *lf) {
} }
} // end if !statis } // end if !statis
if (lfhasflag(lf, F_FROZEN)) { if (isdead(lf)) return;
int willmelt = B_FALSE;
if (hasobofmaterial(lf->cell->obpile, MT_FIRE)) { // temperature effects
willmelt = B_TRUE; temp = getlftemp(lf);
} else if (onein(4) && !hasobofmaterial(lf->cell->obpile, MT_ICE)) { if (temp != T_NORMAL) {
willmelt = B_TRUE; int shivermult = 0, coldmult = 0;
int exlimbs,coldtime = 0;
exlimbs = getexposedlimbs(lf);
switch (temp) {
case T_VCOLD:
shivermult = 30;
coldmult = 20;
coldtime = 30 + rnd(10,30);
break;
case T_COLD:
shivermult = 20;
coldmult = 15;
coldtime = 20 + rnd(10,20);
break;
case T_CHILLY:
shivermult = 10;
coldmult = 0;
break;
case T_NORMAL: break;
case T_WARM:
meltchance += 25;
meltdam = roll("1d6");
break;
case T_HOT:
meltchance += 50;
meltdam = roll("2d6");
break;
case T_VHOT:
meltchance += 100;
meltdam = roll("2d6");
break;
} }
// melt... if (!skillcheck(lf, SC_CON, (exlimbs*coldmult), 0)) {
if (willmelt) { poison(lf, coldtime, P_COLD, 0, "the cold", R_NONE, B_FALSE);
losehp(lf, 1, DT_MELT, NULL, "melting"); } else if (!skillcheck(lf, SC_CON, (exlimbs*shivermult), 0)) {
addob(lf->cell->obpile, "small puddle of water"); shiver(lf);
if (isplayer(lf)) { }
msg("^BYou are melting!");
} else if (cansee(player, lf)) { // chance to melt if you are frozen or made of ice
char lfname[BUFLEN]; if (lfhasflag(lf, F_FROZEN) || (lf->material->id == MT_ICE)) {
getlfname(lf, lfname); if (pctchance(meltchance)) {
msg("^%c%s melts a little.",getlfcol(lf, CC_BAD), lfname); losehp(lf, meltdam, DT_MELT, NULL, "melting");
addob(lf->cell->obpile, "small puddle of water");
if (isplayer(lf)) {
msg("^BYou are melting!");
} else if (cansee(player, lf)) {
char lfname[BUFLEN];
getlfname(lf, lfname);
msg("^%c%s melts a little.",getlfcol(lf, CC_BAD), lfname);
}
} }
} }
} }
if (isdead(lf)) return; if (isdead(lf)) return;
if (!movedlastturn) { if (!movedlastturn) {

2
lf.h
View File

@ -207,6 +207,7 @@ int getleftrightwalls(lifeform_t *lf);
int getlfaccuracy(lifeform_t *lf, object_t *wep); int getlfaccuracy(lifeform_t *lf, object_t *wep);
char getlfcol(lifeform_t *lf, enum MSGCHARCOL cc); char getlfcol(lifeform_t *lf, enum MSGCHARCOL cc);
enum LFCONDITION getlfcondition(lifeform_t *lf); enum LFCONDITION getlfcondition(lifeform_t *lf);
enum TEMPERATURE getlftemp(lifeform_t *lf);
int getfeetheight(lifeform_t *lf); int getfeetheight(lifeform_t *lf);
int getlistendetectrange(lifeform_t *lf); int getlistendetectrange(lifeform_t *lf);
int getmasterid(lifeform_t *lf); int getmasterid(lifeform_t *lf);
@ -500,6 +501,7 @@ void setlastdam(lifeform_t *lf, char *buf);
int setlfmaterial(lifeform_t *lf, enum MATERIAL id, int wantannounce); int setlfmaterial(lifeform_t *lf, enum MATERIAL id, int wantannounce);
void setlosdirty(lifeform_t *lf); void setlosdirty(lifeform_t *lf);
void setstamina(lifeform_t *lf, float howmuch); void setstamina(lifeform_t *lf, float howmuch);
void shiver(lifeform_t *lf);
int shoot(lifeform_t *lf); int shoot(lifeform_t *lf);
int getskillcheckchance(lifeform_t *lf, enum CHECKTYPE ct, int diff, int mod) ; int getskillcheckchance(lifeform_t *lf, enum CHECKTYPE ct, int diff, int mod) ;
int skillcheck(lifeform_t *lf, enum CHECKTYPE ct, int diff, int mod); int skillcheck(lifeform_t *lf, enum CHECKTYPE ct, int diff, int mod);

266
map.c
View File

@ -74,6 +74,7 @@ cell_t *addcell(map_t *m, int x, int y) {
cell->x = x; cell->x = x;
cell->y = y; cell->y = y;
cell->habitat = m->habitat; cell->habitat = m->habitat;
cell->temperature = m->habitat->temperature;
cell->obpile = addobpile(NOOWNER, cell, NOOB); cell->obpile = addobpile(NOOWNER, cell, NOOB);
cell->type = NULL; cell->type = NULL;
setcelltype(cell, cell->habitat->solidcelltype); setcelltype(cell, cell->habitat->solidcelltype);
@ -98,7 +99,7 @@ cell_t *addcell(map_t *m, int x, int y) {
return cell; return cell;
} }
habitat_t *addhabitat(enum HABITAT id, char *name, enum CELLTYPE emptycell, enum CELLTYPE solidcell, int thingchance, int obchance, int vaultchance, int maxvisrange, enum OBTYPE upstairtype, enum OBTYPE downstairtype, int stairsinrooms) { habitat_t *addhabitat(enum HABITAT id, char *name, enum CELLTYPE emptycell, enum CELLTYPE solidcell, int thingchance, int obchance, int vaultchance, int maxvisrange, enum OBTYPE upstairtype, enum OBTYPE downstairtype, int stairsinrooms, enum TEMPERATURE temp) {
habitat_t *a; habitat_t *a;
// add to the end of the list // add to the end of the list
if (firsthabitat == NULL) { if (firsthabitat == NULL) {
@ -127,6 +128,7 @@ habitat_t *addhabitat(enum HABITAT id, char *name, enum CELLTYPE emptycell, enum
a->upstairtype = upstairtype; a->upstairtype = upstairtype;
a->downstairtype = downstairtype; a->downstairtype = downstairtype;
a->stairsinrooms = stairsinrooms; a->stairsinrooms = stairsinrooms;
a->temperature = getmidtemp(temp);
return a; return a;
} }
@ -2146,36 +2148,46 @@ int doelementspread(cell_t *c) {
fireob = hasobofmaterial(c->obpile, MT_FIRE); fireob = hasobofmaterial(c->obpile, MT_FIRE);
if (fireob && (fireob->birthtime != curtime) && !isdeadob(fireob)) { if (fireob && (fireob->birthtime != curtime) && !isdeadob(fireob)) {
cell_t *retcell[MAXRETCELLS]; cell_t *retcell[MAXRETCELLS];
flag_t *damflag;
int nretcells,i,nspread = 0; int nretcells,i,nspread = 0;
object_t *oo; object_t *oo,*nextoo;
damflag = hasflagval(fireob->flags, F_WALKDAM, DT_FIRE, NA, NA, NULL);
// check adjacent cells (and this one) for flammable stuff // check adjacent cells (and this one) for flammable stuff
getradiuscells(c, 1, DT_COMPASS, B_FALSE, LOF_DONTNEED, B_TRUE, retcell, &nretcells, B_FALSE); getradiuscells(c, 1, DT_COMPASS, B_FALSE, LOF_DONTNEED, B_TRUE, retcell, &nretcells, B_FALSE);
for (i = 0; i < nretcells; i++) { for (i = 0; i < nretcells; i++) {
int celldone = B_FALSE; int celldone = B_FALSE;
for (oo = retcell[i]->obpile->first ; oo ; oo = oo->next) { object_t *hasfire;
hasfire = hasobofmaterial(retcell[i]->obpile, MT_FIRE);
for (oo = retcell[i]->obpile->first ; oo ; oo = nextoo) {
flag_t *f; flag_t *f;
if (hasobofmaterial(retcell[i]->obpile, MT_FIRE)) { nextoo = oo->next;
// there's already a fire here.
// f_onfire flags won't expire if there is fire there. // there's already a fire here.
// f_onfire flags won't expire if there is fire there.
if (hasfire) {
f = hasflag(oo->flags, F_ONFIRE); f = hasflag(oo->flags, F_ONFIRE);
if (f && (f->lifetime > 0)) { if (f && (f->lifetime > 0)) {
f->lifetime++; f->lifetime++;
} }
} else if (isflammable(oo)) { } else {
// no fire here already. if there is a flammable object here, the fire if (isflammable(oo)) {
// will spread. // no fire here already. if there is a flammable object here, the fire
ignite(oo); // will spread.
// if object didn't ignite into a fire, add one. ignite(oo);
if (!hasobofmaterial(retcell[i]->obpile, MT_FIRE)) { // if object didn't ignite into a fire, add one.
addobfast(retcell[i]->obpile, fireob->type->id); if (!hasobofmaterial(retcell[i]->obpile, MT_FIRE)) {
} addobfast(retcell[i]->obpile, fireob->type->id);
// now we regain our full hp }
f = hasflag(fireob->flags, F_OBHP); // now we regain our full hp
if (f) f->val[0] = f->val[1]; f = hasflag(fireob->flags, F_OBHP);
if (f) f->val[0] = f->val[1];
nspread++; nspread++;
celldone = B_TRUE; celldone = B_TRUE;
}
} }
} }
// lifeforms made out of something flammable? ie. plants // lifeforms made out of something flammable? ie. plants
@ -2199,6 +2211,13 @@ int doelementspread(cell_t *c) {
celldone = B_TRUE; celldone = B_TRUE;
} }
} }
} else if (issolid(retcell[i]) && damflag) {
int dam;
dam = (roll(damflag->text) / 2);
if (dam) {
// cell takes fire damage
damagecell(retcell[i], dam, DT_FIRE, NULL);
}
} }
} }
} }
@ -2717,8 +2736,8 @@ void getcellglyph(glyph_t *g, cell_t *c, lifeform_t *viewer) {
g->ch = ' '; g->ch = ' ';
} }
// out of LOS - show as dark // out of LOS - show as dark
// TODO: if terminal supports it, use C_GREY instead. //g->colour = C_BLUE;
g->colour = C_BLUE; g->colour = C_VDARKGREY;
} }
break; break;
} }
@ -2771,6 +2790,12 @@ enum CELLTYPE getmapsolid(map_t *m) {
return m->habitat->solidcelltype; return m->habitat->solidcelltype;
} }
int getmidtemp(enum TEMPERATURE temp) {
int min,max;
gettemprange(temp,&min,&max);
return ((min+max)/2);
}
enum DEPTH getcellwaterdepth(cell_t *c, lifeform_t *lf) { enum DEPTH getcellwaterdepth(cell_t *c, lifeform_t *lf) {
object_t *o; object_t *o;
o = hasobwithflag(c->obpile, F_DEEPWATER); o = hasobwithflag(c->obpile, F_DEEPWATER);
@ -3628,6 +3653,10 @@ void createdungeon(map_t *map, int depth, map_t *parentmap, int exitdir, object_
int minrooms = MINROOMS_DUN; int minrooms = MINROOMS_DUN;
int maxrooms = MAXROOMS_DUN; int maxrooms = MAXROOMS_DUN;
enum CORRIDORTYPE corridortype = CDT_NORMAL; enum CORRIDORTYPE corridortype = CDT_NORMAL;
int minroomw = NA;
int minroomh = NA;
int maxroomw = NA;
int maxroomh = NA;
int moved = 0; int moved = 0;
@ -3635,6 +3664,19 @@ void createdungeon(map_t *map, int depth, map_t *parentmap, int exitdir, object_
//char buf[BUFLEN]; //char buf[BUFLEN];
dbtimestart("Creating dungeon"); dbtimestart("Creating dungeon");
// override parameters
if (map->habitat->id == H_ICECAVE) {
// small rooms
minroomw = NA;
minroomh = NA;
maxroomw = minroomw + 4;
maxroomh = minroomh + 4;
// slightly more twisty
turnpct += rnd(5,10);
// less sparse.
sparseness -= 10;
}
// select dungeon shape. // select dungeon shape.
dbtime("Starting shape selection."); dbtime("Starting shape selection.");
@ -4019,7 +4061,8 @@ void createdungeon(map_t *map, int depth, map_t *parentmap, int exitdir, object_
} }
} }
// just do a normal room // just do a normal room
calcposandmakeroom(map, map->nrooms, NA, NA, NA, NA, DEF_VAULTMARGIN, DEF_VAULTMARGIN, NULL, NULL, NULL, NULL, 50, 25, B_FALSE, 0); calcposandmakeroom(map, map->nrooms, minroomw, minroomh, maxroomw, maxroomh,
DEF_VAULTMARGIN, DEF_VAULTMARGIN, NULL, NULL, NULL, NULL, 50, 25, B_FALSE, 0);
//roomvault[i] = B_FALSE; //roomvault[i] = B_FALSE;
} }
} }
@ -4286,6 +4329,9 @@ void createhabitat(map_t *map, int depth, map_t *parentmap, int exitdir, object_
case H_HEAVEN: case H_HEAVEN:
createheaven(map, depth, parentmap, exitdir, entryob); createheaven(map, depth, parentmap, exitdir, entryob);
break; break;
case H_ICECAVE:
createicecave(map, depth, parentmap, exitdir, entryob);
break;
case H_MASTERVAULTS: case H_MASTERVAULTS:
createmastervaults(map, depth, parentmap, exitdir, entryob); createmastervaults(map, depth, parentmap, exitdir, entryob);
break; break;
@ -4371,6 +4417,37 @@ void createheaven(map_t *map, int depth, map_t *parentmap, int exitdir, object_t
} }
} }
void createicecave(map_t *map, int depth, map_t *parentmap, int exitdir, object_t *entryob) {
int x,y;
cell_t *c;
object_t *o, *nexto;
// first create a normal dungeon
createdungeon(map, depth, parentmap, exitdir, entryob);
// remove all doors and grates
for (y = 0; y < map->h; y++) {
for (x = 0; x < map->w; x++) {
c = getcellat(map, x, y);
for (o = c->obpile->first ; o ; o = nexto) {
int willkill = B_FALSE;
nexto = o->next;
if (isdoor(o, NULL) ) {
willkill = B_TRUE;
} else if (hasflagval(o->flags, F_PIT, D_DOWN, NA, NA, NULL)) {
willkill = B_TRUE;
} else if (o->type->id == OT_GRATINGFLOOR) {
willkill = B_TRUE;
}
if (willkill) {
killob(o);
}
}
}
}
// finalisemap() will replace all walls with ice.
}
/* /*
seed = random number seed seed = random number seed
@ -7324,6 +7401,8 @@ int finalisemap(map_t *map, object_t *entryob, int exitdir) {
} }
} }
} }
//} else if (map->habitat->id == H_ICECAVE) {
// in ice caves, replace all walls with ice
} }
return B_FALSE; return B_FALSE;
@ -7856,6 +7935,18 @@ cell_t *getcellindir(cell_t *cell, int dir) {
return newcell; return newcell;
} }
enum TEMPERATURE getcelltemp(cell_t *c, int *actualtemp) {
enum TEMPERATURE temp;
if (!c || (gamemode != GM_GAMESTARTED)) {
if (actualtemp) *actualtemp = getmidtemp(T_NORMAL);
return T_NORMAL;
}
temp = c->temperature;
limit(&temp, MIN_TEMPERATURE, MAX_TEMPERATURE);
if (actualtemp) *actualtemp = temp;
return gettempbracket(temp);
}
vault_t *getcellvault(cell_t *c) { vault_t *getcellvault(cell_t *c) {
if (c->room) { if (c->room) {
return c->room->vault; return c->room->vault;
@ -8106,8 +8197,6 @@ cell_t *getrandomcelloftype(map_t *map, enum CELLTYPE id) {
return cell; return cell;
} }
int compassdir(int orthdir) { int compassdir(int orthdir) {
switch (orthdir) { switch (orthdir) {
case D_N: case D_N:
@ -8220,10 +8309,14 @@ int getslipperyness(cell_t *c, object_t **slipob) {
addition = 15; addition = 15;
pctmod += 50; pctmod += 50;
break; break;
case CT_FLOORTILE: case CT_FLOORSNOW:
addition = 10; addition = 10;
pctmod += 50; pctmod += 50;
break; break;
case CT_FLOORTILE:
addition = 5;
pctmod += 25;
break;
case CT_FLOORCARPET: case CT_FLOORCARPET:
addition = -10; addition = -10;
pctmod -= 50; pctmod -= 50;
@ -8446,47 +8539,50 @@ object_t *hastrailof(obpile_t *op, lifeform_t *lf, enum OBTYPE oid, flag_t **tfl
void initmap(void) { void initmap(void) {
// habitats // habitats
// thingchance, obchance, vaultchance, maxvisrange, upstiartype, downstairtype, stairs_in_rooms // thingchance, obchance, vaultchance, maxvisrange, upstiartype, downstairtype, stairs_in_rooms,temp
addhabitat(H_DUNGEON, "dungeon", CT_CORRIDOR, CT_WALL, 5, 60, 30, 6, OT_STAIRSUP, OT_STAIRSDOWN, B_TRUE); addhabitat(H_DUNGEON, "dungeon", CT_CORRIDOR, CT_WALL, 5, 60, 30, 6, OT_STAIRSUP, OT_STAIRSDOWN, B_TRUE, T_NORMAL);
addhabitat(H_CAVE, "cave", CT_DIRT, CT_WALLDIRT, 10, 45, 20, 6, OT_TUNNELUP, OT_TUNNELDOWN, B_FALSE); addhabitat(H_ICECAVE, "ice cavern", CT_CORRIDOR, CT_WALLICE, 10, 45, 20, 6, OT_ICESTAIRSUP, OT_ICESTAIRSDOWN, B_FALSE, T_COLD);
addhabitat(H_FOREST, "forest", CT_GRASS, CT_WALLTREE, 5, 75, 0, MAXVISRANGE, OT_TREEUP, OT_TREEDOWN, B_FALSE); addhabitat(H_CAVE, "cave", CT_DIRT, CT_WALLDIRT, 10, 45, 20, 6, OT_TUNNELUP, OT_TUNNELDOWN, B_FALSE, T_NORMAL);
addhabitat(H_HEAVEN, "heaven", CT_CORRIDOR, CT_WALLGLASS, 5, 0, 0, MAXVISRANGE, OT_NONE, OT_NONE, B_FALSE); addhabitat(H_FOREST, "forest", CT_GRASS, CT_WALLTREE, 5, 75, 0, MAXVISRANGE, OT_TREEUP, OT_TREEDOWN, B_FALSE, T_NORMAL);
addhabitat(H_PIT, "pit", CT_CORRIDOR, CT_WALL, 0, 0, 0, 5, OT_NONE, OT_NONE, B_FALSE); addhabitat(H_HEAVEN, "heaven", CT_CORRIDOR, CT_WALLGLASS, 5, 0, 0, MAXVISRANGE, OT_NONE, OT_NONE, B_FALSE, T_NORMAL);
addhabitat(H_VILLAGE, "village", CT_GRASS, CT_WALL, 5, 70, 0, MAXVISRANGE, OT_NONE, OT_NONE, B_FALSE); addhabitat(H_PIT, "pit", CT_CORRIDOR, CT_WALL, 0, 0, 0, 5, OT_NONE, OT_NONE, B_FALSE, T_NORMAL);
addhabitat(H_SEWER, "sewer", CT_MOSSROCK, CT_WALL, 10, 50, 0, MAXVISRANGE, OT_GRATINGROOF, OT_NONE, B_FALSE); addhabitat(H_VILLAGE, "village", CT_GRASS, CT_WALL, 5, 70, 0, MAXVISRANGE, OT_NONE, OT_NONE, B_FALSE, T_NORMAL);
addhabitat(H_STOMACH, "stomach", CT_FLOORFLESH, CT_WALLFLESH, 5, 80, 0, MAXVISRANGE, OT_NONE, OT_NONE, B_FALSE); addhabitat(H_SEWER, "sewer", CT_MOSSROCK, CT_WALL, 10, 50, 0, MAXVISRANGE, OT_GRATINGROOF, OT_NONE, B_FALSE, T_CHILLY);
addhabitat(H_SWAMP, "swamp", CT_CORRIDOR, CT_WALL, 5, 50, 0, MAXVISRANGE, OT_STAIRSUP, OT_STAIRSDOWN, B_FALSE); addhabitat(H_STOMACH, "stomach", CT_FLOORFLESH, CT_WALLFLESH, 5, 80, 0, MAXVISRANGE, OT_NONE, OT_NONE, B_FALSE, T_WARM);
addhabitat(H_BYHUT, "babayaga's hut", CT_FLOORWOOD, CT_WALLDWOOD, 0, 0, 0, MAXVISRANGE, OT_BYHUTDOOR, OT_NONE, B_FALSE); addhabitat(H_SWAMP, "swamp", CT_CORRIDOR, CT_WALL, 5, 50, 0, MAXVISRANGE, OT_STAIRSUP, OT_STAIRSDOWN, B_FALSE, T_WARM); // "hot+humid"
addhabitat(H_ANTNEST, "ant nest", CT_DIRT, CT_WALLDIRT, 10, 40, 0, MAXVISRANGE, OT_STAIRSUP, OT_STAIRSDOWN, B_FALSE); addhabitat(H_BYHUT, "babayaga's hut", CT_FLOORWOOD, CT_WALLDWOOD, 0, 0, 0, MAXVISRANGE, OT_BYHUTDOOR, OT_NONE, B_FALSE, T_NORMAL);
addhabitat(H_MASTERVAULTS, "master vaults", CT_FLOORDURANITE, CT_WALLDURANITE, 10, 0, 0, MAXVISRANGE, OT_VSTAIRSUP, OT_VSTAIRSDOWN, B_FALSE); addhabitat(H_ANTNEST, "ant nest", CT_DIRT, CT_WALLDIRT, 10, 40, 0, MAXVISRANGE, OT_STAIRSUP, OT_STAIRSDOWN, B_FALSE, T_NORMAL);
addhabitat(H_MASTERVAULTS, "master vaults", CT_FLOORDURANITE, CT_WALLDURANITE, 10, 0, 0, MAXVISRANGE, OT_VSTAIRSUP, OT_VSTAIRSDOWN, B_FALSE,
T_NORMAL);
// cell types - solid // cell types - solid
// floorheight, hp, volmod, absorbant // floorheight, hp, volmod, absorbant
addcelltype(CT_WALL, "rock wall", UNI_SHADEDARK, C_GREY, NA, B_SOLID, B_OPAQUE, MT_STONE, 0, 50, 0, B_NOABSORB); addcelltype(CT_WALL, "rock wall", UNI_SHADEDARK, C_GREY, NA, B_SOLID, B_OPAQUE, MT_STONE, 0, 50, 0, B_NOABSORB);
addcelltype(CT_WALLBRICK, "brick wall", UNI_SHADEDARK, C_ORANGE, NA, B_SOLID, B_OPAQUE, MT_BRICK, 0, 40, 0, B_NOABSORB); addcelltype(CT_WALLBRICK, "brick wall", UNI_SHADEDARK, C_BRICK, NA, B_SOLID, B_OPAQUE, MT_BRICK, 0, 40, 0, B_NOABSORB);
addcelltype(CT_WALLDIRT, "dirt wall", UNI_SHADEMED, C_BROWN, NA, B_SOLID, B_OPAQUE, MT_STONE, 0, 20, 0, B_NOABSORB); addcelltype(CT_WALLDIRT, "dirt wall", UNI_SHADEMED, C_BROWN, NA, B_SOLID, B_OPAQUE, MT_STONE, 0, 20, 0, B_NOABSORB);
addcelltype(CT_WALLDURANITE, "duranite wall", UNI_SHADEDARK, C_MAGENTA, NA, B_SOLID, B_OPAQUE, MT_DURANITE, 0, 20000, 0, B_NOABSORB); addcelltype(CT_WALLDURANITE, "duranite wall", UNI_SHADEDARK, C_MAGENTA, NA, B_SOLID, B_OPAQUE, MT_DURANITE, 0, 20000, 0, B_NOABSORB);
addcelltype(CT_WALLWOOD, "wooden wall", UNI_SOLID, C_BROWN, NA, B_SOLID, B_OPAQUE, MT_WOOD, 0, 30, 0, B_NOABSORB); addcelltype(CT_WALLWOOD, "wooden wall", UNI_SOLID, C_DARKBROWN, NA, B_SOLID, B_OPAQUE, MT_WOOD, 0, 30, 0, B_NOABSORB);
addcelltype(CT_WALLDWOOD, "wyrmwood wall", UNI_SOLID, C_BROWN, NA, B_SOLID, B_OPAQUE, MT_DRAGONWOOD, 0, 100, 0, B_NOABSORB); addcelltype(CT_WALLDWOOD, "wyrmwood wall", UNI_SOLID, C_DARKBROWN, NA, B_SOLID, B_OPAQUE, MT_DRAGONWOOD, 0, 100, 0, B_NOABSORB);
addcelltype(CT_WALLFLESH, "flesh wall", UNI_SOLID, C_RED, NA, B_SOLID, B_OPAQUE, MT_FLESH, 0, 25, 0, B_NOABSORB); addcelltype(CT_WALLFLESH, "flesh wall", UNI_SOLID, C_FLESH, NA, B_SOLID, B_OPAQUE, MT_FLESH, 0, 25, 0, B_NOABSORB);
addcelltype(CT_WALLGLASS, "glass wall", UNI_SOLID, C_CYAN, NA, B_SOLID, B_TRANS, MT_GLASS, 0, 20, 0, B_NOABSORB); addcelltype(CT_WALLGLASS, "glass wall", UNI_SOLID, C_CYAN, NA, B_SOLID, B_TRANS, MT_GLASS, 0, 20, 0, B_NOABSORB);
addcelltype(CT_WALLICE, "ice wall", UNI_SHADEDARK, C_CYAN, NA, B_SOLID, B_TRANS, MT_ICE, 0, 30, 0, B_NOABSORB); addcelltype(CT_WALLICE, "ice wall", UNI_SHADEDARK, C_LIGHTCYAN, NA, B_SOLID, B_TRANS, MT_ICE, 0, 30, 0, B_NOABSORB);
//addcelltype(CT_WALLTREE, "dense bushland", UNI_SHADEDARK, C_GREEN, B_SOLID, B_OPAQUE, MT_PLANT, 0, 100); //addcelltype(CT_WALLTREE, "dense bushland", UNI_SHADEDARK, C_GREEN, B_SOLID, B_OPAQUE, MT_PLANT, 0, 100);
addcelltype(CT_WALLTREE, "dense bushland", UNI_TREELOTS, C_GREEN, NA, B_SOLID, B_OPAQUE, MT_PLANT, 0, 100, 0, B_NOABSORB); addcelltype(CT_WALLTREE, "dense bushland", UNI_TREELOTS, C_LIGHTGREEN, NA, B_SOLID, B_OPAQUE, MT_PLANT, 0, 100, 0, B_NOABSORB);
addcelltype(CT_WALLMETAL, "metal wall", UNI_SOLID, C_WHITE, NA, B_SOLID, B_OPAQUE, MT_METAL, 0, 75, 0, B_NOABSORB); addcelltype(CT_WALLMETAL, "metal wall", UNI_SOLID, C_METAL, NA, B_SOLID, B_OPAQUE, MT_METAL, 0, 75, 0, B_NOABSORB);
// cell types - non-solid // cell types - non-solid
addcelltype(CT_FAKE, "fake cell", '.', C_GREEN, NA, B_EMPTY, B_TRANS, MT_STONE, 0, -1, 0, B_NOABSORB); addcelltype(CT_FAKE, "fake cell", '.', C_GREEN, NA, B_EMPTY, B_TRANS, MT_STONE, 0, -1, 0, B_NOABSORB);
addcelltype(CT_MOSSROCK, "mossy rock floor", '.', C_GREEN, NA, B_EMPTY, B_TRANS, MT_STONE, 0, -1, 0, B_NOABSORB); addcelltype(CT_MOSSROCK, "mossy rock floor", '.', C_MOSS, NA, B_EMPTY, B_TRANS, MT_STONE, 0, -1, 0, B_NOABSORB);
addcelltype(CT_CORRIDOR, "rock floor", '.', C_GREY, NA, B_EMPTY, B_TRANS, MT_STONE, 0, -1, 0, B_NOABSORB); addcelltype(CT_CORRIDOR, "rock floor", '.', C_GREY, NA, B_EMPTY, B_TRANS, MT_STONE, 0, -1, 0, B_NOABSORB);
addcelltype(CT_LOOPCORRIDOR, "rock floor", 'L', C_GREY, NA, B_EMPTY, B_TRANS, MT_STONE, 0, -1, 0, B_NOABSORB); addcelltype(CT_LOOPCORRIDOR, "rock floor", 'L', C_GREY, NA, B_EMPTY, B_TRANS, MT_STONE, 0, -1, 0, B_NOABSORB);
addcelltype(CT_FLOORCARPET, "carpetted floor", '.', C_RED, C_ORANGE, B_EMPTY, B_TRANS, MT_CLOTH, 0, -1, -1, B_ABSORB); addcelltype(CT_FLOORCARPET, "carpetted floor", '.', C_CARPET1, C_CARPET2, B_EMPTY, B_TRANS, MT_CLOTH, 0, -1, -1, B_ABSORB);
addcelltype(CT_FLOORDURANITE, "duranite floor", '.', C_MAGENTA, NA, B_EMPTY, B_TRANS, MT_DURANITE, 0, -1, 1, B_NOABSORB); addcelltype(CT_FLOORDURANITE, "duranite floor", '.', C_MAGENTA, NA, B_EMPTY, B_TRANS, MT_DURANITE, 0, -1, 1, B_NOABSORB);
addcelltype(CT_FLOORWOOD, "wood floor", '.', C_BROWN, NA, B_EMPTY, B_TRANS, MT_WOOD, 0, -1, 1, B_NOABSORB); addcelltype(CT_FLOORWOOD, "wood floor", '.', C_DARKBROWN, NA, B_EMPTY, B_TRANS, MT_WOOD, 0, -1, 1, B_NOABSORB);
addcelltype(CT_FLOORFLESH, "flesh floor", '.', C_RED, NA, B_EMPTY, B_TRANS, MT_FLESH, 0, -1, -2, B_NOABSORB); addcelltype(CT_FLOORFLESH, "flesh floor", '.', C_FLESH, NA, B_EMPTY, B_TRANS, MT_FLESH, 0, -1, -2, B_NOABSORB);
addcelltype(CT_FLOORSHOP, "shop floor", '.', C_BROWN, NA, B_EMPTY, B_TRANS, MT_WOOD, 0, -1, 0, B_NOABSORB); addcelltype(CT_FLOORSHOP, "shop floor", '.', C_DARKBROWN, NA, B_EMPTY, B_TRANS, MT_WOOD, 0, -1, 0, B_NOABSORB);
addcelltype(CT_FLOORSNOW, "snow", '.', C_WHITE, NA, B_EMPTY, B_TRANS, MT_SNOW, 0, -1, 0, B_ABSORB);
addcelltype(CT_FLOORTILE, "tiled floor", '.', C_CYAN, C_WHITE, B_EMPTY, B_TRANS, MT_METAL, 0, -1, 2, B_NOABSORB); addcelltype(CT_FLOORTILE, "tiled floor", '.', C_CYAN, C_WHITE, B_EMPTY, B_TRANS, MT_METAL, 0, -1, 2, B_NOABSORB);
addcelltype(CT_GRASS, "grass", '.', C_GREEN, NA, B_EMPTY, B_TRANS, MT_PLANT, 0, -1, -1, B_ABSORB); addcelltype(CT_GRASS, "grass", '.', C_GREEN, NA, B_EMPTY, B_TRANS, MT_PLANT, 0, -1, -1, B_ABSORB);
addcelltype(CT_DIRT, "dirt", '.', C_BROWN, C_YELLOW, B_EMPTY, B_TRANS, MT_STONE, 0, -1, -1, B_NOABSORB /* mud instead */); addcelltype(CT_DIRT, "dirt", '.', C_DARKYELLOW, C_BROWN, B_EMPTY, B_TRANS, MT_STONE, 0, -1, -1, B_NOABSORB /* mud instead */);
addcelltype(CT_LOWFLOOR, "low rock floor", '.', C_GREY, NA, B_EMPTY, B_TRANS, MT_STONE, -1, -1, 0, B_NOABSORB); addcelltype(CT_LOWFLOOR, "low rock floor", '.', C_GREY, NA, B_EMPTY, B_TRANS, MT_STONE, -1, -1, 0, B_NOABSORB);
addcelltype(CT_VLOWFLOOR, "very low rock floor", '.', C_GREY, NA, B_EMPTY, B_TRANS, MT_STONE, -2, -1, 0, B_NOABSORB); addcelltype(CT_VLOWFLOOR, "very low rock floor", '.', C_GREY, NA, B_EMPTY, B_TRANS, MT_STONE, -2, -1, 0, B_NOABSORB);
@ -8503,6 +8599,7 @@ void initmap(void) {
addbranch(BH_CAVE, "The Goblin Caves", B_TRUE, H_CAVE, 5, 1, D_DOWN, B_TRUE, 2, B_FALSE); addbranch(BH_CAVE, "The Goblin Caves", B_TRUE, H_CAVE, 5, 1, D_DOWN, B_TRUE, 2, B_FALSE);
addbranch(BH_WOODS, "The Sylvan Woods", B_TRUE, H_FOREST, 5, 3, D_DOWN, B_TRUE, 1, B_FALSE); addbranch(BH_WOODS, "The Sylvan Woods", B_TRUE, H_FOREST, 5, 3, D_DOWN, B_TRUE, 1, B_FALSE);
addbranch(BH_MASTERVAULTS, "The Master Vaults", B_TRUE, H_MASTERVAULTS, 3, 1, D_DOWN, B_TRUE, 5, B_TRUE); addbranch(BH_MASTERVAULTS, "The Master Vaults", B_TRUE, H_MASTERVAULTS, 3, 1, D_DOWN, B_TRUE, 5, B_TRUE);
addbranch(BH_ICECAVERNS, "The Ice Caverns", B_TRUE, H_ICECAVE, 1, 1, D_DOWN, B_TRUE, 10, B_FALSE);
// minor branches // minor branches
addbranch(BH_PIT, "A Pit", B_FALSE, H_PIT, 1, 1, D_DOWN, B_FALSE, 0, B_TRUE); addbranch(BH_PIT, "A Pit", B_FALSE, H_PIT, 1, 1, D_DOWN, B_FALSE, 0, B_TRUE);
addbranch(BH_SEWER, "A Sewer", B_FALSE, H_SEWER, 1, 0, D_NONE, B_FALSE, 2, B_TRUE); addbranch(BH_SEWER, "A Sewer", B_FALSE, H_SEWER, 1, 0, D_NONE, B_FALSE, 2, B_TRUE);
@ -8573,6 +8670,8 @@ void initmaplayout(void) {
addregionthing(lastregionoutline, rnd(2,4), NA, NA, RT_BRANCHLINK, BH_WOODS, "hollow tree leading down"); addregionthing(lastregionoutline, rnd(2,4), NA, NA, RT_BRANCHLINK, BH_WOODS, "hollow tree leading down");
// l2-5: goblin caves // l2-5: goblin caves
addregionthing(lastregionoutline, rnd(2,4), NA, NA, RT_BRANCHLINK, BH_CAVE, "tunnel leading down"); addregionthing(lastregionoutline, rnd(2,4), NA, NA, RT_BRANCHLINK, BH_CAVE, "tunnel leading down");
// l3-7: ice caverns
addregionthing(lastregionoutline, rnd(3,7), NA, NA, RT_BRANCHLINK, BH_ICECAVERNS, "icy passage leading down");
// l6: jimbo's lair // l6: jimbo's lair
addregionthing(lastregionoutline, 6, NA, NA, RT_VAULT, NA, "jimbos_lair"); addregionthing(lastregionoutline, 6, NA, NA, RT_VAULT, NA, "jimbos_lair");
// l7 - 10: ants nest // l7 - 10: ants nest
@ -8868,7 +8967,7 @@ int isinscanrange(cell_t *c, void **thing, char *desc, glyph_t *glyph) {
*thing = o; *thing = o;
if (glyph) { if (glyph) {
glyph->ch = '*'; glyph->ch = '*';
glyph->colour = C_BOLDGREEN; glyph->colour = C_LIGHTGREEN;
} }
if (desc) { if (desc) {
if (f->val[1] == NA) { if (f->val[1] == NA) {
@ -8983,6 +9082,58 @@ cell_t *getroommidcell(map_t *m, int roomid) {
return c; return c;
} }
void gettemprange(enum TEMPERATURE temp, int *min, int *max) {
if (min) *min = -1;
if (max) *max = -1;
switch (temp) {
case T_VCOLD:
if (min) *min = MIN_TEMPERATURE;
if (max) *max = 0;
break;
case T_COLD:
if (min) *min = 1;
if (max) *max = 11;
break;
case T_CHILLY:
if (min) *min = 12;
if (max) *max = 18;
break;
case T_NORMAL:
if (min) *min = 19;
if (max) *max = 22;
break;
case T_WARM:
if (min) *min = 23;
if (max) *max = 29;
break;
case T_HOT:
if (min) *min = 30;
if (max) *max = 35;
break;
case T_VHOT:
if (min) *min = 36;
if (max) *max = MAX_TEMPERATURE;
break;
}
}
enum TEMPERATURE gettempbracket(int temp) {
enum TEMPERATURE brack;
for (brack = T_VCOLD; brack <= T_VHOT; brack++) {
int min,max;
gettemprange(brack, &min, &max);
if ((temp >= min) && (temp <= max)) return brack;
// outside of normal range...
if ((brack == T_VCOLD) && (temp < min)) {
return brack;
} else if ((brack == T_VHOT) && (temp > max)) {
return brack;
}
}
// default
return T_NORMAL;
}
enum TIMEPHASE gettimephase(void) { enum TIMEPHASE gettimephase(void) {
int h,m,s; int h,m,s;
splittime(&h, &m, &s); splittime(&h, &m, &s);
@ -9554,6 +9705,10 @@ void mapentereffects(map_t *m) {
} }
} }
void modcelltemp(cell_t *c, int howmuch) {
c->temperature += howmuch;
}
void modillumination(map_t *m, int dir) { void modillumination(map_t *m, int dir) {
int donesomething = B_FALSE; int donesomething = B_FALSE;
if (dir > 0) { if (dir > 0) {
@ -9638,6 +9793,13 @@ enum RACE parserace(char *name, flagpile_t *wantflags, condset_t *cs, enum JOB *
p = localname; p = localname;
while (donesomething) { while (donesomething) {
donesomething = B_FALSE; donesomething = B_FALSE;
if (strstarts(p, "single ")) {
p += strlen("single ");
// only ONE monster - no groups/minions.
addcond(cs, CC_HASFLAG, B_FALSE, F_MINIONS);
addcond(cs, CC_HASFLAG, B_FALSE, F_NUMAPPEAR);
donesomething = B_TRUE;
}
if (strstarts(p, "sleeping ")) { if (strstarts(p, "sleeping ")) {
p += strlen("sleeping "); p += strlen("sleeping ");
if (wantflags) addflag(wantflags, F_ASLEEP, NA, ST_ASLEEP, NA, NULL); if (wantflags) addflag(wantflags, F_ASLEEP, NA, ST_ASLEEP, NA, NULL);

8
map.h
View File

@ -1,7 +1,7 @@
#include "defs.h" #include "defs.h"
cell_t *addcell(map_t *map, int x, int y); cell_t *addcell(map_t *map, int x, int y);
habitat_t *addhabitat(enum HABITAT id, char *name, enum CELLTYPE emptycell, enum CELLTYPE solidcell, int thingchance, int obchance, int vaultchance, int maxvisrange, enum OBTYPE upstairtype, enum OBTYPE downstairtype, int stairsinrooms); habitat_t *addhabitat(enum HABITAT id, char *name, enum CELLTYPE emptycell, enum CELLTYPE solidcell, int thingchance, int obchance, int vaultchance, int maxvisrange, enum OBTYPE upstairtype, enum OBTYPE downstairtype, int stairsinrooms, enum TEMPERATURE temp);
void addhomeobs(lifeform_t *lf, int dolevelobs); void addhomeobs(lifeform_t *lf, int dolevelobs);
map_t *addmap(void); map_t *addmap(void);
lifeform_t *addmonster(cell_t *c, enum RACE rid, char *racename, int randomjobok, int amt, int autogen, int *nadded); lifeform_t *addmonster(cell_t *c, enum RACE rid, char *racename, int randomjobok, int amt, int autogen, int *nadded);
@ -49,6 +49,7 @@ enum CELLTYPE getcellempty(cell_t *c);
enum CELLTYPE getcellsolid(cell_t *c); enum CELLTYPE getcellsolid(cell_t *c);
enum CELLTYPE getmapempty(map_t *m); enum CELLTYPE getmapempty(map_t *m);
enum CELLTYPE getmapsolid(map_t *m); enum CELLTYPE getmapsolid(map_t *m);
int getmidtemp(enum TEMPERATURE temp);
enum DEPTH getcellwaterdepth(cell_t *c, lifeform_t *lf); enum DEPTH getcellwaterdepth(cell_t *c, lifeform_t *lf);
int getconnectedwatercells(cell_t *c, cell_t **retcell, int *ncells); int getconnectedwatercells(cell_t *c, cell_t **retcell, int *ncells);
cell_t *get_closest_adjcell(cell_t *src, cell_t *dst); cell_t *get_closest_adjcell(cell_t *src, cell_t *dst);
@ -62,6 +63,8 @@ void getradiuscells(cell_t *centre, int radius, int dirtype, int outsideonly, en
int getroomid(cell_t *c); int getroomid(cell_t *c);
void getroomedge(map_t *m, int roomid, int minx, int miny, int maxx, int maxy, int whichside, cell_t **retcell, int *ncells, int onlywantsolid, int includefixed); void getroomedge(map_t *m, int roomid, int minx, int miny, int maxx, int maxy, int whichside, cell_t **retcell, int *ncells, int onlywantsolid, int includefixed);
cell_t *getroommidcell(map_t *m, int roomid); cell_t *getroommidcell(map_t *m, int roomid);
void gettemprange(enum TEMPERATURE temp, int *min, int *max);
enum TEMPERATURE gettempbracket(int temp);
enum TIMEPHASE gettimephase(void); enum TIMEPHASE gettimephase(void);
object_t *gettopobject(cell_t *where, int forglyph); object_t *gettopobject(cell_t *where, int forglyph);
//void calclight(map_t *map); //void calclight(map_t *map);
@ -87,6 +90,7 @@ void createfakes(map_t *map, cell_t *cell);
void createforest(map_t *map, int depth, map_t *parentmap, int exitdir, object_t *entryob, int nclearings); void createforest(map_t *map, int depth, map_t *parentmap, int exitdir, object_t *entryob, int nclearings);
void createhabitat(map_t *map, int depth, map_t *parentmap, int exitdir, object_t *entryob); void createhabitat(map_t *map, int depth, map_t *parentmap, int exitdir, object_t *entryob);
void createheaven(map_t *map, int depth, map_t *parentmap, int exitdir, object_t *entryob); void createheaven(map_t *map, int depth, map_t *parentmap, int exitdir, object_t *entryob);
void createicecave(map_t *map, int depth, map_t *parentmap, int exitdir, object_t *entryob);
void createmap(map_t *map, int depth, region_t *region, map_t *parentmap, int exitdir, object_t *entryob); void createmap(map_t *map, int depth, region_t *region, map_t *parentmap, int exitdir, object_t *entryob);
void createmastervaults(map_t *map, int depth, map_t *parentmap, int exitdir, object_t *entryob); void createmastervaults(map_t *map, int depth, map_t *parentmap, int exitdir, object_t *entryob);
void createpit(map_t *map, int depth, map_t *parentmap, int exitdir, object_t *entryob); void createpit(map_t *map, int depth, map_t *parentmap, int exitdir, object_t *entryob);
@ -135,6 +139,7 @@ room_t *findroom(map_t *m, int roomid);
map_t *findsurfaceexitmap(map_t *m); map_t *findsurfaceexitmap(map_t *m);
void forgetcells(map_t *map, int amt); void forgetcells(map_t *map, int amt);
cell_t *getcellindir(cell_t *cell, int dir); cell_t *getcellindir(cell_t *cell, int dir);
enum TEMPERATURE getcelltemp(cell_t *c, int *actualtemp);
vault_t *getcellvault(cell_t *c); vault_t *getcellvault(cell_t *c);
cell_t *getclosestroomcell(lifeform_t *lf, int roomid); cell_t *getclosestroomcell(lifeform_t *lf, int roomid);
int getnewdigdir(cell_t *cell, int lastdir, int turnpct, int *moved); int getnewdigdir(cell_t *cell, int lastdir, int turnpct, int *moved);
@ -193,6 +198,7 @@ void makelit(cell_t *c, enum OBTYPE how, int howlong, int power);
void makelitradius(cell_t *c, int radius, enum OBTYPE how, int howlong, int power); void makelitradius(cell_t *c, int radius, enum OBTYPE how, int howlong, int power);
void markroomwalls(map_t *m, room_t *r); void markroomwalls(map_t *m, room_t *r);
void mapentereffects(map_t *m); void mapentereffects(map_t *m);
void modcelltemp(cell_t *c, int howmuch);
void modillumination(map_t *m, int dir); void modillumination(map_t *m, int dir);
void moveobtoclearcell(object_t *o); void moveobtoclearcell(object_t *o);
int orthdir(int compassdir); int orthdir(int compassdir);

47
move.c
View File

@ -1215,6 +1215,7 @@ int moveeffects(lifeform_t *lf, int moved) {
int movelf(lifeform_t *lf, cell_t *newcell, int onpurpose) { int movelf(lifeform_t *lf, cell_t *newcell, int onpurpose) {
object_t *o,*nexto; object_t *o,*nexto;
cell_t *precell; cell_t *precell;
enum TEMPERATURE pretemp,posttemp;
char obname[BUFLEN],lfname[BUFLEN],buf[BUFLEN]; char obname[BUFLEN],lfname[BUFLEN],buf[BUFLEN];
lifeform_t *l; lifeform_t *l;
int didmsg = B_FALSE; int didmsg = B_FALSE;
@ -1240,6 +1241,8 @@ int movelf(lifeform_t *lf, cell_t *newcell, int onpurpose) {
needredraw = B_TRUE; needredraw = B_TRUE;
} }
pretemp = getlftemp(lf);
if (newcell->map != lf->cell->map) { if (newcell->map != lf->cell->map) {
changedlev = B_TRUE; changedlev = B_TRUE;
lf->changinglev = B_TRUE; lf->changinglev = B_TRUE;
@ -1340,6 +1343,7 @@ int movelf(lifeform_t *lf, cell_t *newcell, int onpurpose) {
if (gamemode == GM_GAMESTARTED) { if (gamemode == GM_GAMESTARTED) {
postroom = lf->cell->room; postroom = lf->cell->room;
postspeed = getmovespeed(lf); postspeed = getmovespeed(lf);
posttemp = getlftemp(lf);
} }
// update new cell // update new cell
@ -1723,6 +1727,43 @@ int movelf(lifeform_t *lf, cell_t *newcell, int onpurpose) {
} }
} }
if (pretemp != posttemp) {
char colchar;
char punc;
switch (posttemp) {
case T_VCOLD:
case T_VHOT:
colchar = 'B';
punc = '!';
break;
case T_COLD:
case T_HOT:
colchar = 'w';
punc = '!';
break;
case T_WARM:
case T_CHILLY:
case T_NORMAL:
colchar = 'n';
punc = '.';
break;
}
if (isplayer(lf)) {
if (posttemp == T_NORMAL) {
msg("^%cThe temperature is now more comfortable%c", colchar, punc);
didmsg = B_TRUE;
} else {
msg("^%cYou feel %s%c", colchar, gettemperaturename(posttemp), punc);
didmsg = B_TRUE;
}
} else if (cansee(player, lf) && (getlorelevel(player, getraceclass(lf)) >= PR_BEGINNER)) {
if (posttemp != T_NORMAL) {
msg("%s looks %s%c", lfname, gettemperaturename(posttemp), punc);
didmsg = B_TRUE;
}
}
}
getflags(lf->flags, retflag, &nretflags, F_DAMAGEGROUNDOBS, F_NONE); getflags(lf->flags, retflag, &nretflags, F_DAMAGEGROUNDOBS, F_NONE);
for (i = 0; i < nretflags; i++) { for (i = 0; i < nretflags; i++) {
f = retflag[i]; f = retflag[i];
@ -1733,8 +1774,10 @@ int movelf(lifeform_t *lf, cell_t *newcell, int onpurpose) {
} }
// status bar // status bar
if ((prespeed != postspeed) && isplayer(lf)) { if (isplayer(lf)) {
statdirty = B_TRUE; if ((prespeed != postspeed) || (pretemp != posttemp)) {
statdirty = B_TRUE;
}
} }
} // end if gamestarted } // end if gamestarted

View File

@ -1430,13 +1430,13 @@ enum COLOUR getpctcol(float num, float max) {
float pct; float pct;
pct = (num / max) * 100; pct = (num / max) * 100;
if (pct > 100) { if (pct > 100) {
return C_BOLDBLUE; return C_LIGHTBLUE;
} else if (pct == 100) { } else if (pct == 100) {
return C_BOLDGREEN; return C_LIGHTGREEN;
} else if (pct >= 75) { } else if (pct >= 75) {
return C_GREEN; return C_GREEN;
} else if (pct >= 50) { } else if (pct >= 50) {
return C_BROWN; return C_DARKYELLOW;
} else if (pct >= 25) { } else if (pct >= 25) {
return C_YELLOW; return C_YELLOW;
} else { // ie. < 25% } else { // ie. < 25%

149
objects.c
View File

@ -176,18 +176,18 @@ char *potadjective[] = {
}; };
hiddennamewithcol_t colour[] = { hiddennamewithcol_t colour[] = {
{ "aqua", C_CYAN, }, { "aqua", C_AQUA, },
{ "azure",C_BOLDBLUE }, { "azure",C_LIGHTCYAN },
{ "black",C_BLUE }, { "black",C_VDARKGREY },
{ "blue",C_BLUE }, { "blue",C_BLUE },
{ "brown",C_BROWN }, { "brown",C_BROWN },
{ "cyan",C_CYAN }, { "cyan",C_CYAN },
{ "green",C_GREEN }, { "green",C_GREEN },
{ "indigo",C_MAGENTA }, { "indigo",C_MAGENTA },
{ "magenta",C_BOLDMAGENTA }, { "magenta",C_LIGHTMAGENTA },
{ "night-black",C_BLUE }, { "night-black",C_VDARKGREY },
{ "orange",C_ORANGE }, { "orange",C_ORANGE },
{ "pink",C_MAGENTA }, { "pink",C_PINK },
{ "rainbow-coloured",C_ORANGE }, { "rainbow-coloured",C_ORANGE },
{ "red",C_RED }, { "red",C_RED },
{ "violet",C_MAGENTA }, { "violet",C_MAGENTA },
@ -197,26 +197,26 @@ hiddennamewithcol_t colour[] = {
hiddennamewithcol_t gemtype[] = { hiddennamewithcol_t gemtype[] = {
{ "agate", C_MAGENTA, }, { "agate", C_MAGENTA, },
{ "amethyst", C_MAGENTA, }, // should be purple { "amethyst", C_INDIGO, },
{ "brass",C_BROWN }, { "brass",C_LIGHTYELLOW },
{ "bronze",C_BROWN }, { "bronze",C_DARKYELLOW },
{ "copper",C_BROWN }, { "copper",C_DARKYELLOW },
{ "diamond",C_BOLDCYAN }, { "diamond",C_WHITE },
{ "emerald",C_GREEN }, { "emerald",C_DARKGREEN },
{ "flourite",C_RED }, { "flourite",C_LIGHTRED },
{ "garnet",C_ORANGE }, { "garnet",C_ORANGE },
{ "gold",C_YELLOW }, { "gold",C_YELLOW },
{ "iridium",C_WHITE }, { "iridium",C_WHITE },
{ "jade",C_GREEN }, { "jade",C_GREEN },
{ "jasper",C_RED }, { "jasper",C_RED },
{ "lapis lazuli",C_BOLDBLUE }, { "lapis lazuli",C_LIGHTBLUE },
{ "malachite",C_BOLDCYAN }, { "malachite",C_LIGHTCYAN },
{ "onyx",C_BLUE }, { "onyx",C_VDARKGREY },
{ "opal",C_CYAN }, { "opal",C_CYAN },
{ "pearl",C_WHITE }, { "pearl",C_FLESH },
{ "quartz",C_GREY }, { "quartz",C_GREY },
{ "ruby",C_RED }, { "ruby",C_DARKRED },
{ "sapphire",C_BLUE }, { "sapphire",C_DARKBLUE },
{ "topaz", C_YELLOW }, { "topaz", C_YELLOW },
{ "zinc",C_GREY }, { "zinc",C_GREY },
{ "zircon",C_CYAN }, { "zircon",C_CYAN },
@ -1889,6 +1889,9 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum
} }
} }
// adjust nearby temperature
affect_temperature(o, B_ADD);
// other special changes we need to make based on what was // other special changes we need to make based on what was
// asked for // asked for
if (o) { if (o) {
@ -2827,6 +2830,35 @@ int adjustshieldpenalty(lifeform_t *lf, float amt) {
return amt; return amt;
} }
void affect_temperature(object_t *o, int action) {
flag_t *f;
int dir,howmuch;
cell_t *c,*c2;
f = hasflag(o->flags, F_TEMPMOD);
if (f) {
howmuch = f->val[0];
} else {
return;
}
if (action == B_REMOVE) {
// reverse
howmuch *= -1;
}
c = getoblocation(o);
if (!c) return;
// adjust this cell
modcelltemp(c, howmuch);
// adjust surrounding cells
for (dir = DC_N; dir <= DC_NW; dir++) {
c2 = getcellindir(c, dir);
if (c2) modcelltemp(c2, howmuch);
}
}
void appendinscription(object_t *o, char *text) { void appendinscription(object_t *o, char *text) {
if (o->inscription) { if (o->inscription) {
int len; int len;
@ -2863,10 +2895,10 @@ void applyobmod(object_t *o, obmod_t *om) {
if (om->id == OM_FROZEN) { if (om->id == OM_FROZEN) {
// frozen things don't decay... // frozen things don't decay...
f = hasflagval(o->flags, F_OBHPDRAIN, NA, DT_DECAY, NA, NULL); //f = hasflagval(o->flags, F_OBHPDRAIN, NA, DT_DECAY, NA, NULL);
if (f) { //if (f) {
killflag(f); // killflag(f);
} //}
// ...but they do melt! // ...but they do melt!
f = addtempflag(o->flags, F_OBHPDRAIN, 1, DT_MELT, NA, NULL, FROMOBMOD); f = addtempflag(o->flags, F_OBHPDRAIN, 1, DT_MELT, NA, NULL, FROMOBMOD);
@ -3942,7 +3974,7 @@ glyph_t *getglyph(object_t *o) {
/* /*
if (getcellwaterdepth(loc, player) >= DP_HEAD) { if (getcellwaterdepth(loc, player) >= DP_HEAD) {
col = C_BOLDBLUE; col = C_LIGHTBLUE;
} else { } else {
col = C_BLUE; col = C_BLUE;
} }
@ -5165,6 +5197,7 @@ int getmaterialvalue(enum MATERIAL mat) {
case MT_BRICK: case MT_BRICK:
return 1; return 1;
case MT_WATER: case MT_WATER:
case MT_SNOW:
return 1; return 1;
case MT_FLESH: case MT_FLESH:
case MT_BONE: case MT_BONE:
@ -8349,6 +8382,8 @@ void killob(object_t *o) {
} }
*/ */
affect_temperature(o, B_REMOVE);
o->dying = B_TRUE; o->dying = B_TRUE;
// remove flags conferred by this object // remove flags conferred by this object
@ -12988,6 +13023,8 @@ object_t *relinkob(object_t *src, obpile_t *dst) {
} }
} }
affect_temperature(src, B_REMOVE);
// unweild // unweild
killflagsofid(src->flags, F_EQUIPPED); killflagsofid(src->flags, F_EQUIPPED);
@ -13067,6 +13104,8 @@ object_t *relinkob(object_t *src, obpile_t *dst) {
} }
} }
affect_temperature(src, B_ADD);
return src; return src;
} }
@ -13318,7 +13357,7 @@ int shatter(object_t *o, int hitlf, char *damstring, lifeform_t *fromlf) {
if (shatterdam && !isdead(target)) { if (shatterdam && !isdead(target)) {
// extra glass damage // extra glass damage
if (seen) { if (seen) {
msg("^%d%s %s showered in %s shards!", getlfcol(target, CC_BAD), msg("^%c%s %s showered in %s shards!", getlfcol(target, CC_BAD),
targetname, is(target), o->material->name); targetname, is(target), o->material->name);
} }
losehp(target, shatterdam, DT_SLASH, fromlf, damstring); losehp(target, shatterdam, DT_SLASH, fromlf, damstring);
@ -13417,7 +13456,7 @@ int shatter(object_t *o, int hitlf, char *damstring, lifeform_t *fromlf) {
case OT_POT_OIL: case OT_POT_OIL:
if (seen) { if (seen) {
makeknown(o->type->id); makeknown(o->type->id);
msg("^%d%s %s covered with oil!", getlfcol(target, CC_BAD), msg("^%c%s %s covered with oil!", getlfcol(target, CC_BAD),
targetname, is(target)); targetname, is(target));
} }
// target is temporarily vulnerable to fire. // target is temporarily vulnerable to fire.
@ -15232,6 +15271,21 @@ void timeeffectsob(object_t *o) {
} }
if (location && onground) { if (location && onground) {
enum TEMPERATURE temp;
temp = getcelltemp(location, NULL);
if (temp <= T_VCOLD) {
// stuff freezes
if ((o->type->material->id == MT_WATER) || (o->type->id == OT_SPLASHWATER) || (o->type->id == OT_FOUNTAIN)) {
if (hasflagval(o->flags, F_DTCONVERT, DT_COLD, NA, NA, NULL)) {
takedamage(o, 1, DT_COLD, NULL);
} else {
changemat(o, MT_ICE);
}
if (haslos(player, location)) {
msg("%s freeze%s!", obname, OB1(o, "s",""));
}
}
}
if ((o->type->material->id == MT_WATER) || (o->type->id == OT_SPLASHWATER)) { if ((o->type->material->id == MT_WATER) || (o->type->id == OT_SPLASHWATER)) {
if (location->type->absorbent) { if (location->type->absorbent) {
if (haslos(player, location)) { if (haslos(player, location)) {
@ -15449,6 +15503,7 @@ void timeeffectsob(object_t *o) {
if (f->id == F_OBHPDRAIN) { if (f->id == F_OBHPDRAIN) {
enum DAMTYPE damtype; enum DAMTYPE damtype;
int damamt;
int doit = B_TRUE; int doit = B_TRUE;
//takedamage(o, f->val[0] * firstlftime, DT_DIRECT); //takedamage(o, f->val[0] * firstlftime, DT_DIRECT);
if (f->val[1] == NA) { if (f->val[1] == NA) {
@ -15456,12 +15511,37 @@ void timeeffectsob(object_t *o) {
} else { } else {
damtype = f->val[1]; damtype = f->val[1];
} }
damamt = f->val[0];
// special case - corpses don't decay when on ice or on fire. // special case - corpses don't decay when on ice or on fire.
if (o->type->id == OT_CORPSE) { if (o->type->id == OT_CORPSE) {
if (hasflag(o->flags, F_ONFIRE)) { if (hasflag(o->flags, F_ONFIRE)) {
doit = B_FALSE; doit = B_FALSE;
} else if (hasobofmaterial(o->pile, MT_ICE)) { //} else if (hasobofmaterial(o->pile, MT_ICE)) {
} else if (location) {
enum TEMPERATURE ct;
ct = getcelltemp(location, NULL);
if (ct <= T_COLD) {
doit = B_FALSE;
} else if (ct >= T_WARM) {
// ie. warm = +3 dam
// ie. hot = +6 dam
// ie. vhot = +9 dam
damamt += ((ct - T_NORMAL)*3);
}
}
}
// stuff doesn't melt in cold cells
if ((damtype == DT_MELT) && location) {
enum TEMPERATURE ct;
ct = getcelltemp(location, NULL);
if (ct <= T_CHILLY) {
doit = B_FALSE; doit = B_FALSE;
} else if (ct >= T_WARM) {
// ie. warm = +3 dam
// ie. hot = +6 dam
// ie. vhot = +9 dam
damamt += ((ct - T_NORMAL)*3);
} }
} }
// special case - fire doesn't naturally die down // special case - fire doesn't naturally die down
@ -15842,6 +15922,7 @@ void trapeffects(object_t *trapob, enum OBTYPE oid, cell_t *c, object_t *trapped
} }
if (!avoided) { if (!avoided) {
losehp(lf, roll("2d4"), DT_CRUSH, NULL, "a falling door trap"); losehp(lf, roll("2d4"), DT_CRUSH, NULL, "a falling door trap");
fall(lf, NULL, B_FALSE);
} }
} else { } else {
if (haslos(player, c)) { if (haslos(player, c)) {
@ -16791,14 +16872,24 @@ objecttype_t *getlinkspell(object_t *o) {
enum COLOUR getmaterialcolour(enum MATERIAL mat) { enum COLOUR getmaterialcolour(enum MATERIAL mat) {
enum COLOUR col; enum COLOUR col;
switch (mat) { switch (mat) {
case MT_BRICK:
col = C_BRICK;
break;
case MT_METAL:
col = C_METAL;
break;
case MT_WOOD: case MT_WOOD:
col = C_DARKBROWN;
break;
case MT_LEATHER: case MT_LEATHER:
col = C_BROWN; col = C_BROWN;
break; break;
case MT_FIRE: case MT_FIRE:
case MT_BLOOD:
col = C_RED; col = C_RED;
break; break;
case MT_BLOOD:
col = C_DARKRED;
break;
case MT_GLASS: case MT_GLASS:
case MT_MAGIC: case MT_MAGIC:
col = C_CYAN; col = C_CYAN;
@ -16813,6 +16904,8 @@ enum COLOUR getmaterialcolour(enum MATERIAL mat) {
col = C_BLUE; col = C_BLUE;
break; break;
case MT_SLIME: case MT_SLIME:
col = C_DARKGREEN;
break;
case MT_ACID: case MT_ACID:
col = C_GREEN; col = C_GREEN;
break; break;

View File

@ -25,6 +25,7 @@ void adjustdamob(object_t *o, int *dam, enum DAMTYPE damtype);
int adjustarmourpenalty(lifeform_t *lf, float amt); int adjustarmourpenalty(lifeform_t *lf, float amt);
int adjustshieldpenalty(lifeform_t *lf, float amt); int adjustshieldpenalty(lifeform_t *lf, float amt);
//void adjustprice(objecttype_t *ot, float *price ); //void adjustprice(objecttype_t *ot, float *price );
void affect_temperature(object_t *o, int action);
void appendinscription(object_t *o, char *text); void appendinscription(object_t *o, char *text);
void applyobmod(object_t *o, obmod_t *om); void applyobmod(object_t *o, obmod_t *om);
int blessob(object_t *o); int blessob(object_t *o);

8
save.c
View File

@ -388,8 +388,8 @@ map_t *loadmap(FILE *f) {
c = addcell(m, x, y); c = addcell(m, x, y);
// cell info // cell info
fscanf(f, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n", fscanf(f, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n",
&roomid, &celltypeid, &c->known, &c->knowntime, &c->knownglyph.ch, &c->knownglyph.colour, &c->visited, &c->locked, &temphab, &c->isroomwall); &roomid, &celltypeid, &c->known, &c->knowntime, &c->knownglyph.ch, &c->knownglyph.colour, &c->visited, &c->locked, &temphab, &c->isroomwall, &c->temperature);
c->habitat = findhabitat(temphab); c->habitat = findhabitat(temphab);
c->room = findroom(m, roomid); c->room = findroom(m, roomid);
@ -1107,8 +1107,8 @@ int savemap(FILE *f, map_t *m) {
cell_t *c; cell_t *c;
c = getcellat(m, x, y); c = getcellat(m, x, y);
// cell info // cell info
fprintf(f, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n", fprintf(f, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n",
c->room ? c->room->id : -1, c->type->id, c->known, c->knowntime, c->knownglyph.ch, c->knownglyph.colour, c->visited,c->locked, c->habitat->id, c->isroomwall ); c->room ? c->room->id : -1, c->type->id, c->known, c->knowntime, c->knownglyph.ch, c->knownglyph.colour, c->visited,c->locked, c->habitat->id, c->isroomwall, c->temperature );
// cell objects // cell objects
for (o = c->obpile->first ; o ; o = o->next) { for (o = c->obpile->first ; o ; o = o->next) {
fprintf(f, "ob:%ld\n",o->id); fprintf(f, "ob:%ld\n",o->id);

70
spell.c
View File

@ -4967,6 +4967,49 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
howlong = getspellduration(20,30,blessed) + (power*10); howlong = getspellduration(20,30,blessed) + (power*10);
addtempflag(caster->flags, F_ENHANCESMELL, 4, NA, NA, NULL, howlong); addtempflag(caster->flags, F_ENHANCESMELL, 4, NA, NA, NULL, howlong);
} }
} else if ((spellid == OT_S_COLDSNAP) || (spellid == OT_S_HEATWAVE)) {
object_t *retob[MAXCANDIDATES];
int nretobs,radius,tempmod;
char obname[BUFLEN];
if (spellid == OT_S_COLDSNAP) {
sprintf(obname, "unnatural coldness");
tempmod = -30;
radius = power+1;
} else {
sprintf(obname, "unnatural heat");
tempmod = 30;
radius = power-1;
}
addobsinradius(targcell, radius, DT_ORTH, obname, B_FALSE, B_TRUE, caster, retob, NULL, &nretobs);
if (nretobs) {
int i,donemsg = B_FALSE;
for (i = 0; i < nretobs; i++) {
flag_t *f;
object_t *o;
if (!donemsg && haslos(player, targcell)) {
if (spellid == OT_S_COLDSNAP) {
msg("A large cloud of vapour appears.");
} else {
msg("A shimmering haze of heat appears.");
}
if (seenbyplayer) *seenbyplayer = B_TRUE;
donemsg = B_TRUE;
}
o = retob[i];
addflag(o->flags, F_TEMPMOD, tempmod, NA, NA, NULL);
f = hasflag(o->flags, F_OBHP);
if (f) {
f->val[1] = 40;
f->val[0] = f->val[1];
}
affect_temperature(o, B_ADD);
}
} else {
fizzle(caster);
}
} else if (spellid == OT_S_CONFISCATE) { } else if (spellid == OT_S_CONFISCATE) {
char ch = 'a'; char ch = 'a';
char obname[BUFLEN]; char obname[BUFLEN];
@ -7592,17 +7635,24 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
return B_TRUE; return B_TRUE;
} }
} else if (spellid == OT_S_GLACIATE) { } else if (spellid == OT_S_GLACIATE) {
object_t *o,*nexto; object_t *o;
int donesomething = B_FALSE;
if (haslos(player, targcell)) {
msg("A puff of vapour appears.");
if (seenbyplayer) *seenbyplayer = B_TRUE;
}
for (o = targcell->obpile->first ; o ; o = nexto) { o = addobfast(targcell->obpile, OT_COLDNESS);
nexto = o->next; if (o) {
takedamage(o, 1, DT_COLD, caster); flag_t *f;
donesomething = B_TRUE; if (haslos(player, targcell)) {
msg("A puff of vapour appears.");
if (seenbyplayer) *seenbyplayer = B_TRUE;
}
addflag(o->flags, F_TEMPMOD, (power == 2) ? -25 : -15, NA, NA, NULL);
f = hasflag(o->flags, F_OBHP);
if (f) {
f->val[1] = power*20;
f->val[0] = f->val[1];
}
affect_temperature(o, B_ADD);
} else {
fizzle(caster);
} }
} else if ((spellid == OT_S_GREASE) || (spellid == OT_S_CREATEWATER)) { } else if ((spellid == OT_S_GREASE) || (spellid == OT_S_CREATEWATER)) {
int radius; int radius;

93
text.c
View File

@ -161,9 +161,9 @@ enum COLOUR chartocol(char ch) {
case 'w': // warning case 'w': // warning
return C_YELLOW; return C_YELLOW;
case 'W': // extra warning case 'W': // extra warning
return C_BOLDMAGENTA; return C_MAGENTA;
case 'b': // bad case 'b': // bad
return C_BROWN; return C_DARKYELLOW;
case 'B': // v.bad case 'B': // v.bad
return C_RED; return C_RED;
case 'T': // terrible case 'T': // terrible
@ -173,7 +173,7 @@ enum COLOUR chartocol(char ch) {
case 'G': // v.good case 'G': // v.good
return C_CYAN; return C_CYAN;
case 'E': // excllent case 'E': // excllent
return C_BOLDCYAN; return C_LIGHTCYAN;
case 'h': // 'hilite' case 'h': // 'hilite'
return C_WHITE; return C_WHITE;
case 'l': // 'bLue' case 'l': // 'bLue'
@ -279,7 +279,7 @@ char *construct_hit_string(lifeform_t *lf, lifeform_t *victim, char *attackernam
} else if (fatal) { } else if (fatal) {
col = C_GREEN; col = C_GREEN;
} else { } else {
col = C_BROWN; // normal hit col = C_LIGHTGREEN; // normal hit
} }
strcpy(adjective, ""); strcpy(adjective, "");
@ -984,6 +984,54 @@ char *getattrname(enum ATTRIB att) {
return "?badattrib?"; return "?badattrib?";
} }
char *getcolname(enum COLOUR c) {
switch (c) {
case C_RANDOM: return "__randomcolour__";
case C_BLACK: return "black";
case C_AQUA: return "aqua";
case C_RED: return "red";
case C_GREEN: return "green";
case C_BROWN: return "brown";
case C_BLUE: return "blue";
case C_MAGENTA: return "magenta";
case C_INDIGO: return "indigo";
case C_PINK: return "pink";
case C_CYAN: return "cyan";
case C_GREY: return "grey";
case C_YELLOW: return "yellow";
case C_WHITE: return "white";
case C_BONE: return "bone";
case C_BRICK: return "brick";
case C_MOSS: return "moss";
case C_FLESH: return "flesh";
case C_FOG: return "fog";
case C_CARPET1: return "carpet1";
case C_CARPET2: return "carpet2";
case C_METAL: return "metal";
case C_SMOKE: return "smoke";
case C_WOOD: return "wood";
case C_DARKCYAN: return "darkcyan";
case C_DARKBLUE: return "darkblue";
case C_DARKMAGENTA: return "darkmagenta";
case C_DARKYELLOW: return "darkyellow";
case C_ORANGE: return "orange";
case C_DARKGREEN: return "darkgreen";
case C_DARKGREY: return "darkgrey";
case C_DARKBROWN: return "darkbrown";
case C_DARKRED: return "darkred";
case C_VDARKGREY: return "vdarkgrey";
case C_LIGHTRED: return "lightred";
case C_LIGHTBLUE: return "lightblue";
case C_LIGHTBROWN: return "lightbrown";
case C_LIGHTCYAN: return "lightcyan";
case C_LIGHTGREEN: return "lightgreen";
case C_LIGHTMAGENTA: return "lightmagenta";
case C_LIGHTYELLOW: return "lightyellow";
case C_LAST: return "last_colour";
}
return "?unknowncolour?";
}
char *getdamname(enum DAMTYPE damtype) { char *getdamname(enum DAMTYPE damtype) {
switch (damtype) { switch (damtype) {
case DT_ALL: return "all damage"; case DT_ALL: return "all damage";
@ -1266,9 +1314,15 @@ char *getjobcatname(enum JOBCATEGORY jc) {
char *getkillverb(lifeform_t *victim, object_t *wep, enum DAMTYPE damtype, int dam, int maxhp) { char *getkillverb(lifeform_t *victim, object_t *wep, enum DAMTYPE damtype, int dam, int maxhp) {
float pct; float pct;
flag_t *f;
pct = (int)(((float) dam / (float) maxhp) * 100.0); pct = (int)(((float) dam / (float) maxhp) * 100.0);
if (!isunconscious(victim)) { f = lfhasflag(victim, F_GETKILLEDVERB);
if (f) {
return f->text;
}
if (!isunconscious(victim) && lfcanbekod(victim)) {
if (wep && hasflag(wep->flags, F_MERCIFUL)) { if (wep && hasflag(wep->flags, F_MERCIFUL)) {
return "knock out"; return "knock out";
} }
@ -1276,13 +1330,6 @@ char *getkillverb(lifeform_t *victim, object_t *wep, enum DAMTYPE damtype, int d
return "knock out"; return "knock out";
} }
} }
if (victim->race->id == R_DANCINGWEAPON) {
return "defeat";
}
if (getraceclass(victim) == RC_PLANT) {
return "destroy";
}
if (wep) { if (wep) {
flag_t *f; flag_t *f;
@ -1704,6 +1751,9 @@ char *getregionname(char *buf, map_t *m, region_t *r, enum REGIONNAMEFORMAT how)
case BH_CAVE: case BH_CAVE:
snprintf(buf, BUFLEN, "goblin caves L%d", m->depth); snprintf(buf, BUFLEN, "goblin caves L%d", m->depth);
break; break;
case BH_ICECAVERNS:
snprintf(buf, BUFLEN, "ice caverns L%d", m->depth);
break;
case BH_WOODS: case BH_WOODS:
snprintf(buf, BUFLEN, "sylvan woods L%d", m->depth); snprintf(buf, BUFLEN, "sylvan woods L%d", m->depth);
break; break;
@ -1743,6 +1793,9 @@ char *getregionname(char *buf, map_t *m, region_t *r, enum REGIONNAMEFORMAT how)
case BH_CAVE: case BH_CAVE:
snprintf(buf, BUFLEN, "on level %d of the goblin caves", m->depth); snprintf(buf, BUFLEN, "on level %d of the goblin caves", m->depth);
break; break;
case BH_ICECAVERNS:
snprintf(buf, BUFLEN, "on level %d of the ice caverns", m->depth);
break;
case BH_WOODS: case BH_WOODS:
snprintf(buf, BUFLEN, "on level %d of the sylvan woods", m->depth); snprintf(buf, BUFLEN, "on level %d of the sylvan woods", m->depth);
break; break;
@ -1782,6 +1835,9 @@ char *getregionname(char *buf, map_t *m, region_t *r, enum REGIONNAMEFORMAT how)
case BH_CAVE: case BH_CAVE:
strcpy(buf, "the goblin caves"); strcpy(buf, "the goblin caves");
break; break;
case BH_ICECAVERNS:
strcpy(buf, "the ice caverns");
break;
case BH_WOODS: case BH_WOODS:
strcpy(buf, "the sylvan woods"); strcpy(buf, "the sylvan woods");
break; break;
@ -1974,6 +2030,19 @@ char *gettimephasename(enum TIMEPHASE tp) {
return "unknown_timephase"; return "unknown_timephase";
} }
char *gettemperaturename(enum TEMPERATURE temp) {
switch (temp) {
case T_VCOLD: return "extremely cold";
case T_COLD: return "cold";
case T_CHILLY: return "a bit chilly";
case T_NORMAL: return "comfortable";
case T_WARM: return "a bit warm";
case T_HOT: return "hot";
case T_VHOT: return "extremely hot";
}
return "?unknowntemp?";
}
char *gettimetext(char *retbuf) { char *gettimetext(char *retbuf) {
int hours,mins,secs; int hours,mins,secs;
splittime(&hours, &mins, &secs); splittime(&hours, &mins, &secs);

2
text.h
View File

@ -18,6 +18,7 @@ char *getattrabbrev(enum ATTRIB att);
char *getattrbracketname(enum ATTRIB whichatt, enum ATTRBRACKET brack); char *getattrbracketname(enum ATTRIB whichatt, enum ATTRBRACKET brack);
char getattrletter(enum ATTRIB att); char getattrletter(enum ATTRIB att);
char *getattrname(enum ATTRIB att); char *getattrname(enum ATTRIB att);
char *getcolname(enum COLOUR c);
char *getdamname(enum DAMTYPE damtype); char *getdamname(enum DAMTYPE damtype);
char *getdamnamenoun(enum DAMTYPE damtype); char *getdamnamenoun(enum DAMTYPE damtype);
char *getdirname(int dir); char *getdirname(int dir);
@ -49,6 +50,7 @@ char *getsizetext(enum LFSIZE sz);
char *getschoolname(enum SPELLSCHOOL sch); char *getschoolname(enum SPELLSCHOOL sch);
char *getschoolnameshort(enum SPELLSCHOOL sch); char *getschoolnameshort(enum SPELLSCHOOL sch);
char *getskillcheckname(enum CHECKTYPE ct); char *getskillcheckname(enum CHECKTYPE ct);
char *gettemperaturename(enum TEMPERATURE temp);
char *gettimephasename(enum TIMEPHASE tp); char *gettimephasename(enum TIMEPHASE tp);
char *gettimetext(char *retbuf); char *gettimetext(char *retbuf);
char *gettimetextfuzzy(char *retbuf, int wantpm); char *gettimetextfuzzy(char *retbuf, int wantpm);