From 2a26233126e10117267fc9393539af56f66b0116 Mon Sep 17 00:00:00 2001 From: haranp Date: Tue, 3 Feb 2009 11:08:23 +0000 Subject: Fix [2220297]: nonenchantment tracers were improperly doublecounting each creature, once with and once without resistances. Also reduced fireball foe_ratio to 60 to make fire giants more aggressive. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8879 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/beam.cc | 30 +++++++++++-------- crawl-ref/source/mon-util.cc | 21 +++++-------- crawl-ref/source/mstuff2.cc | 70 ++++++++++++++++---------------------------- 3 files changed, 51 insertions(+), 70 deletions(-) diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index 43dea290e7..594f241155 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -3988,6 +3988,18 @@ void bolt::update_hurt_or_helped(monsters *mon) void bolt::tracer_enchantment_affect_monster(monsters* mon) { + // Update friend or foe encountered. + if (!mons_atts_aligned(attitude, mons_attitude(mon))) + { + foe_info.count++; + foe_info.power += mons_power(mon->type); + } + else + { + friend_info.count++; + friend_info.power += mons_power(mon->type); + } + handle_stop_attack_prompt(mon); if (!beam_cancelled) { @@ -4099,9 +4111,15 @@ void bolt::tracer_nonenchantment_affect_monster(monsters* mon) // Counting foes is only important for monster tracers. if (!mons_atts_aligned(attitude, mons_attitude(mon))) + { foe_info.power += 2 * final * mons_power(mon->type) / preac; + foe_info.count++; + } else + { friend_info.power += 2 * final * mons_power(mon->type) / preac; + friend_info.count++; + } for (unsigned int i = 0; i < messages.size(); i++) mpr(messages[i].c_str(), MSGCH_MONSTER_DAMAGE); @@ -4135,18 +4153,6 @@ void bolt::tracer_affect_monster(monsters* mon) return; } - // Update friend or foe encountered. - if (!mons_atts_aligned(attitude, mons_attitude(mon))) - { - foe_info.count++; - foe_info.power += mons_power(mon->type); - } - else - { - friend_info.count++; - friend_info.power += mons_power(mon->type); - } - if (is_enchantment()) tracer_enchantment_affect_monster(mon); else diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index 7e1079b76d..8597846cc1 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -303,20 +303,13 @@ short mon_resist_def::get_resist_level(mon_resist_flags res_type) const { switch (res_type) { - case MR_RES_ELEC: - return elec; - case MR_RES_POISON: - return poison; - case MR_RES_FIRE: - return fire; - case MR_RES_STEAM: - return steam; - case MR_RES_COLD: - return cold; - case MR_RES_ACID: - return acid; - default: - return (0); + case MR_RES_ELEC: return elec; + case MR_RES_POISON: return poison; + case MR_RES_FIRE: return fire; + case MR_RES_STEAM: return steam; + case MR_RES_COLD: return cold; + case MR_RES_ACID: return acid; + default: return (0); } } diff --git a/crawl-ref/source/mstuff2.cc b/crawl-ref/source/mstuff2.cc index e4beec8b71..8b31017927 100644 --- a/crawl-ref/source/mstuff2.cc +++ b/crawl-ref/source/mstuff2.cc @@ -1586,6 +1586,30 @@ static void _scale_draconian_breath(bolt& beam, int drac_type) beam.damage.size = scaling * beam.damage.size / 100; } +static spell_type _draco_type_to_breath(int drac_type) +{ + switch (drac_type) + { + case MONS_BLACK_DRACONIAN: return SPELL_LIGHTNING_BOLT; + case MONS_MOTTLED_DRACONIAN: return SPELL_STICKY_FLAME_SPLASH; + case MONS_YELLOW_DRACONIAN: return SPELL_ACID_SPLASH; + case MONS_GREEN_DRACONIAN: return SPELL_POISONOUS_CLOUD; + case MONS_PURPLE_DRACONIAN: return SPELL_ISKENDERUNS_MYSTIC_BLAST; + case MONS_RED_DRACONIAN: return SPELL_FIRE_BREATH; + case MONS_WHITE_DRACONIAN: return SPELL_COLD_BREATH; + case MONS_PALE_DRACONIAN: return SPELL_STEAM_BALL; + + // Handled later. + case MONS_PLAYER_GHOST: return SPELL_DRACONIAN_BREATH; + + default: + DEBUGSTR("Invalid monster using draconian breath spell"); + break; + } + + return (SPELL_DRACONIAN_BREATH); +} + bolt mons_spells( monsters *mons, spell_type spell_cast, int power ) { @@ -1615,50 +1639,7 @@ bolt mons_spells( monsters *mons, spell_type spell_cast, int power ) spell_type real_spell = spell_cast; if (spell_cast == SPELL_DRACONIAN_BREATH) - { - switch (drac_type) - { - case MONS_BLACK_DRACONIAN: - real_spell = SPELL_LIGHTNING_BOLT; - break; - - case MONS_MOTTLED_DRACONIAN: - real_spell = SPELL_STICKY_FLAME_SPLASH; - break; - - case MONS_YELLOW_DRACONIAN: - real_spell = SPELL_ACID_SPLASH; - break; - - case MONS_GREEN_DRACONIAN: - real_spell = SPELL_POISONOUS_CLOUD; - break; - - case MONS_PURPLE_DRACONIAN: - real_spell = SPELL_ISKENDERUNS_MYSTIC_BLAST; - break; - - case MONS_RED_DRACONIAN: - real_spell = SPELL_FIRE_BREATH; - break; - - case MONS_WHITE_DRACONIAN: - real_spell = SPELL_COLD_BREATH; - break; - - case MONS_PALE_DRACONIAN: - real_spell = SPELL_STEAM_BALL; - break; - - case MONS_PLAYER_GHOST: - // Handled later. - break; - - default: - DEBUGSTR("Invalid monster using draconian breath spell"); - break; - } - } + real_spell = _draco_type_to_breath(drac_type); beam.type = dchar_glyph(DCHAR_FIRED_ZAP); // default beam.thrower = KILL_MON_MISSILE; @@ -1834,6 +1815,7 @@ bolt mons_spells( monsters *mons, spell_type spell_cast, int power ) beam.damage = dice_def( 3, 7 + power / 10 ); beam.hit = 40; beam.flavour = BEAM_FIRE; + beam.foe_ratio = 60; beam.is_explosion = true; break; -- cgit v1.2.3-54-g00ecf