diff options
-rw-r--r-- | crawl-ref/source/enum.h | 2 | ||||
-rw-r--r-- | crawl-ref/source/mon-util.cc | 25 | ||||
-rw-r--r-- | crawl-ref/source/mon-util.h | 2 | ||||
-rw-r--r-- | crawl-ref/source/monplace.cc | 18 | ||||
-rw-r--r-- | crawl-ref/source/monplace.h | 6 | ||||
-rw-r--r-- | crawl-ref/source/monstuff.cc | 29 | ||||
-rw-r--r-- | crawl-ref/source/monstuff.h | 2 | ||||
-rw-r--r-- | crawl-ref/source/religion.cc | 57 | ||||
-rw-r--r-- | crawl-ref/source/spells4.cc | 2 |
9 files changed, 102 insertions, 41 deletions
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h index 09e084eb4b..186bccdccc 100644 --- a/crawl-ref/source/enum.h +++ b/crawl-ref/source/enum.h @@ -649,7 +649,7 @@ enum conduct_type DID_KILL_UNDEAD, DID_KILL_DEMON, DID_KILL_NATURAL_EVIL, // TSO - DID_KILL_MUTATOR_OR_ROTTER, // Zin + DID_KILL_CHAOTIC, // Zin DID_KILL_WIZARD, DID_KILL_PRIEST, DID_KILL_HOLY, diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index 7d780b0c54..3e6ffac5db 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -495,6 +495,31 @@ bool mons_is_god_gift(const monsters *mon) return (mon->god != GOD_NO_GOD); } +bool mons_is_chaotic(const monsters *mon) +{ + if (mon->has_ench(ENCH_GLOWING_SHAPESHIFTER, ENCH_SHAPESHIFTER)) + return true; + + if (mon->has_spell(SPELL_POLYMORPH_OTHER)) + return true; + + const int attk_flavour = mons_attack_spec(mon, 0).flavour; + return (attk_flavour == AF_MUTATE || attk_flavour == AF_ROT); +} + +bool mons_is_poisoner(const monsters *mon) +{ + if (mons_corpse_effect(mon->type) == CE_POISONOUS) + return true; + + const int attk_flavour = mons_attack_spec(mon, 0).flavour; + return (attk_flavour == AF_POISON + || attk_flavour == AF_POISON_NASTY + || attk_flavour == AF_POISON_MEDIUM + || attk_flavour == AF_POISON_STRONG + || attk_flavour == AF_POISON_STR); +} + bool mons_is_icy(const monsters *mon) { return (mons_is_icy(mon->type)); diff --git a/crawl-ref/source/mon-util.h b/crawl-ref/source/mon-util.h index 24b978b3a1..8da8afacbc 100644 --- a/crawl-ref/source/mon-util.h +++ b/crawl-ref/source/mon-util.h @@ -639,6 +639,8 @@ bool mons_behaviour_perceptible(const monsters *mon); bool mons_is_native_in_branch(const monsters *monster, const branch_type branch); bool mons_is_god_gift(const monsters *mon); +bool mons_is_chaotic(const monsters *mon); +bool mons_is_poisoner(const monsters *mon); bool mons_is_confused(const monsters *m); bool mons_is_caught(const monsters *m); bool mons_is_fleeing(const monsters *m); diff --git a/crawl-ref/source/monplace.cc b/crawl-ref/source/monplace.cc index 3b0c2bab3c..274be57a49 100644 --- a/crawl-ref/source/monplace.cc +++ b/crawl-ref/source/monplace.cc @@ -2009,21 +2009,26 @@ coord_def find_newmons_square(int mons_class, const coord_def &p) } bool player_will_anger_monster(monster_type type, bool *holy, - bool *unholy, bool *antimagical) + bool *unholy, bool *lawful, + bool *antimagical) { monsters dummy; dummy.type = type; - return (player_will_anger_monster(&dummy, holy, unholy, antimagical)); + return (player_will_anger_monster(&dummy, holy, unholy, lawful, + antimagical)); } bool player_will_anger_monster(monsters *mon, bool *holy, - bool *unholy, bool *antimagical) + bool *unholy, bool *lawful, + bool *antimagical) { const bool is_holy = (is_good_god(you.religion) && mons_is_evil_or_unholy(mon)); const bool is_unholy = (is_evil_god(you.religion) && mons_is_holy(mon)); + const bool is_lawful = + (is_lawful_god(you.religion) && mons_is_chaotic(mon)); const bool is_antimagical = (you.religion == GOD_TROG && mons_is_magic_user(mon)); @@ -2031,6 +2036,8 @@ bool player_will_anger_monster(monsters *mon, bool *holy, *holy = is_holy; if (unholy) *unholy = is_unholy; + if (lawful) + *lawful = is_lawful; if (antimagical) *antimagical = is_antimagical; @@ -2041,10 +2048,11 @@ bool player_angers_monster(monsters *mon) { bool holy; bool unholy; + bool lawful; bool antimagical; // Get the drawbacks, not the benefits... (to prevent e.g. demon-scumming). - if (player_will_anger_monster(mon, &holy, &unholy, &antimagical)) + if (player_will_anger_monster(mon, &holy, &unholy, &lawful, &antimagical)) { if (mon->attitude != ATT_HOSTILE || mon->has_ench(ENCH_CHARM)) { @@ -2060,6 +2068,8 @@ bool player_angers_monster(monsters *mon) aura = "holy"; else if (unholy) aura = "unholy"; + else if (lawful) + aura = "lawful"; else if (antimagical) aura = "anti-magical"; diff --git a/crawl-ref/source/monplace.h b/crawl-ref/source/monplace.h index 9a8cbbf33d..01ff447b22 100644 --- a/crawl-ref/source/monplace.h +++ b/crawl-ref/source/monplace.h @@ -267,10 +267,12 @@ monster_type pick_random_monster(const level_id &place, int &lev_mons); bool player_will_anger_monster(monster_type type, bool *holy = NULL, - bool *unholy = NULL, bool *antimagical = NULL); + bool *unholy = NULL, bool *lawful = NULL, + bool *antimagical = NULL); bool player_will_anger_monster(monsters *mon, bool *holy = NULL, - bool *unholy = NULL, bool *antimagical = NULL); + bool *unholy = NULL, bool *lawful = NULL, + bool *antimagical = NULL); bool player_angers_monster(monsters *mon); diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index 7f8506f0a6..5f48b208f1 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -626,31 +626,6 @@ static bool _monster_avoided_death(monsters *monster, killer_type killer, int i) return (false); } -static bool _is_mons_mutator_or_rotter(monsters *mons) -{ - if (mons->has_ench(ENCH_GLOWING_SHAPESHIFTER, ENCH_SHAPESHIFTER)) - return true; - - if (mons->has_spell(SPELL_POLYMORPH_OTHER)) - return true; - - const int attk_flavour = mons_attack_spec(mons, 0).flavour; - return (attk_flavour == AF_MUTATE || attk_flavour == AF_ROT); -} - -bool is_mons_poisoner(monsters *mons) -{ - if (mons_corpse_effect(mons->type) == CE_POISONOUS) - return true; - - const int attk_flavour = mons_attack_spec(mons, 0).flavour; - return (attk_flavour == AF_POISON - || attk_flavour == AF_POISON_NASTY - || attk_flavour == AF_POISON_MEDIUM - || attk_flavour == AF_POISON_STRONG - || attk_flavour == AF_POISON_STR); -} - static bool _slime_pit_unlock(bool silent) { unset_level_flags(LFLAG_NO_TELE_CONTROL, silent); @@ -926,9 +901,9 @@ void monster_die(monsters *monster, killer_type killer, int i, bool silent) monster->hit_dice, true, monster); } - if (_is_mons_mutator_or_rotter(monster)) + if (mons_is_chaotic(monster)) { - did_god_conduct(DID_KILL_MUTATOR_OR_ROTTER, + did_god_conduct(DID_KILL_CHAOTIC, monster->hit_dice, true, monster); } diff --git a/crawl-ref/source/monstuff.h b/crawl-ref/source/monstuff.h index 0bdad00936..a2ca134a64 100644 --- a/crawl-ref/source/monstuff.h +++ b/crawl-ref/source/monstuff.h @@ -68,8 +68,6 @@ enum poly_power_type { bool monster_polymorph(monsters *monster, monster_type targetc, poly_power_type power = PPT_SAME); -bool is_mons_poisoner(monsters *mon); - // last updated: 08jun2000 {dlb} /* *********************************************************************** * called from: bang - beam - effects - fight - misc - monstuff - mstuff2 - diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index 7a362bbf0c..110ddc757c 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -374,6 +374,8 @@ const char* god_lose_power_messages[NUM_GODS][MAX_GOD_ABILITIES] = static bool _holy_beings_attitude_change(); static bool _evil_beings_attitude_change(); +static bool _chaotic_beings_attitude_change(); +static bool _magic_users_attitude_change(); static bool _beogh_followers_abandon_you(); static void _altar_prayer(); static void _dock_piety(int piety_loss, int penance); @@ -2154,7 +2156,7 @@ bool did_god_conduct( conduct_type thing_done, int level, bool known, } break; - case DID_KILL_MUTATOR_OR_ROTTER: + case DID_KILL_CHAOTIC: if (you.religion == GOD_ZIN) { if (god_hates_attacking_friend(you.religion, victim)) @@ -2450,7 +2452,7 @@ bool did_god_conduct( conduct_type thing_done, int level, bool known, "Necromancy", "Unholy", "Attack Holy", "Attack Neutral", "Attack Friend", "Friend Died", "Stab", "Unchivalric Attack", "Poison", "Field Sacrifice", "Kill Living", "Kill Undead", - "Kill Demon", "Kill Natural Evil", "Kill Mutator Or Rotter", + "Kill Demon", "Kill Natural Evil", "Kill Chaotic", "Kill Wizard", "Kill Priest", "Kill Holy", "Undead Slave Kill Living", "Servant Kill Living", "Servant Kill Undead", "Servant Kill Demon", @@ -3937,6 +3939,49 @@ static bool _evil_beings_attitude_change() return apply_to_all_dungeons(_evil_beings_on_level_attitude_change); } +static bool _chaotic_beings_on_level_attitude_change() +{ + bool success = false; + + for ( int i = 0; i < MAX_MONSTERS; ++i ) + { + monsters *monster = &menv[i]; + if (monster->type != -1 + && mons_is_chaotic(monster)) + { +#ifdef DEBUG_DIAGNOSTICS + mprf(MSGCH_DIAGNOSTICS, "Chaotic attitude changing: %s on level %d, branch %d", + monster->name(DESC_PLAIN).c_str(), + static_cast<int>(you.your_level), + static_cast<int>(you.where_are_you)); +#endif + + // If you worship Zin, you make all non-hostile chaotic + // beings hostile. + if (is_lawful_god(you.religion)) + { + if (monster->attitude != ATT_HOSTILE + || monster->has_ench(ENCH_CHARM)) + { + monster->attitude = ATT_HOSTILE; + monster->del_ench(ENCH_CHARM, true); + behaviour_event(monster, ME_ALERT, MHITYOU); + // for now CREATED_FRIENDLY/WAS_NEUTRAL stays + + success = true; + } + } + } + } + + return success; +} + +static bool _chaotic_beings_attitude_change() +{ + return apply_to_all_dungeons(_chaotic_beings_on_level_attitude_change); +} + static bool _magic_users_on_level_attitude_change() { bool success = false; @@ -5106,10 +5151,14 @@ void god_pitch(god_type which_god) more(); // When you start worshipping a good god, you make all non-hostile - // evil and unholy beings hostile, and when you start worshipping - // Trog, you make all non-hostile magic users hostile. + // evil and unholy beings hostile; when you start worshipping Zin, + // you make all non-hostile chaotic beings hostile; and when you + // start worshipping Trog, you make all non-hostile magic users + // hostile. if (is_good_god(you.religion) && _evil_beings_attitude_change()) mpr("Your evil allies forsake you.", MSGCH_MONSTER_ENCHANT); + else if (is_lawful_god(you.religion) && _chaotic_beings_attitude_change()) + mpr("Your chaotic allies forsake you.", MSGCH_MONSTER_ENCHANT); else if (you.religion == GOD_TROG && _magic_users_attitude_change()) mpr("Your magic-using allies forsake you.", MSGCH_MONSTER_ENCHANT); diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc index 02db85caa0..a8b525b6a4 100644 --- a/crawl-ref/source/spells4.cc +++ b/crawl-ref/source/spells4.cc @@ -612,7 +612,7 @@ static int _ignite_poison_monsters(int x, int y, int pow, int garbage) struct monsters *const mon = &menv[ mon_index ]; // Monsters which have poison corpses or poisonous attacks. - if (is_mons_poisoner(mon)) + if (mons_is_poisoner(mon)) dam_dice.num = 3; // Monsters which are poisoned: |