예제 #1
0
        internal DiplomatCity(City enemyCity, Diplomat diplomat) : base(100, 80, 145, DialogHeight())
        {
            _enemyCity = enemyCity ?? throw new ArgumentNullException(nameof(enemyCity));
            _diplomat  = diplomat ?? throw new ArgumentNullException(nameof(diplomat));

            DialogBox.DrawText($"{_enemyCity.Player.TribeName} diplomat arrives", 0, 15, 5, 5);
            DialogBox.DrawText($"in {_enemyCity.Name}", 0, 15, 5, 5 + Resources.GetFontHeight(FONT_ID));
        }
예제 #2
0
        internal DiplomatBribe(BaseUnitLand unitToBribe, Diplomat diplomat) : base(100, 80, 135, DialogHeight(unitToBribe, diplomat.Player.Gold))
        {
            _unitToBribe = unitToBribe ?? throw new ArgumentNullException(nameof(unitToBribe));
            _diplomat    = diplomat ?? throw new ArgumentNullException(nameof(diplomat));

            _bribeCost = BribeCost(unitToBribe);
            _canBribe  = CanBribe(unitToBribe, diplomat.Player.Gold);

            DialogBox.DrawText($"{unitToBribe.Player.TribeName} {unitToBribe.Name}", 0, 15, 5, 5);
            DialogBox.DrawText($"will desert for ${_bribeCost}", 0, 15, 5, 5 + Resources.GetFontHeight(FONT_ID));
            DialogBox.DrawText($"Treasury ${diplomat.Player.Gold}", 0, 15, 5, 5 + (2 * Resources.GetFontHeight(FONT_ID)));
        }
예제 #3
0
        internal DiplomatSabotage(City enemyCity, Diplomat diplomat) : base(60, 80, 220, 56)
        {
            _enemyCity = enemyCity ?? throw new ArgumentNullException(nameof(enemyCity));
            _diplomat  = diplomat ?? throw new ArgumentNullException(nameof(diplomat));

            IBitmap spyPortrait = Icons.Spy;

            Palette palette = Common.DefaultPalette;

            for (int i = 144; i < 256; i++)
            {
                palette[i] = spyPortrait.Palette[i];
            }
            this.SetPalette(palette);

            DialogBox.AddLayer(spyPortrait, 2, 2);

            DialogBox.DrawText($"Spies Report", 0, 15, 45, 5);
            DialogBox.DrawText(_diplomat.Sabotage(_enemyCity), 0, 15, 45, 5 + Resources.GetFontHeight(FONT_ID));
            DialogBox.DrawText($"in {_enemyCity.Name}", 0, 15, 45, 5 + (2 * Resources.GetFontHeight(FONT_ID)));
        }
예제 #4
0
        internal DiplomatIncite(City cityToIncite, Diplomat diplomat) : base(100, 80, 180, 56)
        {
            _cityToIncite = cityToIncite ?? throw new ArgumentNullException(nameof(cityToIncite));
            _diplomat     = diplomat ?? throw new ArgumentNullException(nameof(diplomat));

            IBitmap spyPortrait = Icons.Spy;

            Palette palette = Common.DefaultPalette;

            for (int i = 144; i < 256; i++)
            {
                palette[i] = spyPortrait.Palette[i];
            }
            this.SetPalette(palette);

            DialogBox.AddLayer(spyPortrait, 2, 2);

            _inciteCost = Diplomat.InciteCost(cityToIncite);
            _canIncite  = Diplomat.CanIncite(cityToIncite, diplomat.Player.Gold);

            DialogBox.DrawText($"Spies Report", 0, 15, 45, 5);
            DialogBox.DrawText($"Dissidents in {_cityToIncite.Name}", 0, 15, 45, 5 + Resources.GetFontHeight(FONT_ID));
            DialogBox.DrawText($"will revolt for ${_inciteCost}", 0, 15, 45, 5 + (2 * Resources.GetFontHeight(FONT_ID)));
        }
예제 #5
0
        private void ExecuteRevealMapCommand(object t)
        {
            if (!_appContext.IsSinglePlayerGame)
            {
                return;
            }

            var map       = _appContext.CurrentGame.Universe.Map;
            var playerCiv = _appContext.LocalPlayer.Empire;
            var mapData   = _appContext.LocalPlayerEmpire.MapData;

            for (int x = 0; x < map.Width; x++)
            {
                for (int y = 0; y < map.Height; y++)
                {
                    MapLocation loc = new MapLocation(x, y);
                    mapData.SetExplored(loc, true);
                    mapData.SetScanStrength(loc, 99);
                }
            }

            var diplomat = Diplomat.Get(playerCiv);

            foreach (var civ in GameContext.Current.Civilizations)
            {
                if (civ == playerCiv)
                {
                    continue;
                }
                if (diplomat.GetForeignPower(civ).DiplomacyData.Status == ForeignPowerStatus.NoContact)
                {
                    diplomat.GetForeignPower(civ).DiplomacyData.Status = ForeignPowerStatus.Neutral;
                }
            }
            GalaxyGrid.Update();
        }
예제 #6
0
 public static Show DiplomatSabotage(City enemyCity, Diplomat diplomat) => new Show(new DiplomatSabotage(enemyCity, diplomat));
예제 #7
0
 public static Show DiplomatIncite(City enemyCity, Diplomat diplomat) => new Show(new DiplomatIncite(enemyCity, diplomat));
예제 #8
0
 public static Show DiplomatCity(City enemyCity, Diplomat diplomat) => new Show(new DiplomatCity(enemyCity, diplomat));
