refactor: archer tower aoe damage

This commit is contained in:
2021-11-30 18:38:40 +01:00
parent 8171a91ed5
commit 93e079ddb3
2 changed files with 3 additions and 1 deletions

View File

@@ -163,6 +163,8 @@ class ArcherTower : public LittleTower {
public:
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 void tick(std::uint64_t delta, World* world);
};

View File

@@ -402,7 +402,7 @@ void World::OnArcherTowerShot(MobPtr target, ArcherTower* shooter) {
bool explosiveArrows = shooter->getLevel().getPath() == TowerPath::Bottom;
notifyListeners(&WorldListener::OnArrowShot, target, shooter);
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);
}
}