From dcf7801daff4c7c76e461c5ad08749394e64466b Mon Sep 17 00:00:00 2001 From: zelgadis Date: Sun, 16 Sep 2007 03:39:41 +0000 Subject: Add dump sections for branch/area details for turns and experience/kills, with the section names being turns_by_place and kills_by_place. Also includes a "visits" dump section (included in the "misc" section") a brief description of the number of branches/levels/areas/etc you visited. Breaks savefile compatibility. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2102 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/monstuff.cc | 56 +++++++++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 24 deletions(-) (limited to 'crawl-ref/source/monstuff.cc') diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index 35e369c353..61200ea0b6 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -364,12 +364,16 @@ static void check_kill_milestone(const monsters *mons, #endif // DGL_MILESTONES static void give_adjusted_experience(monsters *monster, killer_type killer, - bool pet_kill) + bool pet_kill, unsigned int *exp_gain, + unsigned int *avail_gain) { - if (YOU_KILL(killer)) - gain_exp( exper_value( monster ) ); + if (testbits(monster->flags, MF_CREATED_FRIENDLY)) + ; // No experience if monster was created friendly + else if (YOU_KILL(killer)) + gain_exp( exper_value( monster ), exp_gain, avail_gain ); else if (pet_kill) - gain_exp( exper_value( monster ) / 2 + 1 ); + gain_exp( exper_value( monster ) / 2 + 1, + exp_gain, avail_gain ); } static bool is_pet_kill(killer_type killer, int i) @@ -477,9 +481,6 @@ void monster_die(monsters *monster, killer_type killer, int i, bool silent) simple_monster_message( monster, " dissipates!", MSGCH_MONSTER_DAMAGE, MDAM_DEAD ); - if (!testbits(monster->flags, MF_CREATED_FRIENDLY)) - give_adjusted_experience(monster, killer, pet_kill); - if (monster->type == MONS_FIRE_VORTEX) place_cloud(CLOUD_FIRE, monster->x, monster->y, 2 + random2(4), monster->kill_alignment()); @@ -492,9 +493,6 @@ void monster_die(monsters *monster, killer_type killer, int i, bool silent) monster, " vapourises!", MSGCH_MONSTER_DAMAGE, MDAM_DEAD ); - if (!testbits(monster->flags, MF_CREATED_FRIENDLY)) - give_adjusted_experience(monster, killer, pet_kill); - place_cloud(CLOUD_COLD, monster->x, monster->y, 2 + random2(4), monster->kill_alignment()); } @@ -514,10 +512,6 @@ void monster_die(monsters *monster, killer_type killer, int i, bool silent) place_cloud( random_smoke_type(), monster->x, monster->y, 1 + random2(3), monster->kill_alignment() ); - - - if (!testbits(monster->flags, MF_CREATED_FRIENDLY)) - give_adjusted_experience(monster, killer, pet_kill); } else { @@ -537,15 +531,8 @@ void monster_die(monsters *monster, killer_type killer, int i, bool silent) monster->name(DESC_NOCAP_THE).c_str()); } - if (!created_friendly) - { - gain_exp(exper_value( monster )); - } - else - { - if (death_message) - mpr("That felt strangely unrewarding."); - } + if (created_friendly && death_message) + mpr("That felt strangely unrewarding."); // killing triggers tutorial lesson tutorial_inspect_kill(); @@ -642,7 +629,6 @@ void monster_die(monsters *monster, killer_type killer, int i, bool silent) { bool notice = false; const bool anon = (i == ANON_FRIENDLY_MONSTER); - gain_exp(exper_value( monster ) / 2 + 1); const mon_holy_type targ_holy = mons_holiness(monster), attacker_holy = anon? MH_NATURAL : mons_holiness(&menv[i]); @@ -806,6 +792,28 @@ void monster_die(monsters *monster, killer_type killer, int i, bool silent) { you.kills->record_kill(monster, killer, pet_kill); + kill_category kc = + (killer == KILL_YOU || killer == KILL_YOU_MISSILE) ? KC_YOU : + (pet_kill)? KC_FRIENDLY : + KC_OTHER; + + unsigned int exp_gain = 0, avail_gain = 0; + give_adjusted_experience(monster, killer, pet_kill, + &exp_gain, &avail_gain); + + PlaceInfo& curr_PlaceInfo = you.get_place_info(); + PlaceInfo delta; + + delta.mon_kill_num[kc]++; + delta.mon_kill_exp += exp_gain; + delta.mon_kill_exp_avail += avail_gain; + + you.global_info += delta; + you.global_info.assert_validity(); + + curr_PlaceInfo += delta; + curr_PlaceInfo.assert_validity(); + if (monster->has_ench(ENCH_ABJ)) { if (mons_weight(mons_species(monster->type))) -- cgit v1.2.3-54-g00ecf