Example #1
0
        /// <summary>
        /// Need to unify this method with players one.
        /// </summary>
        /// <param name="race"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public bool isAffordable(Storage.Races race, Storage.BuildingTypes type)
        {
            Storage.BuildingInfo i = Storage.Info.get.of(race, type);

            return(ResourcesPlacer.get(BasePlayer.ia).enoughResources(WorldResources.Type.FOOD, i.resources.food) &&
                   ResourcesPlacer.get(BasePlayer.ia).enoughResources(WorldResources.Type.WOOD, i.resources.wood) &&
                   ResourcesPlacer.get(BasePlayer.ia).enoughResources(WorldResources.Type.METAL, i.resources.metal));
        }
Example #2
0
        public void SetupTooltip(Info info)
        {
            if ((tooltipFlags & TooltipFlag.HIDE) == TooltipFlag.HIDE)
            {
                return;
            }

            if ((tooltipFlags & TooltipFlag.DISPLAY_COST) == TooltipFlag.DISPLAY_COST)
            {
                tooltip += "\n\nCost:\n" +
                           "Wood: [[resources.wood]]\n" +
                           "Metal: [[resources.metal]]\n" +
                           "Food: [[resources.food]]";
            }

            if ((tooltipFlags & TooltipFlag.DISPLAY_TARGET) == TooltipFlag.DISPLAY_TARGET)
            {
                string attrs = "";

                switch (targetType)
                {
                case EntityType.UNIT:
                    UnitInfo unitTarget = info.of(targetRace, targetUnit);

                    attrs = "\n\nAttributes:\n" +
                            "WeaponAbility: [[attributes.weaponAbility]]\n" +
                            "ProjectileAbility: [[attributes.projectileAbility]]\n" +
                            "Strength: [[attributes.strength]]\n" +
                            "Resistance: [[attributes.resistance]]\n" +
                            "Wounds: [[attributes.wounds]]\n" +
                            "Attack Rate: [[attributes.attackRate]]\n" +
                            "Movement Rate: [[attributes.movementRate]]";

                    attrs   = attrs.FormatWith(unitTarget, @"\[\[", @"\]\]");
                    tooltip = "Recruit " + unitTarget.name + " " + tooltip + attrs;
                    break;

                case EntityType.BUILDING:
                    BuildingInfo buildingTarget = info.of(targetRace, targetBuilding);

                    int i = 0;
                    foreach (EntityAbility ability in buildingTarget.abilities)
                    {
                        if (i > 0)
                        {
                            attrs += ", ";
                        }

                        if ((ability.tooltipFlags & TooltipFlag.HIDE) == TooltipFlag.HIDE)
                        {
                            continue;
                        }

                        attrs += ability.name;
                        ++i;
                    }

                    if (i > 0)
                    {
                        attrs = "\n\nCan recruit:\n" + attrs;
                    }

                    tooltip = "Create " + buildingTarget.name + " " + tooltip + attrs + "\nKey : " + keyBinding.ToString();
                    break;
                }
            }
        }
Example #3
0
    public void DisplayBuildingUnderConstruction(Storage.BuildingInfo entity)
    {
        switch (entity.type)
        {
        case Storage.BuildingTypes.STRONGHOLD:
            break;

        case Storage.BuildingTypes.ARCHERY:
            AppendMessage(BEGIN_CREATION_SHOOTING_RANGE);
            break;

        case Storage.BuildingTypes.STABLE:
            AppendMessage(BEGIN_CREATION_STABLE);
            break;

        case Storage.BuildingTypes.BARRACK:
            AppendMessage(BEGIN_CREATION_BARRACKS);
            break;

        case Storage.BuildingTypes.FARM:
            AppendMessage(BEGIN_CREATION_FARM);
            break;

        case Storage.BuildingTypes.MINE:
            AppendMessage(BEGIN_CREATION_MINE);
            break;

        case Storage.BuildingTypes.SAWMILL:
            AppendMessage(BEGIN_CREATION_SAWMILL);
            break;

        case Storage.BuildingTypes.WATCHTOWER:
            AppendMessage(BEGIN_CREATION_WATCHTOWER);
            break;

        case Storage.BuildingTypes.WALL:
            AppendMessage(BEGIN_CREATION_WALL);
            break;

        case Storage.BuildingTypes.WALLCORNER:
            AppendMessage(BEGIN_CREATION_WALL_CORNER);
            break;

        case Storage.BuildingTypes.WALLGATE:
            AppendMessage(BEGIN_CREATION_GATE);
            break;

        case Storage.BuildingTypes.ARTILLERY:
            AppendMessage(BEGIN_CREATION_ARTILLERY_BUILDING);
            break;

        case Storage.BuildingTypes.ENT:
            AppendMessage(BEGIN_CREATION_ENT_FOREST);
            break;

        case Storage.BuildingTypes.GRYPHON:
            AppendMessage(BEGIN_CREATION_GRYPHON_NEST);
            break;

        case Storage.BuildingTypes.SPECIAL:
            AppendMessage(BEGIN_CREATION_SPECIAL_UNITS_BUILDING);
            break;

        case Storage.BuildingTypes.WORKSHOP:
            AppendMessage(BEGIN_CREATION_WORKSHOP);
            break;
        }
    }