refactor: archer tower aoe damage
This commit is contained in:
@@ -163,6 +163,8 @@ class ArcherTower : public LittleTower {
|
|||||||
public:
|
public:
|
||||||
ArcherTower(TowerID id, std::uint16_t x, std::uint16_t y, PlayerID builder) : LittleTower(id, getType(), x, y, builder) {}
|
ArcherTower(TowerID id, std::uint16_t x, std::uint16_t y, PlayerID builder) : LittleTower(id, getType(), x, y, builder) {}
|
||||||
|
|
||||||
|
constexpr static float ExplosionRadius = 1.5f;
|
||||||
|
|
||||||
virtual TowerType getType() const { return TowerType::Archer; }
|
virtual TowerType getType() const { return TowerType::Archer; }
|
||||||
virtual void tick(std::uint64_t delta, World* world);
|
virtual void tick(std::uint64_t delta, World* world);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -402,7 +402,7 @@ void World::OnArcherTowerShot(MobPtr target, ArcherTower* shooter) {
|
|||||||
bool explosiveArrows = shooter->getLevel().getPath() == TowerPath::Bottom;
|
bool explosiveArrows = shooter->getLevel().getPath() == TowerPath::Bottom;
|
||||||
notifyListeners(&WorldListener::OnArrowShot, target, shooter);
|
notifyListeners(&WorldListener::OnArrowShot, target, shooter);
|
||||||
if (explosiveArrows) {
|
if (explosiveArrows) {
|
||||||
notifyListeners(&WorldListener::OnExplosion, utils::shape::Circle{ target->getCenterX(), target->getCenterY(), 1.0f }, 10.0f, shooter);
|
notifyListeners(&WorldListener::OnExplosion, utils::shape::Circle{ target->getCenterX(), target->getCenterY(), ArcherTower::ExplosionRadius }, shooter->getStats()->getDamage(), shooter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user