diff options
author | Steve Melenchuk <smelenchuk@gmail.com> | 2013-12-31 10:24:35 -0700 |
---|---|---|
committer | Steve Melenchuk <smelenchuk@gmail.com> | 2014-02-10 18:59:00 -0700 |
commit | 57c1fdd2a4a5ebf789fe9eb84367c87591fb1b06 (patch) | |
tree | 036080d74438cf3b4541d2848cb2d2d01b221685 /crawl-ref/source/art-func.h | |
parent | ba0e3a01b74c7d78d5ae0dd11232dff3fa0e1bb4 (diff) | |
download | crawl-ref-57c1fdd2a4a5ebf789fe9eb84367c87591fb1b06.tar.gz crawl-ref-57c1fdd2a4a5ebf789fe9eb84367c87591fb1b06.zip |
Unrand: the +3,+6 demon whip "Spellbinder" {antimagic, MR+}.
It inflicts miscast effects related to the target's spells on hit.
Diffstat (limited to 'crawl-ref/source/art-func.h')
-rw-r--r-- | crawl-ref/source/art-func.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/crawl-ref/source/art-func.h b/crawl-ref/source/art-func.h index ced8283b3d..99a7ee7fef 100644 --- a/crawl-ref/source/art-func.h +++ b/crawl-ref/source/art-func.h @@ -960,3 +960,47 @@ static void _ARC_BLADE_melee_effects(item_def* weapon, actor* attacker, if (!mondied && one_chance_in(3)) cast_discharge(75 + random2avg(75, 2), false); } + +/////////////////////////////////////////////////// + +static void _SPELLBINDER_melee_effects(item_def* weapon, actor* attacker, + actor* defender, bool mondied, + int dam) +{ + // Only cause miscasts if the target has magic to disrupt. + if ((defender->is_player() + || (defender->as_monster()->can_use_spells() + && !defender->as_monster()->is_priest() + && !mons_class_flag(defender->type, M_FAKE_SPELLS))) + && !mondied) + { + int school = SPTYP_NONE; + if (defender->is_player()) + { + for (int i = 0; i < you.spell_no; i++) + school |= get_spell_disciplines(you.spells[i]); + } + else + { + const monster* mons = defender->as_monster(); + for (int i = 0; i < NUM_MONSTER_SPELL_SLOTS; i++) + school |= get_spell_disciplines(mons->spells[i]); + } + if (school != SPTYP_NONE) + { + vector<spschool_flag_type> schools; + for (int i = 0; i <= SPTYP_LAST_EXPONENT; i++) + { + if (testbits(school, 1 << i)) + schools.push_back( + static_cast<spschool_flag_type>(1 << i)); + } + ASSERT(schools.size() > 0); + MiscastEffect(defender, attacker->mindex(), + schools[random2(schools.size())], + random2(9), + random2(70), "the demon whip \"Spellbinder\"", + NH_NEVER); + } + } +} |