예제 #9
0
 public static Show DiplomatBribe(BaseUnitLand unitToBribe, Diplomat diplomat) => new Show(new DiplomatBribe(unitToBribe, diplomat));
예제 #10
0
        internal static void CityProduction(City city)
        {
            if (city == null || city.Size == 0 || city.Tile == null)
            {
                return;
            }

            Player      player     = Game.GetPlayer(city.Owner);
            IProduction production = null;

            // Create 2 defensive units per city
            if (player.HasAdvance <LaborUnion>())
            {
                if (city.Tile.Units.Count(x => x is MechInf) < 2)
                {
                    production = new MechInf();
                }
            }
            else if (player.HasAdvance <Conscription>())
            {
                if (city.Tile.Units.Count(x => x is Riflemen) < 2)
                {
                    production = new Riflemen();
                }
            }
            else if (player.HasAdvance <Gunpowder>())
            {
                if (city.Tile.Units.Count(x => x is Musketeers) < 2)
                {
                    production = new Musketeers();
                }
            }
            else if (player.HasAdvance <BronzeWorking>())
            {
                if (city.Tile.Units.Count(x => x is Phalanx) < 2)
                {
                    production = new Phalanx();
                }
            }
            else
            {
                if (city.Tile.Units.Count(x => x is Militia) < 2)
                {
                    production = new Militia();
                }
            }

            // Create city improvements
            if (production == null)
            {
                if (!city.HasBuilding <Barracks>())
                {
                    production = new Barracks();
                }
                else if (player.HasAdvance <Pottery>() && !city.HasBuilding <Granary>())
                {
                    production = new Granary();
                }
                else if (player.HasAdvance <CeremonialBurial>() && !city.HasBuilding <Temple>())
                {
                    production = new Temple();
                }
                else if (player.HasAdvance <Masonry>() && !city.HasBuilding <CityWalls>())
                {
                    production = new CityWalls();
                }
            }

            // Create Settlers
            if (production == null)
            {
                if (city.Size > 3 && !city.Units.Any(x => x is Settlers) && player.Cities.Length < 10)
                {
                    production = new Settlers();
                }
            }

            // Create some other unit
            if (production == null)
            {
                if (city.Units.Length < 4)
                {
                    if (player.Government is Republic || player.Government is Democratic)
                    {
                        if (player.HasAdvance <Writing>())
                        {
                            production = new Diplomat();
                        }
                    }
                    else
                    {
                        if (player.HasAdvance <Automobile>())
                        {
                            production = new Armor();
                        }
                        else if (player.HasAdvance <Metallurgy>())
                        {
                            production = new Cannon();
                        }
                        else if (player.HasAdvance <Chivalry>())
                        {
                            production = new Knights();
                        }
                        else if (player.HasAdvance <TheWheel>())
                        {
                            production = new Chariot();
                        }
                        else if (player.HasAdvance <HorsebackRiding>())
                        {
                            production = new Cavalry();
                        }
                        else if (player.HasAdvance <IronWorking>())
                        {
                            production = new Legion();
                        }
                    }
                }
                else
                {
                    if (player.HasAdvance <Trade>())
                    {
                        production = new Caravan();
                    }
                }
            }

            // Set random production
            if (production == null)
            {
                IProduction[] items = city.AvailableProduction.ToArray();
                production = items[Common.Random.Next(items.Length)];
            }

            city.SetProduction(production);
        }
예제 #11
0
        private static IUnit CreateUnit(UnitType type, int x, int y)
        {
            IUnit unit;

            switch (type)
            {
            case UnitType.Settlers: unit = new Settlers(); break;

            case UnitType.Militia: unit = new Militia(); break;

            case UnitType.Phalanx: unit = new Phalanx(); break;

            case UnitType.Legion: unit = new Legion(); break;

            case UnitType.Musketeers: unit = new Musketeers(); break;

            case UnitType.Riflemen: unit = new Riflemen(); break;

            case UnitType.Cavalry: unit = new Cavalry(); break;

            case UnitType.Knights: unit = new Knights(); break;

            case UnitType.Catapult: unit = new Catapult(); break;

            case UnitType.Cannon: unit = new Cannon(); break;

            case UnitType.Chariot: unit = new Chariot(); break;

            case UnitType.Armor: unit = new Armor(); break;

            case UnitType.MechInf: unit = new MechInf(); break;

            case UnitType.Artillery: unit = new Artillery(); break;

            case UnitType.Fighter: unit = new Fighter(); break;

            case UnitType.Bomber: unit = new Bomber(); break;

            case UnitType.Trireme: unit = new Trireme(); break;

            case UnitType.Sail: unit = new Sail(); break;

            case UnitType.Frigate: unit = new Frigate(); break;

            case UnitType.Ironclad: unit = new Ironclad(); break;

            case UnitType.Cruiser: unit = new Cruiser(); break;

            case UnitType.Battleship: unit = new Battleship(); break;

            case UnitType.Submarine: unit = new Submarine(); break;

            case UnitType.Carrier: unit = new Carrier(); break;

            case UnitType.Transport: unit = new Transport(); break;

            case UnitType.Nuclear: unit = new Nuclear(); break;

            case UnitType.Diplomat: unit = new Diplomat(); break;

            case UnitType.Caravan: unit = new Caravan(); break;

            default: return(null);
            }
            unit.X         = x;
            unit.Y         = y;
            unit.MovesLeft = unit.Move;
            return(unit);
        }