diff options
author | Steve Melenchuk <smelenchuk@gmail.com> | 2014-01-21 20:43:34 -0700 |
---|---|---|
committer | Steve Melenchuk <smelenchuk@gmail.com> | 2014-01-21 22:11:39 -0700 |
commit | ce86bbf1374fe8894466314c116b39bd0b2fbf3b (patch) | |
tree | 9a991b8acf991c15e4307539ff5ad7b6b0ecde10 /crawl-ref/source/fight.cc | |
parent | 889f32d1afad941cdf3a3fa9d877aee8947f1f02 (diff) | |
download | crawl-ref-ce86bbf1374fe8894466314c116b39bd0b2fbf3b.tar.gz crawl-ref-ce86bbf1374fe8894466314c116b39bd0b2fbf3b.zip |
Demonspawn warmongers: Grand Avatar.
Listed in the proposal as Icon of Greatness.
A grand avatar behaves similarly to both a spectral weapon and a
battlesphere in that it attacks targets the caster and its nearby allies
either attack in melee or by battlesphere-triggered conjurations; it
is only guaranteed to attack if the triggerer does at least 15 damage,
though it may trigger randomly below that threshold.
Diffstat (limited to 'crawl-ref/source/fight.cc')
-rw-r--r-- | crawl-ref/source/fight.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc index 164ad9fd08..72ad30ed24 100644 --- a/crawl-ref/source/fight.cc +++ b/crawl-ref/source/fight.cc @@ -53,6 +53,7 @@ */ bool fight_melee(actor *attacker, actor *defender, bool *did_hit, bool simu) { + const int orig_hp = defender->stat_hp(); if (defender->is_player()) { ASSERT(!crawl_state.game_is_arena()); @@ -137,6 +138,11 @@ bool fight_melee(actor *attacker, actor *defender, bool *did_hit, bool simu) // so the weapon doesn't advance unecessarily. return true; } + else if (attacker->type == MONS_GRAND_AVATAR + && !grand_avatar_check_melee(attacker->as_monster(), defender)) + { + return true; + } const int nrounds = attacker->as_monster()->has_hydra_multi_attack() ? attacker->as_monster()->number : 4; @@ -213,6 +219,17 @@ bool fight_melee(actor *attacker, actor *defender, bool *did_hit, bool simu) // A spectral weapon attacks whenever the player does if (!simu && attacker->props.exists("spectral_weapon")) trigger_spectral_weapon(attacker, defender); + else if (!simu + && attacker->is_monster() + && attacker->as_monster()->has_ench(ENCH_GRAND_AVATAR) + && orig_hp - defender->stat_hp() + >= random2(GRAND_AVATAR_DAMAGE)) + { + actor* avatar = attacker->as_monster()->get_ench(ENCH_GRAND_AVATAR) + .agent(); + if (avatar) + trigger_grand_avatar(avatar->as_monster(), defender, SPELL_MELEE); + } return true; } |