diff options
author | Nicholas Feinberg <pleasingfung@gmail.com> | 2014-07-22 08:24:44 -0700 |
---|---|---|
committer | Nicholas Feinberg <pleasingfung@gmail.com> | 2014-07-22 17:27:49 -0700 |
commit | dd698cb91c0dd1061e8a756f2817c524a236877b (patch) | |
tree | ba0e8a3f558ab20df7f16b5dae6a9f281369ec93 /crawl-ref/source/art-func.h | |
parent | 685f7f1fa48aa4198b5dd80a86b02d9f7f4cc1fb (diff) | |
download | crawl-ref-dd698cb91c0dd1061e8a756f2817c524a236877b.tar.gz crawl-ref-dd698cb91c0dd1061e8a756f2817c524a236877b.zip |
Staticify is_dragonkind() (wheals)
Diffstat (limited to 'crawl-ref/source/art-func.h')
-rw-r--r-- | crawl-ref/source/art-func.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/crawl-ref/source/art-func.h b/crawl-ref/source/art-func.h index b942a78ba7..ef2aa59af3 100644 --- a/crawl-ref/source/art-func.h +++ b/crawl-ref/source/art-func.h @@ -26,6 +26,7 @@ #include "env.h" // For storm bow env.cgrid #include "fight.h" #include "food.h" // For evokes +#include "ghost.h" // For is_dragonkind ghost_demon datas #include "godconduct.h" // did_god_conduct #include "misc.h" #include "mgen_data.h" // For Sceptre of Asmodeus evoke @@ -679,6 +680,38 @@ static void _WYRMBANE_equip(item_def *item, bool *show_msgs, bool unmeld) : "You feel an overwhelming desire to slay dragons!"); } +static bool is_dragonkind(const actor *act) +{ + if (mons_genus(act->mons_species()) == MONS_DRAGON + || mons_genus(act->mons_species()) == MONS_DRAKE + || mons_genus(act->mons_species()) == MONS_DRACONIAN) + { + return true; + } + + if (act->is_player()) + return you.form == TRAN_DRAGON; + + // Else the actor is a monster. + const monster* mon = act->as_monster(); + + if (mons_is_zombified(mon) + && (mons_genus(mon->base_monster) == MONS_DRAGON + || mons_genus(mon->base_monster) == MONS_DRAKE + || mons_genus(mon->base_monster) == MONS_DRACONIAN)) + { + return true; + } + + if (mons_is_ghost_demon(mon->type) + && species_genus(mon->ghost->species) == GENPC_DRACONIAN) + { + return true; + } + + return false; +} + static void _WYRMBANE_melee_effects(item_def* weapon, actor* attacker, actor* defender, bool mondied, int dam) { |