Skip to content

Commit

Permalink
s
Browse files Browse the repository at this point in the history
  • Loading branch information
jonylu7 committed Jun 14, 2024
1 parent 99d7adf commit 4263891
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/AI/AIScripts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<int>(m_paid)) {
m_EnemyObjectManager->getTotalCurrency() >
2000 + 100 + static_cast<int>(m_paid)) {
spawnUnit();
}
return;
Expand Down Expand Up @@ -216,14 +217,18 @@ 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) {
m_EnemyObjectManager->setBarrackWayPointByCell(
{m_baseCell.x - 1 +
5 * (m_EnemyObjectManager->getAvatarCount() % 3),
m_baseCell.y - 1});

m_EnemyObjectManager->spawnToWayPoint(m_selectedAvatarType,
HouseType::ENEMY);
setCost(0, SpawnMode::AVATAR);
Expand Down

0 comments on commit 4263891

Please sign in to comment.