diff options
author | Stefan O'Rear <stefanor@cox.net> | 2009-11-08 15:29:05 -0800 |
---|---|---|
committer | Stefan O'Rear <stefanor@cox.net> | 2009-11-08 15:29:54 -0800 |
commit | 444cf58a14428a88d0adb4f36f694da950e4d46a (patch) | |
tree | da0a6c20eb11c18e1d21c37bb5aafb338fea5288 /crawl-ref/source/player.cc | |
parent | 7eb0ec4b7f8ef0b96a54ddb5626f71084213bf4f (diff) | |
download | crawl-ref-444cf58a14428a88d0adb4f36f694da950e4d46a.tar.gz crawl-ref-444cf58a14428a88d0adb4f36f694da950e4d46a.zip |
Add hooks to evasion for observing the size of modifiers
Diffstat (limited to 'crawl-ref/source/player.cc')
-rw-r--r-- | crawl-ref/source/player.cc | 14 |
1 files changed, 8 insertions, 6 deletions
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)); } |