refactor: separate mob ans world listener
This commit is contained in:
@@ -213,7 +213,7 @@ void ArcherTower::tick(std::uint64_t delta, World* world) {
|
||||
std::uint8_t arrows = explosiveArrows ? 2 : getLevel().getLevel();
|
||||
for (MobPtr mob : world->getMobList()) {
|
||||
if (isMobInRange(mob)) {
|
||||
world->notifyListeners(&WorldListener::OnArcherTowerShot, mob, this);
|
||||
world->getWorldNotifier().notifyListeners(&WorldListener::OnArcherTowerShot, mob, this);
|
||||
m_Timer.applyCooldown();
|
||||
arrowsShot++;
|
||||
if (arrowsShot >= arrows)
|
||||
@@ -229,8 +229,8 @@ void IceTower::tick(std::uint64_t delta, World* world) {
|
||||
for (MobPtr mob : world->getMobList()) {
|
||||
if (isMobInRange(mob)) {
|
||||
mob->addEffect(EffectType::Slowness, 1, this); // slowness for 1s every second
|
||||
if(damage > 0)
|
||||
world->notifyListeners(&WorldListener::OnMobDamage, mob, damage, this);
|
||||
if (damage > 0)
|
||||
world->getMobNotifier().notifyListeners(&MobListener::OnMobDamage, mob, 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->notifyListeners(&WorldListener::OnMobDamage, mob, getStats()->getDamage(), this);
|
||||
world->getMobNotifier().notifyListeners(&MobListener::OnMobDamage, mob, getStats()->getDamage(), this);
|
||||
} else {
|
||||
float durationSec;
|
||||
switch (getLevel().getLevel()) {
|
||||
|
||||
Reference in New Issue
Block a user