public void Update() { var player = _country.PlayerCountry; if (_army.GetAvailableCount(player) > 0) { var locPairs = _conquest.GetAcceptableLocations(player); foreach (var pair in locPairs) { var homeLoc = pair.Item1; var targetLoc = pair.Item2; var name = targetLoc.Name; if (_discovery.IsDiscovered(player, targetLoc)) { if (targetLoc.Owner != null) { var raceName = LocUtils.TranslateRaceName(targetLoc.Owner); name += $" ({targetLoc.Owner.Name}, {raceName})"; } } else { name += " (?)"; } name += "."; _context.AddCase(name, () => TryStartConquest(homeLoc, targetLoc, player)); } } _context.AddCase( Content.go_back, () => _context.GoToRelatedContext <ArmyController>()); }
void ShowLegend() { _out.Write(); foreach (var pair in _colorMap) { if (_country.Countries.Contains(pair.Key)) { _out.WriteCustom($"{pair.Key.Name} ({LocUtils.TranslateRaceName(pair.Key)}) ", pair.Value); } } }
public void OnConquest(ConquestResult result) { if ((result.Defender != null) && (result.Defender == _country.PlayerCountry)) { _out.WriteFormat( Content.enemy_conquest_result, result.Location.Name, result.Invader.Name, LocUtils.TranslateRaceName(result.Invader), result.InvaderSquad.Count, result.DefenderSquad.Count, result.InvaderSquad.Loses, result.DefenderSquad.Loses ); _out.WriteFormat(result.Success ? Content.enemy_conquest_success : Content.enemy_conquest_fail, result.Location.Name); } }
void DescribeLocation(Country country, Location loc) { _out.WriteFormat(Content.here_is, loc.Name); if (!_discovery.IsDiscovered(country, loc)) { _out.Write(Content.here_unknown); } else if (loc.Owner != null) { var raceName = LocUtils.TranslateRaceName(loc.Owner); _out.WriteFormat(Content.here_live, loc.Owner.Name, raceName); } else { _out.Write(Content.here_empty); } }
void UpdateRaceSelection() { _output.Write(Content.race_select); var races = _races.AllRaces; for (var i = 0; i < races.Count; i++) { _output.Write($"{i + 1}) {LocUtils.TranslateRaceName(races[i])}"); } do { var selection = _input.ReadInt(); if ((selection > 0) && (selection <= races.Count)) { _races.SelectPlayerRace(races[selection - 1]); return; } } while (true); }
public void OnCountryRemoved(Country country, string reason) { if (_country.PlayerCountry == country) { Fail(reason); } if (!HasOtherCountries()) { Win(Content.win_conquest); } else { var raceName = LocUtils.TranslateRaceName(country); _out.WriteFormat(Content.enemy_failed, country.Name, raceName); if (_country.Countries.Count == 1) { var lastCountry = _country.Countries[0]; var lastRace = LocUtils.TranslateRaceName(lastCountry); Win(string.Format(Content.one_alive, lastCountry.Name, lastRace)); } } }