From 729fc414f8443b1649e7339515decb415eb5890d Mon Sep 17 00:00:00 2001 From: dshaligram Date: Wed, 26 Sep 2007 20:33:14 +0000 Subject: Fixed Beogh being angered by killing a non-orc friendly with a beam (cbus). git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2219 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/beam.cc | 14 +++++--------- crawl-ref/source/monstuff.cc | 3 ++- crawl-ref/source/player.cc | 8 ++------ crawl-ref/source/religion.cc | 12 ++++++++---- crawl-ref/source/religion.h | 6 ++++-- crawl-ref/source/spells2.cc | 6 ++---- 6 files changed, 23 insertions(+), 26 deletions(-) diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index 7860dab4c8..24388fea21 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -3548,15 +3548,11 @@ static int affect_monster(bolt &beam, monsters *mon) { if (YOU_KILL( beam.thrower )) { - if (mons_friendly( mon ) - && (you.religion != GOD_BEOGH // Beogh only cares about orcs - || mons_species(mon->type) == MONS_ORC)) - { - did_god_conduct( DID_ATTACK_FRIEND, 5 ); - } + if (mons_friendly( mon )) + did_god_conduct( DID_ATTACK_FRIEND, 5, mon ); if (mons_holiness( mon ) == MH_HOLY) - did_god_conduct( DID_ATTACK_HOLY, mon->hit_dice ); + did_god_conduct( DID_ATTACK_HOLY, mon->hit_dice, mon ); } behaviour_event( mon, ME_ANNOY, beam_source(beam) ); @@ -3695,10 +3691,10 @@ static int affect_monster(bolt &beam, monsters *mon) if (YOU_KILL(beam.thrower) && hurt_final > 0) { if (mons_friendly(mon)) - did_god_conduct( DID_ATTACK_FRIEND, 5 ); + did_god_conduct( DID_ATTACK_FRIEND, 5, mon ); if (mons_holiness( mon ) == MH_HOLY) - did_god_conduct( DID_ATTACK_HOLY, mon->hit_dice ); + did_god_conduct( DID_ATTACK_HOLY, mon->hit_dice, mon ); } // Don't annoy friendlies if the player's beam did no damage. diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index 69c624511f..37709f9e40 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -635,7 +635,8 @@ void monster_die(monsters *monster, killer_type killer, int i, bool silent) // no piety loss if god gifts killed by other monsters if (mons_friendly(monster) && !testbits(monster->flags,MF_GOD_GIFT)) - did_god_conduct(DID_FRIEND_DIES, 1 + (monster->hit_dice / 2)); + did_god_conduct(DID_FRIEND_DIES, 1 + (monster->hit_dice / 2), + monster); // Trying to prevent summoning abuse here, so we're trying to // prevent summoned creatures from being being done_good kills. diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 780a48d945..c897a1432e 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -5516,12 +5516,8 @@ void player::attacking(actor *other) if (other && other->atype() == ACT_MONSTER) { const monsters *mons = dynamic_cast(other); - if (mons_friendly(mons) - && (you.religion != GOD_BEOGH // Beogh only cares about orcs - || ::mons_species(mons->type) == MONS_ORC)) - { - did_god_conduct(DID_ATTACK_FRIEND, 5); - } + if (mons_friendly(mons)) + did_god_conduct(DID_ATTACK_FRIEND, 5, mons); else pet_target = monster_index(mons); } diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index 0fd8322171..52f3f4b452 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -1116,7 +1116,7 @@ void god_speaks( god_type god, const char *mesg ) // This function is the merger of done_good() and naughty(). // Returns true if god was interested (good or bad) in conduct. -bool did_god_conduct( conduct_type thing_done, int level ) +bool did_god_conduct( conduct_type thing_done, int level, const actor *victim ) { bool ret = false; int piety_change = 0; @@ -1180,9 +1180,13 @@ bool did_god_conduct( conduct_type thing_done, int level ) case GOD_OKAWARU: case GOD_BEOGH: // added penance to avoid killings for loot // deliberately no extra punishment for killing - piety_change = -level; - penance = level * 3; - ret = true; + if (you.religion != GOD_BEOGH || + (victim && mons_species(victim->id()) == MONS_ORC)) + { + piety_change = -level; + penance = level * 3; + ret = true; + } break; default: break; diff --git a/crawl-ref/source/religion.h b/crawl-ref/source/religion.h index 4a1dcbe291..1d124a1fa2 100644 --- a/crawl-ref/source/religion.h +++ b/crawl-ref/source/religion.h @@ -18,13 +18,16 @@ #define MAX_PIETY 200 +class actor; + bool is_priest_god(god_type god); void simple_god_message( const char *event, god_type which_deity = GOD_NO_GOD ); int piety_breakpoint(int i); const char *god_name(god_type which_god, bool long_name = false); //mv void dec_penance(int val); void dec_penance(god_type god, int val); -bool did_god_conduct(conduct_type thing_done, int pgain); +bool did_god_conduct(conduct_type thing_done, int pgain, + const actor *victim = NULL); void excommunication(void); void gain_piety(int pgn); void god_speaks(god_type god, const char *mesg ); @@ -51,7 +54,6 @@ void beogh_idol_revenge(); bool ely_destroy_weapons(); void trog_burn_books(); -class actor; bool tso_stab_safe_monster(const actor *act); inline void xom_acts(int sever) diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc index 36b463a2bb..0d1f1ef171 100644 --- a/crawl-ref/source/spells2.cc +++ b/crawl-ref/source/spells2.cc @@ -1105,11 +1105,9 @@ char burn_freeze(int pow, char flavour) if (hurted) { - if (mons_friendly( monster ) - && (you.religion != GOD_BEOGH // Beogh only cares about orcs - || mons_species(monster->type) == MONS_ORC)) + if (mons_friendly( monster )) { - did_god_conduct( DID_ATTACK_FRIEND, 5 ); + did_god_conduct( DID_ATTACK_FRIEND, 5, monster ); } if (mons_holiness( monster ) == MH_HOLY) -- cgit v1.2.3-54-g00ecf