예제 #1
0
        int townID; // where is this building

        #endregion Fields

        #region Constructors

        public FortModel(Player playerOwner, int townID, int hexaID)
            : base(playerOwner)
        {
            this.townID = townID;
            this.hexaID = hexaID;
            playerPrompt = false;
            costParade = Settings.costFortParade;
            costSources = Settings.costFortSources;
            costCaptureHexa = Settings.costFortCapture;
        }
예제 #2
0
 public RoadPromptItem(int roadID, String title, String description, SourceAll source, bool isSourceCost, Texture2D icon)
     : base(title, description, source, isSourceCost, false, icon)
 {
     this.roadID = roadID;
 }
예제 #3
0
 public TownPromptItem(int townID, String title, String description, SourceAll source, bool isSourceCost, Texture2D icon)
     : base(title, description, source, isSourceCost, false, icon)
 {
     this.townID = townID;
 }
예제 #4
0
        int upgradeNumber; /// which from 5 upgraded player wants to upgrade

        #endregion Fields

        #region Constructors

        public SpecialBuildingPromptItem(int townID, int hexaID, UpgradeKind upgradeKind, int upgradeNumber, SpecialBuilding building, String title, String description, SourceAll source, bool isSourceCost, Texture2D icon)
            : base(title, description, source, isSourceCost, false, icon)
        {
            this.townID = townID;
            this.hexaID = hexaID;
            this.upgradeKind = upgradeKind;
            this.upgradeNumber = upgradeNumber;
            this.building = building;
        }
