feat: add poison tower
This commit is contained in:
@@ -86,8 +86,8 @@ const std::map<std::pair<TowerType, TowerLevel>, TowerStats> TowerConstants = {
|
||||
{{TowerType::Poison, {3, TowerPath::Top}}, {6, 0, 13}},
|
||||
{{TowerType::Poison, {4, TowerPath::Top}}, {5, 0, 15}},
|
||||
|
||||
{{TowerType::Poison, {3, TowerPath::Bottom}}, {5, 0, 13}},
|
||||
{{TowerType::Poison, {4, TowerPath::Bottom}}, {6, 0, 15}},
|
||||
{{TowerType::Poison, {3, TowerPath::Bottom}}, {5, 10, 13}},
|
||||
{{TowerType::Poison, {4, TowerPath::Bottom}}, {6, 20, 15}},
|
||||
|
||||
//-----------------------------------------------------------------
|
||||
|
||||
@@ -248,7 +248,40 @@ void MageTower::tick(std::uint64_t delta, World* world) {
|
||||
}
|
||||
|
||||
void PoisonTower::tick(std::uint64_t delta, World* world) {
|
||||
if (m_Timer.update(delta)) {
|
||||
for (MobPtr mob : world->getMobList()) {
|
||||
if (isMobInRange(mob)) {
|
||||
if(getLevel().getPath() == TowerPath::Bottom){
|
||||
mob->damage(getStats()->getDamage(), this);
|
||||
}else{
|
||||
float durationSec;
|
||||
switch(getLevel().getLevel()){
|
||||
case 1:
|
||||
durationSec = 5;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
durationSec = 15;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
durationSec = 30;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
durationSec = 1e10; // about 3 million hours. It should be enough
|
||||
break;
|
||||
|
||||
default:
|
||||
durationSec = 0; // how did we get there ?
|
||||
break;
|
||||
}
|
||||
mob->addEffect(EffectType::Poison, durationSec, this);
|
||||
}
|
||||
m_Timer.applyCooldown();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QuakeTower::tick(std::uint64_t delta, World* world) {
|
||||
|
||||
Reference in New Issue
Block a user