1
0
Fork 0

Snipe skeleton achievment

master
Rorkh 1 year ago committed by Tiger Wang
parent 028a5735c5
commit 798fdb0709

@ -396,7 +396,7 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
if (a_TDI.Attacker != nullptr)
{
a_TDI.Attacker->Killed(this);
a_TDI.Attacker->Killed(*this, a_TDI.DamageType);
}
return true;
@ -570,7 +570,7 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
if (a_TDI.Attacker != nullptr)
{
a_TDI.Attacker->Killed(this);
a_TDI.Attacker->Killed(*this, a_TDI.DamageType);
}
}
return true;

@ -351,8 +351,8 @@ public:
// tolua_begin
/** Called when the entity kills another entity */
virtual void Killed(cEntity * a_Victim) {}
/** Called when the entity kills another entity. */
virtual void Killed(const cEntity & a_Victim, eDamageType a_DamageType) {}
/** Heals the specified amount of HPs */
virtual void Heal(int a_HitPoints);

@ -883,23 +883,36 @@ void cPlayer::KilledBy(TakeDamageInfo & a_TDI)
void cPlayer::Killed(cEntity * a_Victim)
void cPlayer::Killed(const cEntity & a_Victim, eDamageType a_DamageType)
{
cScoreboard & ScoreBoard = m_World->GetScoreBoard();
if (a_Victim->IsPlayer())
if (a_Victim.IsPlayer())
{
m_Stats.Custom[CustomStatistic::PlayerKills]++;
ScoreBoard.AddPlayerScore(GetName(), cObjective::otPlayerKillCount, 1);
}
else if (a_Victim->IsMob())
else if (a_Victim.IsMob())
{
if (static_cast<cMonster *>(a_Victim)->GetMobFamily() == cMonster::mfHostile)
const auto & Monster = static_cast<const cMonster &>(a_Victim);
if (Monster.GetMobFamily() == cMonster::mfHostile)
{
AwardAchievement(CustomStatistic::AchKillEnemy);
}
if ((Monster.GetMobType() == eMonsterType::mtSkeleton) && (a_DamageType == eDamageType::dtRangedAttack))
{
const double DistX = GetPosX() - Monster.GetPosX();
const double DistZ = GetPosZ() - Monster.GetPosZ();
if ((DistX * DistX + DistZ * DistZ) >= 2500.0)
{
AwardAchievement(CustomStatistic::AchSnipeSkeleton);
}
}
m_Stats.Custom[CustomStatistic::MobKills]++;
}

@ -410,7 +410,7 @@ public:
virtual void KilledBy(TakeDamageInfo & a_TDI) override;
virtual void Killed(cEntity * a_Victim) override;
virtual void Killed(const cEntity & a_Victim, eDamageType a_DamageType) override;
void Respawn(void); // tolua_export

@ -68,7 +68,3 @@ void cSkeleton::SpawnOn(cClientHandle & a_ClientHandle)
Super::SpawnOn(a_ClientHandle);
a_ClientHandle.SendEntityEquipment(*this, 0, cItem(E_ITEM_BOW));
}

@ -25,7 +25,3 @@ public:
virtual bool IsUndead(void) override { return true; }
} ;

Loading…
Cancel
Save