summaryrefslogtreecommitdiffstats
path: root/src/Entities/Player.cpp
diff options
context:
space:
mode:
authorRorkh <rorkh@internet.ru>2021-09-18 10:18:05 +0200
committerTiger Wang <ziwei.tiger@outlook.com>2021-10-02 22:18:18 +0200
commit798fdb07092fceaccfde41d2f27e2756f29f4eda (patch)
treeaaa7f6bd1be6a33e08be230bda3166b31a2b57a2 /src/Entities/Player.cpp
parentSpectation: add dedicated pathway for spectator mode (#5303) (diff)
downloadcuberite-798fdb07092fceaccfde41d2f27e2756f29f4eda.tar
cuberite-798fdb07092fceaccfde41d2f27e2756f29f4eda.tar.gz
cuberite-798fdb07092fceaccfde41d2f27e2756f29f4eda.tar.bz2
cuberite-798fdb07092fceaccfde41d2f27e2756f29f4eda.tar.lz
cuberite-798fdb07092fceaccfde41d2f27e2756f29f4eda.tar.xz
cuberite-798fdb07092fceaccfde41d2f27e2756f29f4eda.tar.zst
cuberite-798fdb07092fceaccfde41d2f27e2756f29f4eda.zip
Diffstat (limited to '')
-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]++;
}