From 4263891296d5442aadf8805416b627e43453ce4f Mon Sep 17 00:00:00 2001 From: jonylu7 Date: Fri, 14 Jun 2024 21:38:43 +0800 Subject: [PATCH] s --- src/AI/AIScripts.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/AI/AIScripts.cpp b/src/AI/AIScripts.cpp index f2d7de3..4592782 100644 --- a/src/AI/AIScripts.cpp +++ b/src/AI/AIScripts.cpp @@ -132,7 +132,8 @@ void AIScript::setCost(float cost, SpawnMode spawnMode) { void AIScript::buildBasic() { if (m_selectedBuildingType != UnitType::NONE) { if (m_selectedBuildingType == UnitType::ORE_REF && - m_EnemyObjectManager->getTotalCurrency() > 2000 + 100 + static_cast(m_paid)) { + m_EnemyObjectManager->getTotalCurrency() > + 2000 + 100 + static_cast(m_paid)) { spawnUnit(); } return; @@ -216,7 +217,10 @@ void AIScript::UpdateSpawnScript(SpawnMode spawnMode) { } } if (spawnMode == SpawnMode::AVATAR) { - if (m_selectedAvatarType == UnitType::NONE) { + if (m_selectedAvatarType == UnitType::NONE || + m_EnemyObjectManager->getStructureManager() + ->getStructureArray() + ->ifBarrackBuilt() == false) { return; } if (m_selectedAvatarType == UnitType::INFANTRY) { @@ -224,6 +228,7 @@ void AIScript::UpdateSpawnScript(SpawnMode spawnMode) { {m_baseCell.x - 1 + 5 * (m_EnemyObjectManager->getAvatarCount() % 3), m_baseCell.y - 1}); + m_EnemyObjectManager->spawnToWayPoint(m_selectedAvatarType, HouseType::ENEMY); setCost(0, SpawnMode::AVATAR);