From e6525c83826d150eb2a283ce5bf23218cb75f82e Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Tue, 13 Nov 2007 15:57:55 +0000 Subject: * Add Cannibalism to list of forbidded actions for good gods. * Add simple warning message (god "did not appreciate that!") when using unID'd items that would otherwise be penalized. * Change protection from harm to be independent of prayer. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2849 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/player.cc | 82 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 81 insertions(+), 1 deletion(-) (limited to 'crawl-ref/source/player.cc') diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index eeb0a796e2..39a33acc47 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -408,6 +408,86 @@ bool player_genus(genus_type which_genus, species_type species) return (false); } // end player_genus() +bool is_player_same_species(const int mon) +{ + switch (you.species) + { + case SP_HUMAN: + if (mons_species(mon) == MONS_HUMAN) + return (true); + return (false); + case SP_CENTAUR: + if (mons_species(mon) == MONS_CENTAUR) + return (true); + return (false); + case SP_OGRE: + case SP_OGRE_MAGE: + if (mons_species(mon) == MONS_OGRE) + return (true); + return (false); + case SP_TROLL: + if (mons_species(mon) == MONS_TROLL) + return (true); + return (false); + case SP_MUMMY: + if (mons_species(mon) == MONS_MUMMY) + return (true); + return (false); + case SP_VAMPIRE: + if (mons_species(mon) == MONS_VAMPIRE) + return (true); + return (false); + case SP_MINOTAUR: + if (mons_species(mon) == MONS_MINOTAUR) + return (true); + return (false); + case SP_NAGA: + if (mons_species(mon) == MONS_NAGA) + return (true); + return (false); + case SP_HILL_ORC: + if (mons_species(mon) == MONS_ORC) + return (true); + return (false); + case SP_MERFOLK: + if (mons_species(mon) == MONS_MERFOLK + || mons_species(mon) == MONS_MERMAID) + { + return (true); + } + return (false); + + case SP_GREY_ELF: + case SP_HIGH_ELF: + case SP_DEEP_ELF: + case SP_SLUDGE_ELF: + if (mons_species(mon) == MONS_ELF) + return (true); + return (false); + + case SP_RED_DRACONIAN: + case SP_WHITE_DRACONIAN: + case SP_GREEN_DRACONIAN: + case SP_GOLDEN_DRACONIAN: + case SP_GREY_DRACONIAN: + case SP_BLACK_DRACONIAN: + case SP_PURPLE_DRACONIAN: + case SP_MOTTLED_DRACONIAN: + case SP_PALE_DRACONIAN: + if (mons_species(mon) == MONS_DRACONIAN) + return (true); + return (false); + + case SP_KOBOLD: + if (mons_species(mon) == MONS_KOBOLD) + return (true); + return (false); + default: // no monster equivalent + return (false); + + } +} + // checks whether the player's current species can // use (usually wear) a given piece of equipment // Note that EQ_BODY_ARMOUR and EQ_HELMET only check @@ -5670,7 +5750,7 @@ void player::attacking(actor *other) { const monsters *mons = dynamic_cast(other); if (mons_friendly(mons)) - did_god_conduct(DID_ATTACK_FRIEND, 5, mons); + did_god_conduct(DID_ATTACK_FRIEND, 5, true, mons); else pet_target = monster_index(mons); } -- cgit v1.2.3-54-g00ecf