[Client] Set actor killer correctly for spells that do damage over time

Additionally, clean up comments related to other code that sets actor killers.
pull/506/head
David Cernat 6 years ago
parent 6e1504f0a1
commit 5d9893ee92

@ -553,9 +553,10 @@ namespace MWClass
/* /*
Start of tes3mp addition Start of tes3mp addition
If the attacker was the LocalPlayer or LocalActor, record their target and send a packet with it If the attacker was the LocalPlayer or LocalActor, record their target and send a
packet with it
If the victim was a LocalActor who died, record their attacker as the deathReason If the victim was a LocalActor who died, record their attacker as the killer
*/ */
mwmp::Attack *localAttack = MechanicsHelper::getLocalAttack(attacker); mwmp::Attack *localAttack = MechanicsHelper::getLocalAttack(attacker);

@ -966,12 +966,13 @@ namespace MWClass
/* /*
Start of tes3mp addition Start of tes3mp addition
If the attacker was the LocalPlayer or LocalActor, record their target and send a packet with it If the attacker was the LocalPlayer or LocalActor, record their target and send a
packet with it
If the victim was the LocalPlayer, check whether packets should be sent about If the victim was the LocalPlayer, check whether packets should be sent about
their new dynamic stats and position their new dynamic stats and position
If the victim was a LocalActor who died, record their attacker as the deathReason If the victim was a LocalActor who died, record their attacker as the killer
*/ */
mwmp::Attack *localAttack = MechanicsHelper::getLocalAttack(attacker); mwmp::Attack *localAttack = MechanicsHelper::getLocalAttack(attacker);

@ -842,6 +842,22 @@ namespace MWMechanics
if (isDamageEffect) if (isDamageEffect)
{ {
/*
Start of tes3mp addition
If the victim was a LocalActor who died, record the caster as the killer
*/
if (mwmp::Main::get().getCellController()->isLocalActor(ptr))
{
bool isSuicide = ptr == caster || caster.isEmpty();
mwmp::Main::get().getCellController()->getLocalActor(ptr)->killer = isSuicide ?
MechanicsHelper::getTarget(ptr) : MechanicsHelper::getTarget(caster);
}
/*
End of tes3mp addition
*/
if (caster == player || playerFollowers.find(caster) != playerFollowers.end()) if (caster == player || playerFollowers.find(caster) != playerFollowers.end())
{ {
if (caster.getClass().getNpcStats(caster).isWerewolf()) if (caster.getClass().getNpcStats(caster).isWerewolf())

@ -537,7 +537,7 @@ namespace MWMechanics
/* /*
Start of tes3mp addition Start of tes3mp addition
If the victim was a LocalPlayer or LocalActor who died, record their attacker as the deathReason If the victim was a LocalPlayer or LocalActor who died, record the caster as the killer
*/ */
if (!wasDead && isDead) if (!wasDead && isDead)
{ {

Loading…
Cancel
Save