Пример #1
0
        internal const int MAX_FLAG_COUNT     = 5; // Максимальное число активных флагов

        public Player(Lobby lobby, int index, string name, TypePlayer typePlayer) : base()
        {
            Lobby            = lobby;
            Name             = name;
            TypePlayer       = typePlayer;
            Wins             = 0;
            Loses            = 0;
            PlayerIndex      = index;
            ImageIndexAvatar = (typePlayer == TypePlayer.Computer ? PlayerIndex : Program.formMain.Settings.IndexInternalAvatar) + Program.formMain.ImageIndexFirstAvatar;
            ResultLastBattle = ResultBattle.None;

            // Создаем справочик количества приоритетов флагов
            foreach (PriorityExecution pe in Enum.GetValues(typeof(PriorityExecution)))
            {
                QuantityFlags.Add(pe, 0);
            }

            // Настраиваем игрока согласно настройкам лобби
            DurabilityCastle           = Lobby.TypeLobby.DurabilityCastle;
            PointConstructionGuild     = lobby.TypeLobby.StartPointConstructionGuild;
            PointConstructionEconomic  = lobby.TypeLobby.StartPointConstructionEconomic;
            PointConstructionTemple    = 0;
            PointConstructionTradePost = 0;
            SetQuantityFlags(lobby.TypeLobby.StartQuantityFlags);

            // Инициализация зданий
            foreach (TypeConstruction tck in FormMain.Config.TypeConstructionsOfKingdom)
            {
                Buildings.Add(new PlayerBuilding(this, tck));
            }

            // Инициализация логов
            Lairs = new PlayerLair[lobby.TypeLobby.LairsLayers, lobby.TypeLobby.LairsHeight, lobby.TypeLobby.LairsWidth];

            GenerateLairs();

            Castle = GetPlayerBuilding(FormMain.Config.FindTypeEconomicConstruction(FormMain.Config.IDBuildingCastle));

            Gold = Lobby.TypeLobby.Gold;
            if (TypePlayer == TypePlayer.Computer)
            {
                Gold = 100_000;
            }

            LevelGreatness             = 1;
            PointGreatnessForNextLevel = 100;

            PlayerHero king      = Castle.HireHero(FormMain.Config.FindTypeHero("King"));
            PlayerHero advisor   = Castle.HireHero(FormMain.Config.FindTypeHero("Advisor"));
            PlayerHero captain   = Castle.HireHero(FormMain.Config.FindTypeHero("Captain"));
            PlayerHero treasurer = Castle.HireHero(FormMain.Config.FindTypeHero("Treasurer"));

            //
            AddItem(new PlayerItem(FormMain.Config.FindItem("PotionOfHealth"), 10, true));
            AddItem(new PlayerItem(FormMain.Config.FindItem("PotionOfHealth"), 10, true));
            AddItem(new PlayerItem(FormMain.Config.FindItem("PotionOfMana"), 10, true));
            AddItem(new PlayerItem(FormMain.Config.FindItem("Regeneration"), 1, true));
            AddItem(new PlayerItem(FormMain.Config.FindItem("Protection"), 1, true));
            AddItem(new PlayerItem(FormMain.Config.FindItem("ImpProtection"), 2, true));

            ValidateHeroes();
        }
Пример #2
0
 public PlayerHero(PlayerBuilding pb, BattleParticipant bp, TypeHero th) : base(th, bp)
 {
     Building  = pb;
     DayOfHire = Player.Lobby.Turn;
     TypeHero  = th;
 }
 public PlayerResearch(PlayerBuilding pb, Research r)
 {
     Building = pb;
     Research = r;
 }
Пример #4
0
 public PlayerHero(PlayerBuilding pb, BattleParticipant bp) : base(pb.Building.TrainedHero, bp)
 {
     Building  = pb;
     DayOfHire = Player.Lobby.Turn;
     TypeHero  = pb.Building.TrainedHero;
 }