Пример #1
0
        public int GetMaxSpellForgeLevel()
        {
            int result = 0;
            List <Component> components = m_vComponents[3];

            if (components.Count > 0)
            {
                foreach (UnitProductionComponent c in components)
                {
                    if (c.IsSpellForge())
                    {
                        Building b = (Building)c.GetParent();
                        if (!b.IsConstructing() || b.IsUpgrading())
                        {
                            int level = b.GetUpgradeLevel();
                            if (level > result)
                            {
                                result = level;
                            }
                        }
                    }
                }
            }
            return(result);
        }
Пример #2
0
        public int GetMaxTrainCount()
        {
            Building     b  = (Building)GetParent();
            BuildingData bd = b.GetBuildingData();

            return(bd.GetUnitProduction(b.GetUpgradeLevel()));
        }
Пример #3
0
        public bool CanStartUpgrading(CombatItemData cid)
        {
            bool result = false;

            if (m_vCurrentlyUpgradedUnit == null)
            {
                Building         b  = (Building)GetParent();
                ClientAvatar     ca = GetParent().GetLevel().GetHomeOwnerAvatar();
                ComponentManager cm = GetParent().GetLevel().GetComponentManager();
                int maxProductionBuildingLevel;
                if (cid.GetCombatItemType() == 1)
                {
                    maxProductionBuildingLevel = cm.GetMaxSpellForgeLevel();
                }
                else
                {
                    maxProductionBuildingLevel = cm.GetMaxBarrackLevel();
                }
                if (ca.GetUnitUpgradeLevel(cid) < cid.GetUpgradeLevelCount() - 1)
                {
                    if (maxProductionBuildingLevel >= cid.GetRequiredProductionHouseLevel() - 1)
                    {
                        result = (b.GetUpgradeLevel() >= (cid.GetRequiredLaboratoryLevel(ca.GetUnitUpgradeLevel(cid) + 1)) - 1);
                    }
                }
            }
            return(result);
        }
Пример #4
0
        public int GetMaxTrainCount()
        {
            Building parent = (Building)GetParent();

            return(parent.GetBuildingData().GetUnitProduction(parent.GetUpgradeLevel()));
        }