예제 #5
0
        public SourceBuildingModel(Player playerOwner, int townID, int hexaID)
            : base(playerOwner)
        {
            this.townID = townID;
            this.hexaID = hexaID;
            upgrade = UpgradeKind.NoUpgrade;

            TownModel town = GameState.map.GetTownByID(townID);
            int buildingPos = town.FindBuildingByHexaID(hexaID);
            HexaModel hexa = town.GetHexa(buildingPos);

            SourceAll sourceNormal = new SourceAll(0);
            int amountNormal = hexa.GetStartSource();
            switch (hexa.GetKind())
            {
                case HexaKind.Forest:
                    sourceNormal = new SourceAll(0, 0, 0, amountNormal, 0);
                    break;

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

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

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

                case HexaKind.Mountains:
                    sourceNormal = new SourceAll(0, 0, 0, 0, amountNormal);
                    break;
            }
            playerOwner.AddCollectSources(sourceNormal, new SourceAll(0));

            upgrade1cost = new SourceAll(0);
            upgrade2cost = new SourceAll(0);
            switch (hexa.GetKind())
            {
                case HexaKind.Mountains:
                    buildingKind = SourceBuildingKind.Mine;
                    titleBuilding = Strings.PROMT_TITLE_WANT_TO_BUILD_MINE;
                    upgrade1Title = Strings.PROMPT_TITLE_WANT_TO_UPGRADE_1_MINE;
                    upgrade2Title = Strings.PROMPT_TITLE_WANT_TO_UPGRADE_2_MINE;
                    upgrade1Description = Strings.PROMPT_DESCRIPTION_WANT_TO_UPGRADE_1_MINE;
                    upgrade2Description = Strings.PROMPT_DESCRIPTION_WANT_TO_UPGRADE_2_MINE;
                    upgrade0iconActive = GameResources.Inst().GetHudTexture(HUDTexture.IconMineActive);
                    upgrade0icon = GameResources.Inst().GetHudTexture(HUDTexture.IconMine);
                    upgrade1icon = GameResources.Inst().GetHudTexture(HUDTexture.IconMine1);
                    upgrade2icon = GameResources.Inst().GetHudTexture(HUDTexture.IconMine2);
                    break;
                case HexaKind.Forest:
                    buildingKind = SourceBuildingKind.Saw;
                    titleBuilding = Strings.PROMT_TITLE_WANT_TO_BUILD_SAW;
                    upgrade1Title = Strings.PROMPT_TITLE_WANT_TO_UPGRADE_1_SAW;
                    upgrade2Title = Strings.PROMPT_TITLE_WANT_TO_UPGRADE_2_SAW;
                    upgrade1Description = Strings.PROMPT_DESCRIPTION_WANT_TO_UPGRADE_1_SAW;
                    upgrade2Description = Strings.PROMPT_DESCRIPTION_WANT_TO_UPGRADE_2_SAW;
                    upgrade0iconActive = GameResources.Inst().GetHudTexture(HUDTexture.IconSawActive);
                    upgrade0icon = GameResources.Inst().GetHudTexture(HUDTexture.IconSaw);
                    upgrade1icon = GameResources.Inst().GetHudTexture(HUDTexture.IconSaw1);
                    upgrade2icon = GameResources.Inst().GetHudTexture(HUDTexture.IconSaw2);
                    break;
                case HexaKind.Cornfield:
                    buildingKind = SourceBuildingKind.Mill;
                    titleBuilding = Strings.PROMT_TITLE_WANT_TO_BUILD_MILL;
                    upgrade1Title = Strings.PROMPT_TITLE_WANT_TO_UPGRADE_1_MILL;
                    upgrade2Title = Strings.PROMPT_TITLE_WANT_TO_UPGRADE_2_MILL;
                    upgrade1Description = Strings.PROMPT_DESCRIPTION_WANT_TO_UPGRADE_1_MILL;
                    upgrade2Description = Strings.PROMPT_DESCRIPTION_WANT_TO_UPGRADE_2_MILL;
                    upgrade0iconActive = GameResources.Inst().GetHudTexture(HUDTexture.IconMillActive);
                    upgrade0icon = GameResources.Inst().GetHudTexture(HUDTexture.IconMill);
                    upgrade1icon = GameResources.Inst().GetHudTexture(HUDTexture.IconMill1);
                    upgrade2icon = GameResources.Inst().GetHudTexture(HUDTexture.IconMill2);
                    break;
                case HexaKind.Pasture:
                    buildingKind = SourceBuildingKind.Stepherd;
                    titleBuilding = Strings.PROMT_TITLE_WANT_TO_BUILD_STEPHERD;
                    upgrade1Title = Strings.PROMPT_TITLE_WANT_TO_UPGRADE_1_STEPHERD;
                    upgrade2Title = Strings.PROMPT_TITLE_WANT_TO_UPGRADE_2_STEPHERD;
                    upgrade1Description = Strings.PROMPT_DESCRIPTION_WANT_TO_UPGRADE_1_STEPHERD;
                    upgrade2Description = Strings.PROMPT_DESCRIPTION_WANT_TO_UPGRADE_2_STEPHERD;
                    upgrade0iconActive = GameResources.Inst().GetHudTexture(HUDTexture.IconStepherdActive);
                    upgrade0icon = GameResources.Inst().GetHudTexture(HUDTexture.IconStepherd);
                    upgrade1icon = GameResources.Inst().GetHudTexture(HUDTexture.IconStepherd1);
                    upgrade2icon = GameResources.Inst().GetHudTexture(HUDTexture.IconStepherd2);
                    break;
                case HexaKind.Stone:
                    buildingKind = SourceBuildingKind.Quarry;
                    titleBuilding = Strings.PROMT_TITLE_WANT_TO_BUILD_QUARRY;
                    upgrade1Title = Strings.PROMPT_TITLE_WANT_TO_UPGRADE_1_QUARRY;
                    upgrade2Title = Strings.PROMPT_TITLE_WANT_TO_UPGRADE_2_QUARRY;
                    upgrade1Description = Strings.PROMPT_DESCRIPTION_WANT_TO_UPGRADE_1_QUARRY;
                    upgrade2Description = Strings.PROMPT_DESCRIPTION_WANT_TO_UPGRADE_2_QUARRY;
                    upgrade0iconActive = GameResources.Inst().GetHudTexture(HUDTexture.IconQuarryActive);
                    upgrade0icon = GameResources.Inst().GetHudTexture(HUDTexture.IconQuarry);
                    upgrade1icon = GameResources.Inst().GetHudTexture(HUDTexture.IconQuarry1);
                    upgrade2icon = GameResources.Inst().GetHudTexture(HUDTexture.IconQuarry2);
                    break;
            }
        }
