namespace V3.AI.Internal { /// /// A simple strategy for the computer player that tells him to attack the /// enemy creatures. /// internal class AttackStrategy : IStrategy { /// /// Updates the current state according to the game situtation. /// /// the current state /// the current view of the game world /// the next state indicated by this strategy public AiState Update(AiState state, IWorldView worldView) { switch (state) { case AiState.Idle: if (worldView.InitialPlebsCount - worldView.PlebsCount > 3) { return AiState.DefendPeasants; } break; case AiState.DefendPeasants: if (worldView.PlebsCount < worldView.InitialPlebsCount * 0.75 || worldView.EnemyCount > 20) { return AiState.AttackCreatures; } break; case AiState.AttackCreatures: if (worldView.NecromancerHealth < 0.1) { return AiState.AttackNecromancer; } break; case AiState.AttackNecromancer: if (worldView.NecromancerHealth >= 0.1) { return AiState.AttackCreatures; } break; } return state; } } }