// builds a list a the given country's enemy neighbours public List <string> EnemyNeighbourList(string country) { enemyNeighbours = new List <string> (); // all the given country's neighbours neighbours = targetingNetwork.Neighbours(country); // add all enemy neighbours into enemyNeighbour list foreach (string neighbour in neighbours) { if (!teamChecker.UnderControlName(neighbour)) { enemyNeighbours.Add(neighbour); } } return(enemyNeighbours); }
// Selects which country to attack given an attacker has been selected void SelectDefender() { // list of the attacking country's Neighbours neighbours = targetingNetwork.Neighbours(attackingCountry); // targets an enemy country if its army size is < the one is can attack with (number on land - 1) for (int i = 0; i < neighbours.Length; i++) { defendingCountry = neighbours [i]; UpdateArmySizes(); if (!teamChecker.UnderControlName(defendingCountry) & (attackerArmySize + 1) > defenderArmySize) { break; } // setting atttacker army none sense value stops assault if there are no countries to attack else if (i == neighbours.Length - 1) { attackerArmySize = 0; return; } } // tags attacker and defender AddTag("AttackingCountry", attackingCountry); AddTag("DefendingCountry", defendingCountry); }