예제 #6
0
        public ITown BuildTown(int townID)
        {
            TownModel town = map.GetTownByID(townID);
            if (town == null)
                return null;

            GameMaster gm = GameMaster.Inst();
            TownBuildError error = town.CanBuildTown();
            if (error == TownBuildError.OK)
            {
                PathNode.SetIsValid(false);
                town.BuildTown(gm.GetActivePlayer());

                ItemQueue item = new TownItemQueue(mapView, townID);
                mapView.AddToViewQueue(item);

                if (gm.GetState() == EGameState.BeforeGame)
                    return town;

                if (gm.GetState() != EGameState.StateGame)
                {
                    SourceAll source = new SourceAll(0);
                    HexaModel hexa;

                    for (int loop1 = 0; loop1 < 3; loop1++)
                    {
                        if ((hexa = town.GetHexa(loop1)) != null)
                        {
                            switch (hexa.GetKind())
                            {
                                case HexaKind.Desert :
                                    source = new SourceAll(20); break;
                                case HexaKind.Cornfield:
                                    source = Settings.costMill; break;
                                case HexaKind.Forest:
                                    source = Settings.costSaw; break;
                                case HexaKind.Mountains:
                                    source = Settings.costMine; break;
                                case HexaKind.Pasture:
                                    source = Settings.costStephard; break;
                                case HexaKind.Stone:
                                    source = Settings.costQuarry; break;
                                default:
                                    source = new SourceAll(0); break;
                            }
                            gm.GetActivePlayer().AddSources(source, TransactionState.TransactionMiddle);
                        }
                    }

                    gm.SetHasBuiltTown(true);

                    if(!gm.GetActivePlayer().GetIsAI())
                        gm.NextTurn();
                }
                else
                    gm.GetActivePlayer().PayForSomething(GetPrice(PriceKind.BTown));

                TriggerManager.Inst().TurnTrigger(TriggerType.TownBuild, townID);
                return town;
            }

            return null;
        }
예제 #7
0
        public bool DestroyHexa(int hexaID, IFort fort)
        {
            if (CanDestroyHexa(hexaID, fort) == DestroyHexaError.OK)
            {
                HexaModel hexa = map.GetHexaByID(hexaID);

                SourceAll source = new SourceAll(0);
                int amount = gm.GetRandomInt(70) + ((hexa.GetDestroyed()) ? 0 : 70);
                hexa.Destroy();

                switch(hexa.GetKind())
                {
                    case HexaKind.Cornfield :
                        source = new SourceAll(amount, 0, 0, 0, 0);
                        break;
                    case HexaKind.Pasture :
                        source = new SourceAll(0, amount, 0, 0, 0);
                        break;
                    case HexaKind.Stone :
                        source = new SourceAll(0, 0, amount, 0, 0);
                        break;
                    case HexaKind.Forest :
                        source = new SourceAll(0, 0, 0, amount, 0);
                        break;
                    case HexaKind.Mountains :
                        source = new SourceAll(0, 0, 0, 0, amount);
                        break;
                }
                gm.GetActivePlayer().PayForSomething(Settings.costFortCrusade - source);
                gm.GetActivePlayer().AddFortAction();
                return true;
            }
            return false;
        }
예제 #8
0
        public bool ChangeSourcesFor(List<ISourceAll> sourceList)
        {
            SourceAll source = new SourceAll(0);

            foreach (ISourceAll isource in sourceList)
            {
                source = source + (SourceAll)isource;
            }

            return ChangeSourcesFor(source);
        }