diff options
-rw-r--r-- | crawl-ref/source/actor.h | 10 | ||||
-rw-r--r-- | crawl-ref/source/monster.cc | 6 | ||||
-rw-r--r-- | crawl-ref/source/monster.h | 2 | ||||
-rw-r--r-- | crawl-ref/source/player.cc | 14 | ||||
-rw-r--r-- | crawl-ref/source/player.h | 5 |
5 files changed, 26 insertions, 11 deletions
diff --git a/crawl-ref/source/actor.h b/crawl-ref/source/actor.h index b93046d727..6d98fb2245 100644 --- a/crawl-ref/source/actor.h +++ b/crawl-ref/source/actor.h @@ -3,6 +3,13 @@ #include "los_def.h" +enum ev_ignore_type +{ + EV_IGNORE_NONE = 0, + EV_IGNORE_HELPLESS = 1, + EV_IGNORE_PHASESHIFT = 2 +}; + class actor { public: @@ -167,7 +174,8 @@ public: virtual bool can_throw_large_rocks() const = 0; virtual int armour_class() const = 0; - virtual int melee_evasion(const actor *attacker) const = 0; + virtual int melee_evasion(const actor *attacker, + ev_ignore_type ign = EV_IGNORE_NONE) const = 0; virtual int shield_bonus() const = 0; virtual int shield_block_penalty() const = 0; virtual int shield_bypass_ability(int tohit) const = 0; diff --git a/crawl-ref/source/monster.cc b/crawl-ref/source/monster.cc index cf1e224d29..3a54692345 100644 --- a/crawl-ref/source/monster.cc +++ b/crawl-ref/source/monster.cc @@ -2901,9 +2901,13 @@ int monsters::armour_class() const return (ac); } -int monsters::melee_evasion(const actor *act) const +int monsters::melee_evasion(const actor *act, ev_ignore_type evit) const { int evasion = ev; + + if (evit & EV_IGNORE_HELPLESS) + return (evasion); + if (paralysed() || asleep()) evasion = 0; else if (caught()) diff --git a/crawl-ref/source/monster.h b/crawl-ref/source/monster.h index 68bf582a16..e98fdb5f6c 100644 --- a/crawl-ref/source/monster.h +++ b/crawl-ref/source/monster.h @@ -354,7 +354,7 @@ public: bool can_throw_large_rocks() const; int armour_class() const; - int melee_evasion(const actor *attacker) const; + int melee_evasion(const actor *attacker, ev_ignore_type evit) const; void poison(actor *agent, int amount = 1); bool sicken(int strength); diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 5ed601881c..6f87186f9c 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -2032,7 +2032,7 @@ bool player_is_shapechanged(void) } // New and improved 4.1 evasion model, courtesy Brent Ross. -int player_evasion() +int player_evasion(ev_ignore_type evit) { // XXX: you.body_size() implementations are incomplete, fix. const size_type size = you.body_size(PSIZE_BODY); @@ -2042,7 +2042,7 @@ int player_evasion() int ev = 10 + 2 * size_factor; // Repulsion fields and size are all that matters when paralysed. - if (you.cannot_move()) + if (you.cannot_move() && !(evit & EV_IGNORE_HELPLESS)) { ev = 2 + size_factor; if (player_mutation_level(MUT_REPULSION_FIELD) > 0) @@ -2115,7 +2115,7 @@ int player_evasion() if (you.duration[DUR_AGILITY]) ev += 5; - if (you.duration[DUR_PHASE_SHIFT]) + if (you.duration[DUR_PHASE_SHIFT] && !(evit & EV_IGNORE_PHASESHIFT)) ev += 8; if (you.duration[DUR_STONEMAIL]) @@ -6337,11 +6337,13 @@ int player::armour_class() const return (AC / 100); } -int player::melee_evasion(const actor *act) const +int player::melee_evasion(const actor *act, ev_ignore_type evit) const { - return (player_evasion() - - ((!act || act->visible_to(this)) ? 0 : 10) + return (player_evasion(evit) + - ((!act || act->visible_to(this) + || (evit & EV_IGNORE_HELPLESS)) ? 0 : 10) - (you_are_delayed() + && !(evit & EV_IGNORE_HELPLESS) && !is_run_delay(current_delay_action())? 5 : 0)); } diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h index f5e12a5ed5..f8d1e43f95 100644 --- a/crawl-ref/source/player.h +++ b/crawl-ref/source/player.h @@ -479,7 +479,8 @@ public: bool can_throw_large_rocks() const; int armour_class() const; - int melee_evasion(const actor *attacker) const; + int melee_evasion(const actor *attacker, + ev_ignore_type evit = EV_IGNORE_NONE) const; int stat_hp() const { return hp; } int stat_maxhp() const { return hp_max; } @@ -581,7 +582,7 @@ int check_stealth(void); int player_energy(void); -int player_evasion(void); +int player_evasion(ev_ignore_type evit = EV_IGNORE_NONE); int player_movement_speed(void); |