summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/docs/monster_speech.txt4
-rw-r--r--crawl-ref/source/dat/database/wpnnoise.txt2
-rw-r--r--crawl-ref/source/item_use.cc7
-rw-r--r--crawl-ref/source/misc.cc12
-rw-r--r--crawl-ref/source/player.cc142
-rw-r--r--crawl-ref/source/player.h8
-rw-r--r--crawl-ref/source/transfor.cc32
7 files changed, 120 insertions, 87 deletions
diff --git a/crawl-ref/docs/monster_speech.txt b/crawl-ref/docs/monster_speech.txt
index 0d3cb7ded6..d119572c43 100644
--- a/crawl-ref/docs/monster_speech.txt
+++ b/crawl-ref/docs/monster_speech.txt
@@ -8,11 +8,11 @@ really easy. This file will hopefully help you in this endeavour.
shout.txt handles message output for monsters noticing you.
-speak.txt handles messages for monsters communicating.
+monspeak.txt handles messages for monsters communicating.
insult.txt handles insults thrown at you by imps and demons.
-noise.txt handles messages randart weapons with the noisy property.
+wpnnoise.txt handles messages randart weapons with the noisy property.
A simple example
diff --git a/crawl-ref/source/dat/database/wpnnoise.txt b/crawl-ref/source/dat/database/wpnnoise.txt
index e1a601f425..4993c4b56e 100644
--- a/crawl-ref/source/dat/database/wpnnoise.txt
+++ b/crawl-ref/source/dat/database/wpnnoise.txt
@@ -3,7 +3,7 @@
# speech has been outsourced. This makes changing existing
# messages, and adding new ones really easy.
#
-# spnnoise.txt contains the messages of randart weapons with
+# wpnnoise.txt contains the messages of randart weapons with
# the noise property and of the Singing Sword, one of
# Crawl's fixed artefacts.
#
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index 077f6604f5..242f71a3a3 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -890,15 +890,16 @@ bool can_wear_armour(const item_def &item, bool verbose, bool ignore_temporary)
&& (ignore_temporary || !player_is_shapechanged()))
{
if (verbose)
- mpr("That helmet does not fit your head!");
+ mpr("That helmet does not fit your head!");
return (false);
}
}
- else if (!can_equip( slot, ignore_temporary ))
+
+ if (!can_equip( slot, ignore_temporary ))
{
if (verbose)
- mpr("You can't wear that in your present form.");
+ mpr("You can't wear that in your present form.");
return (false);
}
diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc
index 50107ebd2f..4cb63046bc 100644
--- a/crawl-ref/source/misc.cc
+++ b/crawl-ref/source/misc.cc
@@ -1606,13 +1606,21 @@ bool is_damaging_cloud(cloud_type type)
{
switch (type)
{
+ // always harmful
case CLOUD_FIRE:
- case CLOUD_STINK:
case CLOUD_COLD:
+ return (true);
+ // only harmful if the player doesn't have the necessary resistances
+ // Takes into account what the player can *know* and what s/he can
+ // also expect to be the case a few turns later (ignores spells).
+ case CLOUD_STINK:
case CLOUD_POISON:
+ return (!player_res_poison(false, false));
case CLOUD_STEAM:
+ return (player_res_steam(false, false) <= 0);
case CLOUD_MIASMA:
- return (true);
+ return (player_prot_life(false, false) <= 2);
+ // smoke, never harmful
default:
return (false);
}
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 850030f30f..772462174b 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -1089,7 +1089,8 @@ int player_res_magic(void)
return rm;
}
-int player_res_steam(bool calc_unid)
+// If temp is set to false, temporary sources or resistance won't be counted.
+int player_res_steam(bool calc_unid, bool temp)
{
int res = 0;
@@ -1099,7 +1100,7 @@ int player_res_steam(bool calc_unid)
if (player_equip(EQ_BODY_ARMOUR, ARM_STEAM_DRAGON_ARMOUR))
res += 2;
- return (res + player_res_fire(calc_unid) / 2);
+ return (res + player_res_fire(calc_unid, temp) / 2);
}
bool player_can_smell()
@@ -1107,7 +1108,8 @@ bool player_can_smell()
return (you.species != SP_MUMMY);
}
-int player_res_fire(bool calc_unid)
+// If temp is set to false, temporary sources or resistance won't be counted.
+int player_res_fire(bool calc_unid, bool temp)
{
int rf = 0;
@@ -1140,33 +1142,36 @@ int player_res_fire(bool calc_unid)
rf--;
}
- // spells:
- if (you.duration[DUR_RESIST_FIRE] > 0)
- rf++;
-
// mutations:
rf += you.mutation[MUT_HEAT_RESISTANCE];
- if (you.duration[DUR_FIRE_SHIELD])
- rf += 2;
-
- // transformations:
- switch (you.attribute[ATTR_TRANSFORMATION])
+ // spells:
+ if (temp)
{
- case TRAN_ICE_BEAST:
- rf--;
- break;
- case TRAN_DRAGON:
- rf += 2;
- break;
- case TRAN_SERPENT_OF_HELL:
- rf += 2;
- break;
- case TRAN_AIR:
- rf -= 2;
- break;
- }
+ if (you.duration[DUR_RESIST_FIRE] > 0)
+ rf++;
+
+ if (you.duration[DUR_FIRE_SHIELD])
+ rf += 2;
+ // transformations:
+ switch (you.attribute[ATTR_TRANSFORMATION])
+ {
+ case TRAN_ICE_BEAST:
+ rf--;
+ break;
+ case TRAN_DRAGON:
+ rf += 2;
+ break;
+ case TRAN_SERPENT_OF_HELL:
+ rf += 2;
+ break;
+ case TRAN_AIR:
+ rf -= 2;
+ break;
+ }
+ }
+
if (rf < -3)
rf = -3;
else if (rf > 3)
@@ -1360,7 +1365,8 @@ int player_res_torment(bool)
}
// funny that no races are susceptible to poisons {dlb}
-int player_res_poison(bool calc_unid)
+// If temp is set to false, temporary sources or resistance won't be counted.
+int player_res_poison(bool calc_unid, bool temp)
{
int rp = 0;
@@ -1385,27 +1391,30 @@ int player_res_poison(bool calc_unid)
rp += player_equip( EQ_BODY_ARMOUR, ARM_GOLD_DRAGON_ARMOUR );
rp += player_equip( EQ_BODY_ARMOUR, ARM_SWAMP_DRAGON_ARMOUR );
- // spells:
- if (you.duration[DUR_RESIST_POISON] > 0)
- rp++;
-
// randart weapons:
rp += scan_randarts(RAP_POISON, calc_unid);
// mutations:
rp += you.mutation[MUT_POISON_RESISTANCE];
- // transformations:
- switch (you.attribute[ATTR_TRANSFORMATION])
+ if (temp)
{
- case TRAN_LICH:
- case TRAN_ICE_BEAST:
- case TRAN_STATUE:
- case TRAN_DRAGON:
- case TRAN_SERPENT_OF_HELL:
- case TRAN_AIR:
- rp++;
- break;
+ // spells:
+ if (you.duration[DUR_RESIST_POISON] > 0)
+ rp++;
+
+ // transformations:
+ switch (you.attribute[ATTR_TRANSFORMATION])
+ {
+ case TRAN_LICH:
+ case TRAN_ICE_BEAST:
+ case TRAN_STATUE:
+ case TRAN_DRAGON:
+ case TRAN_SERPENT_OF_HELL:
+ case TRAN_AIR:
+ rp++;
+ break;
+ }
}
if (rp > 1)
@@ -1578,10 +1587,13 @@ int player_energy()
return pe;
}
-int player_prot_life(bool calc_unid)
+// If temp is set to false, temporary sources of resistance won't be counted.
+int player_prot_life(bool calc_unid, bool temp)
{
int pl = 0;
+ // Hunger is temporary, true, but that's something you can control.
+ // (Especially as life protection only increases the hungrier you get.)
if (you.species == SP_VAMPIRE)
{
switch (you.hunger_state)
@@ -1589,16 +1601,42 @@ int player_prot_life(bool calc_unid)
case HS_STARVING:
case HS_NEAR_STARVING:
pl = 3;
+ break;
case HS_VERY_HUNGRY:
case HS_HUNGRY:
pl = 2;
+ break;
case HS_SATIATED:
pl = 1;
+ break;
default:
break;
}
}
+ // same here: Your piety status is something you can more or less control.
+ // TSO's protection
+ if (you.religion == GOD_SHINING_ONE && you.piety > pl * 50)
+ pl = you.piety / 50;
+
+ if (temp)
+ {
+ // Now, transformations could stop at any time.
+ switch (you.attribute[ATTR_TRANSFORMATION])
+ {
+ case TRAN_STATUE:
+ pl += 1;
+ break;
+ case TRAN_SERPENT_OF_HELL:
+ pl += 2;
+ break;
+ case TRAN_LICH:
+ pl += 3;
+ break;
+ default:
+ break;
+ }
+ }
if (wearing_amulet(AMU_WARDING, calc_unid))
++pl;
@@ -1609,34 +1647,12 @@ int player_prot_life(bool calc_unid)
// armour: (checks body armour only)
pl += player_equip_ego_type( EQ_ALL_ARMOUR, SPARM_POSITIVE_ENERGY );
- switch (you.attribute[ATTR_TRANSFORMATION])
- {
- case TRAN_STATUE:
- pl += 1;
- break;
-
- case TRAN_SERPENT_OF_HELL:
- pl += 2;
- break;
-
- case TRAN_LICH:
- pl += 3;
- break;
-
- default:
- break;
- }
-
// randart wpns
pl += scan_randarts(RAP_NEGATIVE_ENERGY, calc_unid);
// undead/demonic power
pl += you.mutation[MUT_NEGATIVE_ENERGY_RESISTANCE];
- // TSO's protection
- if (you.religion == GOD_SHINING_ONE && you.piety > pl * 50)
- pl = you.piety / 50;
-
if (pl > 3)
pl = 3;
diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h
index 33f5d3fda6..378629316c 100644
--- a/crawl-ref/source/player.h
+++ b/crawl-ref/source/player.h
@@ -148,7 +148,7 @@ int player_magical_power( void );
/* ***********************************************************************
* called from: fight - misc - ouch - spells
* *********************************************************************** */
-int player_prot_life(bool calc_unid = true);
+int player_prot_life(bool calc_unid = true, bool temp = true);
/* ***********************************************************************
@@ -183,15 +183,15 @@ int player_res_electricity(bool calc_unid = true);
/* ***********************************************************************
* called from: acr - fight - misc - ouch - spells
* *********************************************************************** */
-int player_res_fire(bool calc_unid = true);
-int player_res_steam(bool calc_unid = true);
+int player_res_fire(bool calc_unid = true, bool temp = true);
+int player_res_steam(bool calc_unid = true, bool temp = true);
/* ***********************************************************************
* called from: beam - decks - fight - fod - it_use2 - misc - ouch -
* spells - spells2
* *********************************************************************** */
-int player_res_poison(bool calc_unid = true);
+int player_res_poison(bool calc_unid = true, bool temp = true);
bool player_control_teleport(bool calc_unid = true);
diff --git a/crawl-ref/source/transfor.cc b/crawl-ref/source/transfor.cc
index e2802498ae..3bdb081fe8 100644
--- a/crawl-ref/source/transfor.cc
+++ b/crawl-ref/source/transfor.cc
@@ -36,17 +36,6 @@ void extra_hp(int amount_extra);
bool remove_equipment(std::set<equipment_type> removed)
{
- // if we're removing body armour, the cloak will come off as well -- bwr
- if ( removed.find(EQ_BODY_ARMOUR) != removed.end() &&
- you.equip[EQ_BODY_ARMOUR] != -1 )
- removed.insert(EQ_CLOAK);
-
- // if we're removing gloves, the weapon will come off as well -- bwr
- // but this makes Statue Form odd -- haranp
- if ( removed.find(EQ_GLOVES) != removed.end() &&
- you.equip[EQ_GLOVES] != -1 )
- removed.insert(EQ_WEAPON);
-
if ( removed.find(EQ_WEAPON) != removed.end() &&
you.equip[EQ_WEAPON] != -1)
{
@@ -192,6 +181,13 @@ bool transform(int pow, transformation_type which_trans)
switch (which_trans)
{
case TRAN_SPIDER: // also AC +3, ev +3, fast_run
+ // spiders CAN wear soft helmets
+ if ( you.equip[EQ_HELMET] == -1
+ || !is_hard_helmet(you.inv[you.equip[EQ_HELMET]]))
+ {
+ rem_stuff.erase(EQ_HELMET);
+ }
+
if (check_for_cursed_equipment( rem_stuff ))
return (false);
@@ -212,6 +208,13 @@ bool transform(int pow, transformation_type which_trans)
return (true);
case TRAN_BAT:
+ // bats CAN wear soft helmets
+ if ( you.equip[EQ_HELMET] == -1
+ || !is_hard_helmet(you.inv[you.equip[EQ_HELMET]]))
+ {
+ rem_stuff.erase(EQ_HELMET);
+ }
+
// high ev, low ac, high speed
if (check_for_cursed_equipment( rem_stuff ))
return false;
@@ -238,6 +241,12 @@ bool transform(int pow, transformation_type which_trans)
case TRAN_ICE_BEAST: // also AC +3, cold +3, fire -1, pois +1
rem_stuff.erase(EQ_CLOAK);
+ // ice beasts CAN wear soft helmets
+ if ( you.equip[EQ_HELMET] == -1
+ || !is_hard_helmet(you.inv[you.equip[EQ_HELMET]]))
+ {
+ rem_stuff.erase(EQ_HELMET);
+ }
if (check_for_cursed_equipment( rem_stuff ))
return false;
@@ -284,7 +293,6 @@ bool transform(int pow, transformation_type which_trans)
rem_stuff.erase(EQ_WEAPON); // can still hold a weapon
rem_stuff.erase(EQ_CLOAK);
rem_stuff.erase(EQ_HELMET);
- rem_stuff.erase(EQ_BOOTS);
if (check_for_cursed_equipment( rem_stuff ))
return false;