Skip to content

Commit 4e02dda

Browse files
committed
Fix killed monsters raised as thralls but getting xp tracking
When a monster is raised as a thrall we go through seperate code path to handle its death which although it was giving you xp, it wasn't tracking where that xp came from.
1 parent c2962e8 commit 4e02dda

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

crawl-ref/source/mon-death.cc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,7 @@ static bool _yred_bind_soul(monster* mons, killer_type killer)
760760
return false;
761761
}
762762

763-
static bool _vampire_make_thrall(monster* mons)
763+
static bool _vampire_make_thrall(monster* mons, killer_type killer)
764764
{
765765
if (!mons->props.exists(VAMPIRIC_THRALL_KEY) || you.allies_forbidden())
766766
return false;
@@ -770,6 +770,9 @@ static bool _vampire_make_thrall(monster* mons)
770770
if (mi->was_created_by(MON_SUMM_THRALL))
771771
return false;
772772

773+
const xp_tracking_type xp_tracking = mons->xp_tracking;
774+
const unsigned int exp = exp_value(*mons);
775+
773776
// Okay, let's try to make them for real!
774777
mprf("%s rises to serve you!", mons->name(DESC_THE).c_str());
775778
record_monster_defeat(mons, KILL_YOU);
@@ -799,7 +802,7 @@ static bool _vampire_make_thrall(monster* mons)
799802
mons->mark_summoned(MON_SUMM_THRALL, 0, false);
800803
mons->add_ench(mon_enchant(ENCH_SUMMON_TIMER, &you, dur));
801804
mons_att_changed(mons);
802-
gain_exp(exp_value(*mons));
805+
_give_player_experience(exp, killer, false, true, xp_tracking);
803806

804807
// Cancel fleeing and such.
805808
mons->behaviour = BEH_SEEK;
@@ -1160,7 +1163,7 @@ static bool _monster_avoided_death(monster* mons, killer_type killer,
11601163
if (_ely_heal_monster(mons, killer, killer_index))
11611164
return true;
11621165

1163-
if (_vampire_make_thrall(mons))
1166+
if (_vampire_make_thrall(mons, killer))
11641167
return true;
11651168

11661169
return false;

0 commit comments

Comments
 (0)