summaryrefslogtreecommitdiffstats
path: root/src/Entities/Player.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Entities/Player.cpp')
-rw-r--r--src/Entities/Player.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index 1ca37c105..b4d806c4f 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -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]++;
}