diff options
author | Jude Brown <bookofjude@users.sourceforge.net> | 2009-11-05 19:07:51 +1000 |
---|---|---|
committer | Jude Brown <bookofjude@users.sourceforge.net> | 2009-11-05 19:09:22 +1000 |
commit | 1c37881948d0880f83edeb7429819483766a0a81 (patch) | |
tree | 46e0637c33840d49c6883c02a080a191371d996d /crawl-ref/source/mon-abil.cc | |
parent | d6b92b199da74a1cb8cfc30322befbfae01f5621 (diff) | |
download | crawl-ref-1c37881948d0880f83edeb7429819483766a0a81.tar.gz crawl-ref-1c37881948d0880f83edeb7429819483766a0a81.zip |
New monsters: golden eyes.
Small, blinking, and fast, these eyes come in packs and are found
natively in Slime (though somewhat rarely). Their confusion ability does
check MR before passing, however, and can be completely avoided by
having Clarity.
Diffstat (limited to 'crawl-ref/source/mon-abil.cc')
-rw-r--r-- | crawl-ref/source/mon-abil.cc | 56 |
1 files changed, 45 insertions, 11 deletions
diff --git a/crawl-ref/source/mon-abil.cc b/crawl-ref/source/mon-abil.cc index 69fbcf3a03..93a79b534b 100644 --- a/crawl-ref/source/mon-abil.cc +++ b/crawl-ref/source/mon-abil.cc @@ -1047,6 +1047,7 @@ bool mon_special_ability(monsters *monster, bolt & beem) case MONS_BLINK_FROG: case MONS_KILLER_KLOWN: case MONS_PRINCE_RIBBIT: + case MONS_GOLDEN_EYE: if (one_chance_in(7) || mons_is_caught(monster) && one_chance_in(3)) used = monster_blink(monster); break; @@ -1287,6 +1288,17 @@ bool mon_special_ability(monsters *monster, bolt & beem) return (used); } +// Combines code using in Confusing Eye, Giant Eye and Eye of Draining to +// reduce clutter. +bool _eyeball_will_use_ability (monsters *monster) +{ + return (coinflip() + && !mons_is_wandering(monster) + && !mons_is_fleeing(monster) + && !mons_is_pacified(monster) + && !player_or_mon_in_sanct(monster)); +} + //--------------------------------------------------------------- // // mon_nearby_ability @@ -1369,12 +1381,38 @@ void mon_nearby_ability(monsters *monster) monster->colour = random_colour(); break; + case MONS_GOLDEN_EYE: + if (_eyeball_will_use_ability(monster)) + { + if (you.can_see(monster) && you.can_see(foe)) + mprf("%s blinks at %s.", + monster->name(DESC_CAP_THE).c_str(), + foe->name(DESC_NOCAP_THE).c_str()); + + int confuse_power = 2 + random2(3); + + if (foe->atype() == ACT_PLAYER + && you_resist_magic((monster->hit_dice * 5) * confuse_power)) + { + canned_msg(MSG_YOU_RESIST); + break; + } + else if (foe->atype() == ACT_MONSTER) + { + const monsters* foe_mons = dynamic_cast<const monsters*>(foe); + if (check_mons_resist_magic(foe_mons, (monster->hit_dice * 5) * confuse_power)) + { + simple_monster_message(foe_mons, mons_resist_string(foe_mons)); + break; + } + } + + foe->confuse(monster, 2 + random2(3)); + } + break; + case MONS_GIANT_EYEBALL: - if (coinflip() - && !mons_is_wandering(monster) - && !mons_is_fleeing(monster) - && !mons_is_pacified(monster) - && !player_or_mon_in_sanct(monster)) + if (_eyeball_will_use_ability(monster)) { if (you.can_see(monster) && you.can_see(foe)) mprf("%s stares at %s.", @@ -1388,12 +1426,8 @@ void mon_nearby_ability(monsters *monster) break; case MONS_EYE_OF_DRAINING: - if (coinflip() - && foe->atype() == ACT_PLAYER - && !mons_is_wandering(monster) - && !mons_is_fleeing(monster) - && !mons_is_pacified(monster) - && !player_or_mon_in_sanct(monster)) + if (_eyeball_will_use_ability(monster) + && foe->atype() == ACT_PLAYER) { simple_monster_message(monster, " stares at you."); |