|
From: <dsh...@us...> - 2007-04-02 19:25:21
|
Revision: 1195
http://svn.sourceforge.net/crawl-ref/?rev=1195&view=rev
Author: dshaligram
Date: 2007-04-02 12:25:19 -0700 (Mon, 02 Apr 2007)
Log Message:
-----------
Allow AF_DISEASE attacks to sicken monsters.
Modified Paths:
--------------
trunk/crawl-ref/source/direct.cc
trunk/crawl-ref/source/enum.h
trunk/crawl-ref/source/externs.h
trunk/crawl-ref/source/fight.cc
trunk/crawl-ref/source/mon-util.cc
trunk/crawl-ref/source/monstuff.cc
trunk/crawl-ref/source/player.cc
Modified: trunk/crawl-ref/source/direct.cc
===================================================================
--- trunk/crawl-ref/source/direct.cc 2007-04-02 18:44:16 UTC (rev 1194)
+++ trunk/crawl-ref/source/direct.cc 2007-04-02 19:25:19 UTC (rev 1195)
@@ -1398,6 +1398,9 @@
case ENCH_POISON:
strcat(info, " is poisoned.");
break;
+ case ENCH_SICK:
+ strcat(info, " is sick.");
+ break;
case ENCH_ROT:
strcat(info, " is rotting away."); //jmf: "covered in sores"?
break;
Modified: trunk/crawl-ref/source/enum.h
===================================================================
--- trunk/crawl-ref/source/enum.h 2007-04-02 18:44:16 UTC (rev 1194)
+++ trunk/crawl-ref/source/enum.h 2007-04-02 19:25:19 UTC (rev 1195)
@@ -1185,6 +1185,7 @@
ENCH_SUBMERGED,
ENCH_SHORT_LIVED,
ENCH_PARALYSIS, // 20
+ ENCH_SICK,
NUM_ENCHANTMENTS
};
Modified: trunk/crawl-ref/source/externs.h
===================================================================
--- trunk/crawl-ref/source/externs.h 2007-04-02 18:44:16 UTC (rev 1194)
+++ trunk/crawl-ref/source/externs.h 2007-04-02 19:25:19 UTC (rev 1195)
@@ -149,6 +149,7 @@
virtual void blink() = 0;
virtual void teleport(bool right_now = false, bool abyss_shift = false) = 0;
virtual void poison(actor *attacker, int amount = 1) = 0;
+ virtual void sicken(int amount) = 0;
virtual void paralyse(int strength) = 0;
virtual void slow_down(int strength) = 0;
virtual void confuse(int strength) = 0;
@@ -757,6 +758,7 @@
int hunger_level() const { return hunger_state; }
void make_hungry(int nutrition, bool silent = true);
void poison(actor *agent, int amount = 1);
+ void sicken(int amount);
void paralyse(int str);
void slow_down(int str);
void confuse(int strength);
@@ -986,6 +988,7 @@
int melee_evasion(const actor *attacker) const;
void poison(actor *agent, int amount = 1);
+ void sicken(int strength);
void paralyse(int str);
void slow_down(int str);
void confuse(int strength);
Modified: trunk/crawl-ref/source/fight.cc
===================================================================
--- trunk/crawl-ref/source/fight.cc 2007-04-02 18:44:16 UTC (rev 1194)
+++ trunk/crawl-ref/source/fight.cc 2007-04-02 19:25:19 UTC (rev 1195)
@@ -2727,8 +2727,7 @@
break;
case AF_DISEASE:
- if (defender->atype() == ACT_PLAYER)
- disease_player( 50 + random2(100) );
+ defender->sicken( 50 + random2(100) );
break;
case AF_FIRE:
Modified: trunk/crawl-ref/source/mon-util.cc
===================================================================
--- trunk/crawl-ref/source/mon-util.cc 2007-04-02 18:44:16 UTC (rev 1194)
+++ trunk/crawl-ref/source/mon-util.cc 2007-04-02 19:25:19 UTC (rev 1195)
@@ -3275,6 +3275,7 @@
case ENCH_STICKY_FLAME: case ENCH_ABJ: case ENCH_SHORT_LIVED:
case ENCH_SLOW: case ENCH_HASTE: case ENCH_FEAR:
case ENCH_INVIS: case ENCH_CHARM: case ENCH_SLEEP_WARY:
+ case ENCH_SICK:
lose_ench_levels(*cur, levels);
break;
@@ -3340,6 +3341,14 @@
}
break;
+ case ENCH_SICK:
+ {
+ const int lost = !spd? 1 : div_rand_round(10, spd);
+ if (lost > 0)
+ lose_ench_levels(me, lost);
+ break;
+ }
+
case ENCH_SUBMERGED:
{
// not even air elementals unsubmerge into clouds
@@ -3585,6 +3594,21 @@
return (attitude == ATT_FRIENDLY? KC_FRIENDLY : KC_OTHER);
}
+void monsters::sicken(int amount)
+{
+ if (holiness() != MH_NATURAL || (amount /= 2) < 1)
+ return;
+
+ if (!has_ench(ENCH_SICK)
+ && mons_near(this) && player_monster_visible(this))
+ {
+ // Yes, could be confused with poisoning.
+ mprf("%s looks sick.", name(DESC_CAP_THE).c_str());
+ }
+
+ add_ench(mon_enchant(ENCH_SICK, amount));
+}
+
/////////////////////////////////////////////////////////////////////////
// mon_enchant
@@ -3593,7 +3617,7 @@
"none", "slow", "haste", "fear", "conf", "inv", "pois", "bers",
"rot", "summon", "abj", "backlit", "charm", "fire",
"gloshifter", "shifter", "tp", "wary", "submerged",
- "short lived", "paralysis", "bug"
+ "short lived", "paralysis", "sick", "bug"
};
const char *mons_enchantment_name(enchant_type ench)
@@ -3628,6 +3652,10 @@
void mon_enchant::cap_degree()
{
+ // Sickness is not capped.
+ if (ench == ENCH_SICK)
+ return;
+
// Hard cap to simulate old enum behaviour, we should really throw this
// out entirely.
const int max = ench == ENCH_ABJ? 6 : 4;
Modified: trunk/crawl-ref/source/monstuff.cc
===================================================================
--- trunk/crawl-ref/source/monstuff.cc 2007-04-02 18:44:16 UTC (rev 1194)
+++ trunk/crawl-ref/source/monstuff.cc 2007-04-02 19:25:19 UTC (rev 1195)
@@ -2403,7 +2403,8 @@
{
bool imbibed = false;
- switch (mitm[monster->inv[MSLOT_POTION]].sub_type)
+ const int potion_type = mitm[monster->inv[MSLOT_POTION]].sub_type;
+ switch (potion_type)
{
case POT_HEALING:
case POT_HEAL_WOUNDS:
@@ -2423,6 +2424,12 @@
heal_monster(monster, 10 + random2avg(28, 3), false);
}
+ if (potion_type == POT_HEALING)
+ {
+ monster->del_ench(ENCH_POISON);
+ monster->del_ench(ENCH_SICK);
+ }
+
imbibed = true;
}
break;
@@ -3319,6 +3326,9 @@
// Do natural regeneration for monster.
static void monster_regenerate(monsters *monster)
{
+ if (monster->has_ench(ENCH_SICK))
+ return;
+
// regenerate:
if (monster_descriptor(monster->type, MDSC_REGENERATES)
Modified: trunk/crawl-ref/source/player.cc
===================================================================
--- trunk/crawl-ref/source/player.cc 2007-04-02 18:44:16 UTC (rev 1194)
+++ trunk/crawl-ref/source/player.cc 2007-04-02 19:25:19 UTC (rev 1195)
@@ -4424,14 +4424,7 @@
void disease_player( int amount )
{
- if (you.is_undead || amount <= 0)
- return;
-
- mpr( "You feel ill." );
-
- const int tmp = you.disease + amount;
- you.disease = (tmp > 210) ? 210 : tmp;
- learned_something_new(TUT_YOU_SICK);
+ you.sicken(amount);
}
void dec_disease_player( void )
@@ -5214,3 +5207,15 @@
{
return (KC_YOU);
}
+
+void player::sicken(int amount)
+{
+ if (is_undead || amount <= 0)
+ return;
+
+ mpr( "You feel ill." );
+
+ const int tmp = disease + amount;
+ disease = (tmp > 210) ? 210 : tmp;
+ learned_something_new(TUT_YOU_SICK);
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|