//---------------------------------------------------------------------------------------------- bool WinGameGoal::SuccessConditionsSatisfied(RtsGame& game) { EntityList enemyEntities; game.Enemy()->Entities(enemyEntities); // All enemy units are destroyed, win game! return enemyEntities.empty(); }
//---------------------------------------------------------------------------------------------- vector<GoalEx*> WinGameGoal::GetSucceededInstances(RtsGame &game) { vector<GoalEx*> succeededGoals; EntityList enemyEntities; game.Enemy()->Entities(enemyEntities); if (enemyEntities.empty()) { PlanStepParameters params; params[PARAM_StrategyTypeId] = STRTYPE_EarlyTierRush; succeededGoals.push_back(g_GoalFactory.GetGoal(GOALEX_WinGame, params, true)); LogInfo("WinGameGoal succeeded with strategt type='%s'", Enums[params[PARAM_StrategyTypeId]]); } return succeededGoals; }
//---------------------------------------------------------------------------------------------- bool AttackEntityAction::SuccessConditionsSatisfied(RtsGame& game) { _ASSERTE(PlanStepEx::GetState() == ESTATE_Executing); bool targetExists = g_Assist.DoesEntityObjectExist(m_targetId, PLAYER_Enemy); if (targetExists) { GameEntity* pGameTarget = game.Enemy()->GetEntity(m_targetId); _ASSERTE(pGameTarget); ObjectStateType targetState = (ObjectStateType)pGameTarget->P(OP_State); return targetState == OBJSTATE_UnderAttack; } else { return true; } }