Ejemplo n.º 1
0
        public HexaModel(int value, HexaKind kind, SourceKind sourceKind, SourceBuildingKind buildingKind,SourceAll sourceBuildingCost)
        {
            if (kind == HexaKind.Water)
            {
                this.hexaID = -1;
            } else
                this.hexaID = ++counter;

            this.sourceBuildingCost = sourceBuildingCost;

            this.kind = kind;
            this.sourceKind = sourceKind;
            this.buildingKind = buildingKind;

            this.startSource = value;
            this.towns = new TownModel[(int) TownPos.Count];
            this.roads = new RoadModel[(int)RoadPos.Count];
            this.townOwner = new Boolean[(int)TownPos.Count];
            this.roadOwner = new Boolean[(int)RoadPos.Count];

            sourceDisaster = false;
            sourceMiracle = false;
            hexaDestroy = false;
            captureIs = false;
            capturePlayer = null;
        }
Ejemplo n.º 2
0
 public BuildingPromptItem(int townID, int hexaID, BuildingKind kind, String title, String description, SourceAll source, bool isSourceCost, Texture2D icon)
     : base(title, description, source, isSourceCost, false, icon)
 {
     this.townID = townID;
     this.hexaID = hexaID;
     this.kind = kind;
 }
Ejemplo n.º 3
0
 public SourceAll(SourceAll b)
 {
     corn = b.corn;
     wood = b.wood;
     stone = b.stone;
     meat = b.meat;
     ore = b.ore;
 }
Ejemplo n.º 4
0
        public Player(String name, Color color, IComponentAI componentAI, int orderID, int[][] personality, bool gen)
        {
            this.orderID = orderID;
            this.gen = gen;
            points = new int[(int) PlayerPoints.Count];
            prevSource = new SourceAll(0);
            source = new SourceAll(0);
            transactionSource = new SourceAll(0);
            sumSpentSources = new SourceAll(0);

            ClearCollectSources();
            collectSourcesNormal = new SourceAll(0);

            buildingCount = new int[(int) Building.Count];
            for (int loop1 = 0; loop1 < (int)Building.Count; loop1++)
            {
                buildingCount[loop1] = 0;
            }

            licenceMarket = new LicenceKind[(int)SourceKind.Count];
            for (int loop1 = 0; loop1 < (int)SourceBuildingKind.Count; loop1++)
            {
                licenceMarket[loop1] = LicenceKind.NoLicence;
            }

            upgradeMonastery = new UpgradeKind[(int) SourceBuildingKind.Count];
            for (int loop1 = 0; loop1 < (int)SourceBuildingKind.Count; loop1++)
            {
                upgradeMonastery[loop1] = UpgradeKind.NoUpgrade;
            }

            this.color = color;
            this.name = name;
            this.componentAI = componentAI;
            this.personality = personality;

            materialChanged = false;
            active = true;

            monastery = new List<IMonastery>();
            market = new List<IMarket>();
            fort = new List<IFort>();
            town = new List<ITown>();
            road = new List<IRoad>();

            statistic = new Statistic();
        }
Ejemplo n.º 5
0
 public int CanChangeSourcesFor(SourceAll source)
 {
     return map.GetMapController().CanChangeSourcesFor(source);
 }
Ejemplo n.º 6
0
 public bool ChangeSourcesFor(SourceAll source)
 {
     return map.GetMapController().ChangeSourcesFor(source);
 }
Ejemplo n.º 7
0
 public void SetMaterialChange(SourceAll change)
 {
     materialChanged = true;
     prevSource = change;
 }
Ejemplo n.º 8
0
        public void PayForSomething(ISourceAll cost)
        {
            SourceAll sourceCost = (SourceAll)cost;

            ChangeSources(-sourceCost.GetWood(), -sourceCost.GetStone(), -sourceCost.GetCorn(), -sourceCost.GetMeat(), -sourceCost.GetOre());

            sumSpentSources = sumSpentSources + sourceCost;

            source = source - sourceCost;
        }
