From f2106e78a24cd333c27e2e74ca7a49522dd7b299 Mon Sep 17 00:00:00 2001 From: dshaligram Date: Sun, 31 Dec 2006 06:43:47 +0000 Subject: Beam and notes fix for 0.1.7. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/branches/stone_soup-0.1.7@749 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/beam.cc | 32 ++++++++++++++++---------------- crawl-ref/source/monstuff.cc | 43 ++++++++++++++++--------------------------- 2 files changed, 32 insertions(+), 43 deletions(-) diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index 522dadc077..39f84206ad 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -3518,22 +3518,18 @@ static int affect_monster(struct bolt &beam, struct monsters *mon) hurt_final = 0; } -#if DEBUG_DIAGNOSTICS - const int old_hurt = hurt_final; -#endif + const int raw_damage = hurt_final; // check monster resists, _without_ side effects (since the // beam/missile might yet miss!) - hurt_final = mons_adjust_flavoured( mon, beam, hurt_final, false ); + hurt_final = mons_adjust_flavoured( mon, beam, raw_damage, false ); #if DEBUG_DIAGNOSTICS if (!beam.is_tracer) { - snprintf( info, INFO_SIZE, - "Monster: %s; Damage: pre-AC: %d; post-AC: %d; post-resist: %d", - ptr_monam( mon, DESC_PLAIN ), hurt, old_hurt, hurt_final ); - - mpr( info, MSGCH_DIAGNOSTICS ); + mprf(MSGCH_DIAGNOSTICS, + "Monster: %s; Damage: pre-AC: %d; post-AC: %d; post-resist: %d", + ptr_monam( mon, DESC_PLAIN ), hurt, raw_damage, hurt_final ); } #endif @@ -3567,14 +3563,15 @@ static int affect_monster(struct bolt &beam, struct monsters *mon) // BEGIN real non-enchantment beam - // player beams which hit friendly MIGHT annoy them and be considered - // naughty if they do much damage (this is so as not to penalize - // players that fling fireballs into a melee with fire elementals - // on their side - the elementals won't give a sh*t, after all) + // player beams which hit friendly will annoy them and be + // considered naughty if they do damage (this is so as not to + // penalize players that fling fireballs into a melee with fire + // elementals on their side - the elementals won't give a sh*t, + // after all) if (nasty_beam(mon, beam)) { - if (YOU_KILL(beam.thrower)) + if (YOU_KILL(beam.thrower) && hurt_final > 0) { if (mons_friendly(mon)) did_god_conduct( DID_ATTACK_FRIEND, 5 ); @@ -3583,7 +3580,10 @@ static int affect_monster(struct bolt &beam, struct monsters *mon) did_god_conduct( DID_ATTACK_HOLY, mon->hit_dice ); } - behaviour_event(mon, ME_ANNOY, beam_source(beam) ); + // Don't annoy friendlies if the player's beam did no damage. + // Hostiles will still take umbrage. + if (hurt_final > 0 || !mons_friendly(mon) || !YOU_KILL(beam.thrower)) + behaviour_event(mon, ME_ANNOY, beam_source(beam) ); } // explosions always 'hit' @@ -3623,7 +3623,7 @@ static int affect_monster(struct bolt &beam, struct monsters *mon) // note that hurt_final was calculated above, so we don't need it again. // just need to apply flavoured specials (since we called with // doFlavouredEffects = false above) - hurt_final = mons_adjust_flavoured(mon, beam, hurt_final); + hurt_final = mons_adjust_flavoured(mon, beam, raw_damage); // now hurt monster hurt_monster( mon, hurt_final ); diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index 077fe1826a..5e1269d3c2 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -699,23 +699,14 @@ void monster_die(struct monsters *monster, char killer, int i) if (killer != KILL_RESET && killer != KILL_DISMISSED) { - if ( MONST_INTERESTING(monster) || - // XXX yucky hack - monster->type == MONS_PLAYER_GHOST || - monster->type == MONS_PANDEMONIUM_DEMON ) { - /* make a note of it */ - char namebuf[ITEMNAME_SIZE]; - if ( monster->type == MONS_PLAYER_GHOST ) { - snprintf( namebuf, sizeof(namebuf), "the ghost of %s", - ghost.name ); - } - else if ( monster->type == MONS_PANDEMONIUM_DEMON ) { - strncpy( namebuf, ghost.name, sizeof(namebuf) ); - } - else - moname(monster->type, true, DESC_NOCAP_A, namebuf); - take_note(Note(NOTE_KILL_MONSTER, monster->type, 0, namebuf)); - } + if ( MONST_INTERESTING(monster) || + // XXX yucky hack + monster->type == MONS_PLAYER_GHOST || + monster->type == MONS_PANDEMONIUM_DEMON ) + { + take_note(Note(NOTE_KILL_MONSTER, monster->type, 0, + ptr_monam(monster, DESC_NOCAP_A))); + } you.kills.record_kill(monster, killer, pet_kill); @@ -986,12 +977,10 @@ bool monster_polymorph( struct monsters *monster, int targetc, int power ) // If old monster is visible to the player, and is interesting, // then note why the interesting monster went away. if (player_monster_visible(monster) && mons_near(monster) - && MONST_INTERESTING(monster)) { - - char namebuf[ITEMNAME_SIZE]; - moname(monster->type, true, DESC_NOCAP_A, namebuf); - take_note(Note(NOTE_POLY_MONSTER, monster->type, 0, namebuf)); - + && MONST_INTERESTING(monster)) + { + take_note(Note(NOTE_POLY_MONSTER, monster->type, 0, + ptr_monam(monster, DESC_NOCAP_A))); } // messaging: {dlb} @@ -5332,7 +5321,7 @@ static int map_wand_to_mspell(int wand_type) void seen_monster(struct monsters *monster) { if ( monster->flags & MF_SEEN ) - return; + return; // First time we've seen this particular monster monster->flags |= MF_SEEN; @@ -5341,9 +5330,9 @@ void seen_monster(struct monsters *monster) monster->type != MONS_PANDEMONIUM_DEMON && monster->type != MONS_PLAYER_GHOST ) { - char namebuf[ITEMNAME_SIZE]; - moname(monster->type, true, DESC_NOCAP_A, namebuf); - take_note(Note(NOTE_SEEN_MONSTER, monster->type, 0, namebuf)); + take_note( + Note(NOTE_SEEN_MONSTER, monster->type, 0, + ptr_monam(monster, DESC_NOCAP_A)) ); } } -- cgit v1.2.3-54-g00ecf