refactor: mob die event

This commit is contained in:
2021-12-11 19:51:45 +01:00
parent 0af4cd506c
commit a241d7691b
5 changed files with 32 additions and 27 deletions

View File

@@ -230,7 +230,7 @@ void IceTower::tick(std::uint64_t delta, World* world) {
if (isMobInRange(mob)) {
mob->addEffect(EffectType::Slowness, 1, this); // slowness for 1s every second
if (damage > 0)
world->getMobNotifier().notifyListeners(&MobListener::OnMobDamage, mob, damage, this);
world->getMobNotifier().notifyListeners(&MobListener::OnMobDamage, mob.get(), damage, this);
m_Timer.applyCooldown();
}
}
@@ -253,7 +253,7 @@ void PoisonTower::tick(std::uint64_t delta, World* world) {
for (MobPtr mob : world->getMobList()) {
if (isMobInRange(mob)) {
if (getLevel().getPath() == TowerPath::Bottom) {
world->getMobNotifier().notifyListeners(&MobListener::OnMobDamage, mob, getStats()->getDamage(), this);
world->getMobNotifier().notifyListeners(&MobListener::OnMobDamage, mob.get(), getStats()->getDamage(), this);
} else {
float durationSec;
switch (getLevel().getLevel()) {