Ejemplo n.º 9
0
 public void ClearCollectSources()
 {
     collectSourcesLastTurn = new SourceAll(0);
     collectSourcesNormal = new SourceAll(0);
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Remembers state of material from previous round, active when active player is changed
 /// </summary>
 public void ChangeSources(int wood, int stone, int corn, int meat, int ore)
 {
     materialChanged = true;
     prevSource = new SourceAll(corn, meat, stone, wood, ore);
 }
Ejemplo n.º 11
0
 public void AddSources(SourceAll amount)
 {
     source = source + amount;
 }
Ejemplo n.º 12
0
 public void AddSources(SourceAll amount, TransactionState state)
 {
     switch (state)
     {
         case TransactionState.TransactionStart :
             if (transactionSource.Equals(new SourceAll(0)))
                 transactionSource = amount;
             else
                 transactionSource += amount;
             break;
         case TransactionState.TransactionMiddle :
             transactionSource = transactionSource + amount;
             break;
         case TransactionState.TransactionEnd :
             transactionSource = transactionSource + amount;
             source = source + transactionSource;
             ChangeSources(transactionSource.GetWood(), transactionSource.GetStone(), transactionSource.GetCorn(), transactionSource.GetMeat(), transactionSource.GetOre());
             transactionSource = new SourceAll(0);
             break;
     }
 }
Ejemplo n.º 13
0
 public void AddCollectSources(SourceAll normal, SourceAll now)
 {
     collectSourcesNormal += normal;
     collectSourcesLastTurn += now;
 }
Ejemplo n.º 14
0
        public SourceAll GetBuildingCost(int pos, BuildingKind kind)
        {
            SourceAll cost = new SourceAll(0);
            switch (kind)
            {
                case BuildingKind.SourceBuilding:
                    cost = (SourceAll) hexaNeighbour[pos].GetSourceBuildingCost();
                    break;

                case BuildingKind.FortBuilding:
                    cost = Settings.costFort;
                    break;

                case BuildingKind.MarketBuilding:
                    cost = Settings.costMarket;
                    break;

                case BuildingKind.MonasteryBuilding:
                    cost = Settings.costMonastery;
                    break;
            }
            return cost;
        }
Ejemplo n.º 15
0
        public void CollectSources(Player player)
        {
            SourceAll sourceNow = new SourceAll(0);
            SourceAll sourceNormal = new SourceAll(0);
            int amountNow;
            int amountNormal;

            for(int loop1 = 0; loop1 < 3; loop1++)
            {
                if (hexaNeighbour[loop1] != null &&
                    buildingKind[loop1] == BuildingKind.SourceBuilding)
                {
                    SourceBuildingModel tempBuilding = (SourceBuildingModel) building[loop1];
                    float multiply = (tempBuilding.GetUpgrade() == UpgradeKind.SecondUpgrade) ? 2.0f : (tempBuilding.GetUpgrade() == UpgradeKind.FirstUpgrade) ? 1.5f : 1.0f;

                    amountNormal = (int) (hexaNeighbour[loop1].GetStartSource() * multiply);
                    amountNow = (int)(hexaNeighbour[loop1].GetCurrentSource() * multiply);

                    if (player == hexaNeighbour[loop1].GetCapturedPlayer() ||
                        (player == playerOwner && !hexaNeighbour[loop1].GetCaptured()))
                    {
                        switch (hexaNeighbour[loop1].GetKind())
                        {
                            case HexaKind.Forest:
                                sourceNow    += new SourceAll(0, 0, 0, amountNow, 0);
                                sourceNormal += new SourceAll(0, 0, 0, amountNormal, 0);
                                break;

                            case HexaKind.Stone:
                                sourceNow    += new SourceAll(0, 0, amountNow, 0, 0);
                                sourceNormal += new SourceAll(0, 0, amountNormal, 0, 0);
                                break;

                            case HexaKind.Cornfield:
                                sourceNow    += new SourceAll(amountNow, 0, 0, 0, 0);
                                sourceNormal += new SourceAll(amountNormal, 0, 0, 0, 0);
                                break;

                            case HexaKind.Pasture:
                                sourceNow    += new SourceAll(0, amountNow, 0, 0, 0);
                                sourceNormal += new SourceAll(0, amountNormal, 0, 0, 0);
                                break;

                            case HexaKind.Mountains:
                                sourceNow    += new SourceAll(0, 0, 0, 0, amountNow);
                                sourceNormal += new SourceAll(0, 0, 0, 0, amountNormal);
                                break;
                        }
                    }
                }
            }
            player.AddSources(sourceNow, TransactionState.TransactionMiddle);
            player.AddCollectSources(sourceNormal, sourceNow);
        }