示例#1
0
    /**
     * Set the tech level to a given value
     */
    public void setLevel(TechField field, int level)
    {
        switch (field)
        {
        case TechField.Biotechnology:
            _biotechnology = level;
            return;

        case TechField.Construction:
            _construction = level;
            return;

        case TechField.Electronics:
            _electronics = level;
            return;

        case TechField.Energy:
            _energy = level;
            return;

        case TechField.Propulsion:
            _propulsion = level;
            return;

        case TechField.Weapons:
            _weapons = level;
            return;
        }
    }
示例#2
0
    public ResearchCostLevel getForField(TechField field)
    {
        switch (field)
        {
        case TechField.Biotechnology:
            return(biotechnology);

        case TechField.Construction:
            return(construction);

        case TechField.Electronics:
            return(electronics);

        case TechField.Energy:
            return(energy);

        case TechField.Propulsion:
            return(propulsion);

        case TechField.Weapons:
            return(weapons);

        default:
            return(energy);
        }
    }
示例#3
0
    /**
     * Get the value for a given TechField
     */
    public int level(TechField field)
    {
        switch (field)
        {
        case TechField.Biotechnology:
            return(_biotechnology);

        case TechField.Construction:
            return(_construction);

        case TechField.Electronics:
            return(_electronics);

        case TechField.Energy:
            return(_energy);

        case TechField.Propulsion:
            return(_propulsion);

        case TechField.Weapons:
            return(_weapons);

        default:
            return(_energy);
        }
    }
示例#4
0
 public Player()
 {
     currentResearchField = TechField.Energy;
     nextResearchField    = NextResearchField.SameField;
     researchAmount       = 15;
     submittedTurn        = false;
     numFleetsBuilt       = 0;
     submittedTurn        = false;
     accepted             = false;
 }
示例#5
0
        private void RefreshResearchedTechs(TechField whichField)
        {
            for (int i = 0; i < _techFieldButtons.Length; i++)
            {
                _techFieldButtons[i].Selected = false;
            }
            string            techDescriptions = string.Empty;
            List <Technology> researchedTechs  = new List <Technology>();

            switch (whichField)
            {
            case TechField.COMPUTER:
            {
                _techFieldButtons[0].Selected = true;
                researchedTechs = _gameMain.EmpireManager.CurrentEmpire.TechnologyManager.ResearchedComputerTechs;
            } break;

            case TechField.CONSTRUCTION:
            {
                _techFieldButtons[1].Selected = true;
                researchedTechs = _gameMain.EmpireManager.CurrentEmpire.TechnologyManager.ResearchedConstructionTechs;
            } break;

            case TechField.FORCE_FIELD:
            {
                _techFieldButtons[2].Selected = true;
                researchedTechs = _gameMain.EmpireManager.CurrentEmpire.TechnologyManager.ResearchedForceFieldTechs;
            } break;

            case TechField.PLANETOLOGY:
            {
                _techFieldButtons[3].Selected = true;
                researchedTechs = _gameMain.EmpireManager.CurrentEmpire.TechnologyManager.ResearchedPlanetologyTechs;
            } break;

            case TechField.PROPULSION:
            {
                _techFieldButtons[4].Selected = true;
                researchedTechs = _gameMain.EmpireManager.CurrentEmpire.TechnologyManager.ResearchedPropulsionTechs;
            } break;

            case TechField.WEAPON:
            {
                _techFieldButtons[5].Selected = true;
                researchedTechs = _gameMain.EmpireManager.CurrentEmpire.TechnologyManager.ResearchedWeaponTechs;
            } break;
            }
            foreach (var researchedTech in researchedTechs)
            {
                techDescriptions += researchedTech.TechName + " -\r\n" + researchedTech.TechDescription + "\r\n\r\n\r\n";
            }
            _researchedTechnologyDescriptions.SetText(techDescriptions);
            _researchedTechnologyDescriptions.ScrollToBottom();
        }
示例#6
0
    /**
     * Get the research cost for a tech field/level
     */
    public int getResearchCostForLevel(TechField field, int level)
    {
        float             cost = Consts.techResearchCost[level];
        ResearchCostLevel rcl  = researchCost.getForField(field);

        if (rcl == ResearchCostLevel.Extra)
        {
            cost *= 1.75f;
        }
        else if (rcl == ResearchCostLevel.Less)
        {
            cost *= 0.5f;
        }

        return((int)cost);
    }
示例#7
0
    /**
     * Get the lowest field
     */
    public TechField lowest()
    {
        int       lowestLevel = int.MaxValue;
        TechField lowestField = TechField.Energy;

        foreach (TechField field in Enum.GetValues(typeof(TechField)))
        {
            int value = level(field);
            if (value < lowestLevel)
            {
                lowestLevel = value;
                lowestField = field;
            }
        }

        return(lowestField);
    }
示例#8
0
        public override bool MouseHover(int x, int y, float frameDeltaTime)
        {
            bool result = false;

            foreach (var button in _techFieldButtons)
            {
                result = button.MouseHover(x, y, frameDeltaTime) || result;
            }
            foreach (var button in _techLockButtons)
            {
                result = button.MouseHover(x, y, frameDeltaTime) || result;
            }
            for (int i = 0; i < _techSliders.Length; i++)
            {
                if (_techSliders[i].MouseHover(x, y, frameDeltaTime))
                {
                    TechField whichField = TechField.COMPUTER;
                    switch (i)
                    {
                    case 1: whichField = TechField.CONSTRUCTION;
                        break;

                    case 2: whichField = TechField.FORCE_FIELD;
                        break;

                    case 3: whichField = TechField.PLANETOLOGY;
                        break;

                    case 4: whichField = TechField.PROPULSION;
                        break;

                    case 5: whichField = TechField.WEAPON;
                        break;
                    }
                    _gameMain.EmpireManager.CurrentEmpire.TechnologyManager.SetPercentage(whichField, _techSliders[i].TopIndex);
                    RefreshSliders();
                    RefreshProgressLabels();
                }
            }
            return(result);
        }
示例#9
0
    public TechField getNextField()
    {
        TechField field = currentResearchField;

        if (nextResearchField == NextResearchField.SameField)
        {
            field = currentResearchField;
        }
        else if (nextResearchField != NextResearchField.LowestField)
        {
            field = (TechField)Enum.Parse(typeof(TechField), nextResearchField.ToString(), true);
        }

        int nextLevel = techLevels.level(field);

        if (nextLevel >= Consts.maxTechLevel || nextResearchField == NextResearchField.LowestField)
        {
            field = techLevels.lowest();
        }

        return(field);
    }
示例#10
0
    /**
     * Apply a given number of resources to research possibly gaining tech levels
     */
    void research(Player player, int resources)
    {
        int currentSpent  = player.getTechLevelsSpent().level(player.getCurrentResearchField());
        int currentLevel  = player.getTechLevels().level(player.getCurrentResearchField());
        int nextLevelCost = player.getRace().getResearchCostForLevel(player.getCurrentResearchField(), currentLevel + 1);

        currentSpent += resources;

        if (currentSpent >= nextLevelCost)
        {
            player.getTechLevels().setLevel(player.getCurrentResearchField(), currentLevel + 1);
            TechField nextField = player.getNextField();
            Message.techLevel(player, player.getCurrentResearchField(), currentLevel + 1, nextField);
            player.getTechLevelsSpent().setLevel(player.getCurrentResearchField(), 0);
            player.setCurrentResearchField(nextField);
            research(player, currentSpent - nextLevelCost);
        }
        else
        {
            player.getTechLevelsSpent().setLevel(player.getCurrentResearchField(), currentSpent);
        }
    }
示例#11
0
        public Technology(TechField techField, string name, string desc, int level,
                          string secondaryName = "",
                          //Optional arguments goes here
                          int roboticControl               = 0,
                          int battleComputer               = 0,
                          bool battleScanner               = false,
                          int ECM                          = 0,
                          int spaceScanner                 = 0,
                          bool hyperSpaceCommunicator      = false,
                          bool oracleInterface             = false,
                          bool technologyNullifier         = false,
                          int armor                        = 0,
                          bool reserveFuelTanks            = false,
                          int industrialTech               = 10,
                          int industrialWaste              = 100,
                          int groundArmor                  = 0,
                          int repair                       = 0,
                          int shield                       = 0,
                          int personalShield               = 0,
                          int planetaryShield              = 0,
                          bool repulsorBeam                = false,
                          bool cloakingDevice              = false,
                          int missileShield                = 0,
                          bool statisField                 = false,
                          bool blackHoleGenerator          = false,
                          int ecoCleanup                   = 0,
                          int terraforming                 = 0,
                          int terraformCost                = 6,
                          int colony                       = 0,
                          int cloning                      = 20,
                          int bioWeapon                    = 0,
                          int bioAntidote                  = 0,
                          int enrichment                   = 0,
                          int speed                        = 0,
                          int maneuverSpeed                = 0,
                          int fuelRange                    = 0,
                          bool inertialstabilizer          = false,
                          bool energypulsar                = false,
                          bool warpDissipator              = false,
                          bool highEnergyFocus             = false,
                          bool stargate                    = false,
                          bool subSpaceTeleporter          = false,
                          bool ionicPulsar                 = false,
                          bool subspaceInterdictor         = false,
                          bool combatTransporters          = false,
                          bool inertialNullifier           = false,
                          bool displacementDevice          = false,
                          bool antiMissileRockets          = false,
                          bool ionStreamProjector          = false,
                          bool neutronStreamProjector      = false,
                          float smallSize                  = 0,
                          float smallCost                  = 0,
                          float smallPower                 = 0,
                          float smallHP                    = 0,
                          float mediumSize                 = 0,
                          float mediumCost                 = 0,
                          float mediumPower                = 0,
                          float mediumHP                   = 0,
                          float largeSize                  = 0,
                          float largeCost                  = 0,
                          float largePower                 = 0,
                          float largeHP                    = 0,
                          float hugeSize                   = 0,
                          float hugeCost                   = 0,
                          float hugePower                  = 0,
                          float hugeHP                     = 0,
                          float genericSize                = 0,
                          float genericCost                = 0,
                          float genericPower               = 0,
                          float smallSecondarySize         = 0,
                          float smallSecondaryCost         = 0,
                          float smallSecondaryPower        = 0,
                          float smallSecondaryHP           = 0,
                          float mediumSecondarySize        = 0,
                          float mediumSecondaryCost        = 0,
                          float mediumSecondaryPower       = 0,
                          float mediumSecondaryHP          = 0,
                          float largeSecondarySize         = 0,
                          float largeSecondaryCost         = 0,
                          float largeSecondaryPower        = 0,
                          float largeSecondaryHP           = 0,
                          float hugeSecondarySize          = 0,
                          float hugeSecondaryCost          = 0,
                          float hugeSecondaryPower         = 0,
                          float hugeSecondaryHP            = 0,
                          float genericSecondarySize       = 0,
                          float genericSecondaryCost       = 0,
                          float genericSecondaryPower      = 0,
                          int weaponType                   = 0,
                          int minimumWeaponDamage          = 0,
                          int minimumSecondaryWeaponDamage = 0,
                          int maximumWeaponDamage          = 0,
                          int maximumSecondaryWeaponDamage = 0,
                          bool shieldPiercing              = false,
                          float weaponRange                = 0,
                          int secondaryWeaponRange         = 0,
                          int numberOfShots                = 0,
                          bool streaming                   = false,
                          int targetingBonus               = 0,
                          bool enveloping                  = false,
                          bool dissipating                 = false,
                          float missileSpeed               = 0
                          )
        {
            TechLevel              = level;
            TechField              = techField;
            TechName               = name;
            TechDescription        = desc;
            TechSecondaryName      = secondaryName;
            RoboticControl         = roboticControl;
            BattleComputer         = battleComputer;
            BattleScanner          = battleScanner;
            this.ECM               = ECM;
            SpaceScanner           = spaceScanner;
            HyperSpaceCommunicator = hyperSpaceCommunicator;
            OracleInterface        = oracleInterface;
            TechnologyNullifier    = technologyNullifier;
            Armor                  = armor;
            ReserveFuelTanks       = reserveFuelTanks;
            IndustrialTech         = industrialTech;
            IndustrialWaste        = industrialWaste;
            GroundArmor            = groundArmor;
            Repair                 = repair;
            Shield                 = shield;
            PersonalShield         = personalShield;
            PlanetaryShield        = planetaryShield;
            RepulsorBeam           = repulsorBeam;
            CloakingDevice         = cloakingDevice;
            MissileShield          = missileShield;
            StatisField            = statisField;
            BlackHoleGenerator     = blackHoleGenerator;
            EcoCleanup             = ecoCleanup;
            Terraforming           = terraforming;
            TerraformCost          = terraformCost;
            Colony                 = colony;
            Cloning                = cloning;
            BioWeapon              = bioWeapon;
            BioAntidote            = bioAntidote;
            Enrichment             = enrichment;
            Speed                  = speed;
            ManeuverSpeed          = maneuverSpeed;
            FuelRange              = fuelRange;
            InertialStabilizer     = inertialstabilizer;
            EnergyPulsar           = energypulsar;
            WarpDissipator         = warpDissipator;
            HighEnergyFocus        = highEnergyFocus;
            SubspaceTeleporter     = subSpaceTeleporter;
            IonicPulsar            = ionicPulsar;
            SubspaceInterdictor    = subspaceInterdictor;
            CombatTransporters     = combatTransporters;
            InertialNullifier      = inertialNullifier;
            DisplacementDevice     = displacementDevice;
            AntiMissileRockets     = antiMissileRockets;
            IonStreamProjector     = ionStreamProjector;
            NeutronStreamProjector = neutronStreamProjector;
            Stargate               = stargate;

            //Ship component info
            SmallSize             = smallSize;
            SmallCost             = smallCost;
            SmallPower            = smallPower;
            SmallHP               = smallHP;
            MediumSize            = mediumSize;
            MediumCost            = mediumCost;
            MediumPower           = mediumPower;
            MediumHP              = mediumHP;
            LargeSize             = largeSize;
            LargeCost             = largeCost;
            LargePower            = largePower;
            LargeHP               = largeHP;
            HugeSize              = hugeSize;
            HugeCost              = hugeCost;
            HugePower             = hugePower;
            HugeHP                = hugeHP;
            GenericSize           = genericSize;
            GenericCost           = genericCost;
            GenericPower          = genericPower;
            SmallSecondarySize    = smallSecondarySize;
            SmallSecondaryCost    = smallSecondaryCost;
            SmallSecondaryPower   = smallSecondaryPower;
            SmallSecondaryHP      = smallSecondaryHP;
            MediumSecondarySize   = mediumSecondarySize;
            MediumSecondaryCost   = mediumSecondaryCost;
            MediumSecondaryPower  = mediumSecondaryPower;
            MediumSecondaryHP     = mediumSecondaryHP;
            LargeSecondarySize    = largeSecondarySize;
            LargeSecondaryCost    = largeSecondaryCost;
            LargeSecondaryPower   = largeSecondaryPower;
            LargeSecondaryHP      = largeSecondaryHP;
            HugeSecondarySize     = hugeSecondarySize;
            HugeSecondaryCost     = hugeSecondaryCost;
            HugeSecondaryPower    = hugeSecondaryPower;
            HugeSecondaryHP       = hugeSecondaryHP;
            GenericSecondarySize  = genericSecondarySize;
            GenericSecondaryCost  = genericSecondaryCost;
            GenericSecondaryPower = genericSecondaryPower;

            WeaponType                   = weaponType;
            MinimumWeaponDamage          = minimumWeaponDamage;
            MinimumSecondaryWeaponDamage = minimumSecondaryWeaponDamage;
            MaximumWeaponDamage          = maximumWeaponDamage;
            MaximumSecondaryWeaponDamage = maximumSecondaryWeaponDamage;
            ShieldPiercing               = shieldPiercing;
            WeaponRange                  = weaponRange;
            SecondaryWeaponRange         = secondaryWeaponRange;
            NumberOfShots                = numberOfShots;
            Streaming      = streaming;
            TargetingBonus = targetingBonus;
            Enveloping     = enveloping;
            Dissipating    = dissipating;
            MissileSpeed   = missileSpeed;
        }
示例#12
0
 private void LoadNextTech()
 {
     //Go in order from Computer, Construction, Force Field, Planetology, Propulsion, to Weapon
     if (_availableTopics.ContainsKey(TechField.COMPUTER))
     {
         _currentTechField = TechField.COMPUTER;
         //Check to see if there's a researched item
         bool hasDiscovered = false;
         foreach (var researchedItem in _discoveredTechs)
         {
             if (_currentEmpire.TechnologyManager.ResearchedComputerTechs.Contains(researchedItem))
             {
                 _techIcon = SpriteManager.GetSprite("RandomRace", _gameMain.Random);
                 _techDescription.SetText(researchedItem.TechName + "\n\r\n\r" + researchedItem.TechDescription);
                 hasDiscovered = true;
                 break;
             }
         }
         if (!hasDiscovered)
         {
             _techIcon = SpriteManager.GetSprite("RandomRace", _gameMain.Random);
             _techDescription.SetText("Computer technologies help with increasing number of factories, better scanners, improving your attack and missile defense on ships, and spying efforts benefits from higher computer tech level.");
         }
     }
     else if (_availableTopics.ContainsKey(TechField.CONSTRUCTION))
     {
         _currentTechField = TechField.CONSTRUCTION;
         //Check to see if there's a researched item
         bool hasDiscovered = false;
         foreach (var researchedItem in _discoveredTechs)
         {
             if (_currentEmpire.TechnologyManager.ResearchedConstructionTechs.Contains(researchedItem))
             {
                 _techIcon = SpriteManager.GetSprite("RandomRace", _gameMain.Random);
                 _techDescription.SetText(researchedItem.TechName + "\n\r\n\r" + researchedItem.TechDescription);
                 hasDiscovered = true;
                 break;
             }
         }
         if (!hasDiscovered)
         {
             _techIcon = SpriteManager.GetSprite("RandomRace", _gameMain.Random);
             _techDescription.SetText("Construction technologies gives you better armor, cheaper factories, reduced pollution, and higher construction tech levels gives you more room on ships.");
         }
     }
     else if (_availableTopics.ContainsKey(TechField.FORCE_FIELD))
     {
         _currentTechField = TechField.FORCE_FIELD;
         //Check to see if there's a researched item
         bool hasDiscovered = false;
         foreach (var researchedItem in _discoveredTechs)
         {
             if (_currentEmpire.TechnologyManager.ResearchedForceFieldTechs.Contains(researchedItem))
             {
                 _techIcon = SpriteManager.GetSprite("RandomRace", _gameMain.Random);
                 _techDescription.SetText(researchedItem.TechName + "\n\r\n\r" + researchedItem.TechDescription);
                 hasDiscovered = true;
                 break;
             }
         }
         if (!hasDiscovered)
         {
             _techIcon = SpriteManager.GetSprite("RandomRace", _gameMain.Random);
             _techDescription.SetText("Force field technologies gives you better shields, as well as planetary shields and nifty special items.");
         }
     }
     else if (_availableTopics.ContainsKey(TechField.PLANETOLOGY))
     {
         _currentTechField = TechField.PLANETOLOGY;
         //Check to see if there's a researched item
         bool hasDiscovered = false;
         foreach (var researchedItem in _discoveredTechs)
         {
             if (_currentEmpire.TechnologyManager.ResearchedPlanetologyTechs.Contains(researchedItem))
             {
                 _techIcon = SpriteManager.GetSprite("RandomRace", _gameMain.Random);
                 _techDescription.SetText(researchedItem.TechName + "\n\r\n\r" + researchedItem.TechDescription);
                 hasDiscovered = true;
                 break;
             }
         }
         if (!hasDiscovered)
         {
             _techIcon = SpriteManager.GetSprite("RandomRace", _gameMain.Random);
             _techDescription.SetText("Planetology technologies gives you terraforming and bigger planets, cheaper pollution cleanup, as well as expanding the number of planets you can colonize.  Also includes biological warfare.");
         }
     }
     else if (_availableTopics.ContainsKey(TechField.PROPULSION))
     {
         _currentTechField = TechField.PROPULSION;
         //Check to see if there's a researched item
         bool hasDiscovered = false;
         foreach (var researchedItem in _discoveredTechs)
         {
             if (_currentEmpire.TechnologyManager.ResearchedPropulsionTechs.Contains(researchedItem))
             {
                 _techIcon = SpriteManager.GetSprite("RandomRace", _gameMain.Random);
                 _techDescription.SetText(researchedItem.TechName + "\n\r\n\r" + researchedItem.TechDescription);
                 hasDiscovered = true;
                 break;
             }
         }
         if (!hasDiscovered)
         {
             _techIcon = SpriteManager.GetSprite("RandomRace", _gameMain.Random);
             _techDescription.SetText("Propulsion technologies gives you faster engines, expanded range, and powerful special equipment.");
         }
     }
     else if (_availableTopics.ContainsKey(TechField.WEAPON))
     {
         _currentTechField = TechField.WEAPON;
         //Check to see if there's a researched item
         bool hasDiscovered = false;
         foreach (var researchedItem in _discoveredTechs)
         {
             if (_currentEmpire.TechnologyManager.ResearchedWeaponTechs.Contains(researchedItem))
             {
                 _techIcon = SpriteManager.GetSprite("RandomRace", _gameMain.Random);
                 _techDescription.SetText(researchedItem.TechName + "\n\r\n\r" + researchedItem.TechDescription);
                 hasDiscovered = true;
                 break;
             }
         }
         if (!hasDiscovered)
         {
             _techIcon = SpriteManager.GetSprite("RandomRace", _gameMain.Random);
             _techDescription.SetText("Weapon technologies gives you weapons. A lot of weapons.");
         }
     }
     if (_availableTopics[_currentTechField].Count > 0)
     {
         if (_availableTopics[_currentTechField].Count > _availableTechsToResearchButtons.Length)
         {
             _maxVisible = _availableTechsToResearchButtons.Length;
             _scrollBar.SetEnabledState(true);
             _scrollBar.SetAmountOfItems(_availableTopics[_currentTechField].Count);
         }
         else
         {
             _maxVisible = _availableTopics[_currentTechField].Count;
             _scrollBar.SetAmountOfItems(_availableTechsToResearchButtons.Length);
             _scrollBar.SetEnabledState(false);
         }
         RefreshTechButtons();
     }
 }
示例#13
0
        public void SetPercentage(TechField whichField, int amount)
        {
            int remainingPercentile = 100;
            if (ComputerLocked)
            {
                remainingPercentile -= ComputerPercentage;
            }
            if (ConstructionLocked)
            {
                remainingPercentile -= ConstructionPercentage;
            }
            if (ForceFieldLocked)
            {
                remainingPercentile -= ForceFieldPercentage;
            }
            if (PlanetologyLocked)
            {
                remainingPercentile -= PlanetologyPercentage;
            }
            if (PropulsionLocked)
            {
                remainingPercentile -= PropulsionPercentage;
            }
            if (WeaponLocked)
            {
                remainingPercentile -= WeaponPercentage;
            }

            if (amount >= remainingPercentile)
            {
                if (!ComputerLocked)
                {
                    ComputerPercentage = 0;
                }
                if (!ConstructionLocked)
                {
                    ConstructionPercentage = 0;
                }
                if (!ForceFieldLocked)
                {
                    ForceFieldPercentage = 0;
                }
                if (!PlanetologyLocked)
                {
                    PlanetologyPercentage = 0;
                }
                if (!PropulsionLocked)
                {
                    PropulsionPercentage = 0;
                }
                if (!WeaponLocked)
                {
                    WeaponPercentage = 0;
                }
                amount = remainingPercentile;
            }

            //Now scale
            int totalPointsExcludingSelectedType = 0;
            switch (whichField)
            {
                case TechField.COMPUTER:
                    {
                        ComputerPercentage = amount;
                        remainingPercentile -= ComputerPercentage;
                        totalPointsExcludingSelectedType = GetTotalPercentageExcludingTypeAndLocked(TechField.COMPUTER);
                    } break;
                case TechField.CONSTRUCTION:
                    {
                        ConstructionPercentage = amount;
                        remainingPercentile -= ConstructionPercentage;
                        totalPointsExcludingSelectedType = GetTotalPercentageExcludingTypeAndLocked(TechField.CONSTRUCTION);
                    } break;
                case TechField.FORCE_FIELD:
                    {
                        ForceFieldPercentage = amount;
                        remainingPercentile -= ForceFieldPercentage;
                        totalPointsExcludingSelectedType = GetTotalPercentageExcludingTypeAndLocked(TechField.FORCE_FIELD);
                    } break;
                case TechField.PLANETOLOGY:
                    {
                        PlanetologyPercentage = amount;
                        remainingPercentile -= PlanetologyPercentage;
                        totalPointsExcludingSelectedType = GetTotalPercentageExcludingTypeAndLocked(TechField.PLANETOLOGY);
                    } break;
                case TechField.PROPULSION:
                    {
                        PropulsionPercentage = amount;
                        remainingPercentile -= PropulsionPercentage;
                        totalPointsExcludingSelectedType = GetTotalPercentageExcludingTypeAndLocked(TechField.PROPULSION);
                    } break;
                case TechField.WEAPON:
                    {
                        WeaponPercentage = amount;
                        remainingPercentile -= WeaponPercentage;
                        totalPointsExcludingSelectedType = GetTotalPercentageExcludingTypeAndLocked(TechField.WEAPON);
                    } break;
            }

            if (remainingPercentile < totalPointsExcludingSelectedType)
            {
                int amountToDeduct = totalPointsExcludingSelectedType - remainingPercentile;
                int prevValue;
                if (!ComputerLocked && whichField != TechField.COMPUTER)
                {
                    prevValue = ComputerPercentage;
                    ComputerPercentage -= (ComputerPercentage >= amountToDeduct ? amountToDeduct : ComputerPercentage);
                    amountToDeduct -= (prevValue - ComputerPercentage);
                }
                if (amountToDeduct > 0)
                {
                    if (!ConstructionLocked && whichField != TechField.CONSTRUCTION)
                    {
                        prevValue = ConstructionPercentage;
                        ConstructionPercentage -= (ConstructionPercentage >= amountToDeduct ? amountToDeduct : ConstructionPercentage);
                        amountToDeduct -= (prevValue - ConstructionPercentage);
                    }
                }
                if (amountToDeduct > 0)
                {
                    if (!ForceFieldLocked && whichField != TechField.FORCE_FIELD)
                    {
                        prevValue = ForceFieldPercentage;
                        ForceFieldPercentage -= (ForceFieldPercentage >= amountToDeduct ? amountToDeduct : ForceFieldPercentage);
                        amountToDeduct -= (prevValue - ForceFieldPercentage);
                    }
                }
                if (amountToDeduct > 0)
                {
                    if (!PlanetologyLocked && whichField != TechField.PLANETOLOGY)
                    {
                        prevValue = PlanetologyPercentage;
                        PlanetologyPercentage -= (PlanetologyPercentage >= amountToDeduct ? amountToDeduct : PlanetologyPercentage);
                        amountToDeduct -= (prevValue - PlanetologyPercentage);
                    }
                }
                if (amountToDeduct > 0)
                {
                    if (!PropulsionLocked && whichField != TechField.PROPULSION)
                    {
                        prevValue = PropulsionPercentage;
                        PropulsionPercentage -= (PropulsionPercentage >= amountToDeduct ? amountToDeduct : PropulsionPercentage);
                        amountToDeduct -= (prevValue - PropulsionPercentage);
                    }
                }
                if (amountToDeduct > 0)
                {
                    if (!WeaponLocked && whichField != TechField.WEAPON)
                    {
                        prevValue = WeaponPercentage;
                        WeaponPercentage -= (WeaponPercentage >= amountToDeduct ? amountToDeduct : WeaponPercentage);
                        amountToDeduct -= (prevValue - WeaponPercentage);
                    }
                }
            }

            if (remainingPercentile > totalPointsExcludingSelectedType) //excess points needed to allocate
            {
                int amountToAdd = remainingPercentile - totalPointsExcludingSelectedType;
                if (!ComputerLocked && whichField != TechField.COMPUTER)
                {
                    ComputerPercentage += amountToAdd;
                    amountToAdd = 0;
                }
                if (amountToAdd > 0)
                {
                    if (!ConstructionLocked && whichField != TechField.CONSTRUCTION)
                    {
                        ConstructionPercentage += amountToAdd;
                        amountToAdd = 0;
                    }
                }
                if (amountToAdd > 0)
                {
                    if (!ForceFieldLocked && whichField != TechField.FORCE_FIELD)
                    {
                        ForceFieldPercentage += amountToAdd;
                        amountToAdd = 0;
                    }
                }
                if (amountToAdd > 0)
                {
                    if (!PlanetologyLocked && whichField != TechField.PLANETOLOGY)
                    {
                        PlanetologyPercentage += amountToAdd;
                        amountToAdd = 0;
                    }
                }
                if (amountToAdd > 0)
                {
                    if (!PropulsionLocked && whichField != TechField.PROPULSION)
                    {
                        PropulsionPercentage += amountToAdd;
                        amountToAdd = 0;
                    }
                }
                if (amountToAdd > 0)
                {
                    if (!WeaponLocked && whichField != TechField.WEAPON)
                    {
                        WeaponPercentage += amountToAdd;
                        amountToAdd = 0;
                    }
                }
                if (amountToAdd > 0)
                {
                    //All fields are already checked, so have to add the remaining back to the current tech field
                    switch (whichField)
                    {
                        case TechField.COMPUTER:
                            ComputerPercentage += amountToAdd;
                            break;
                        case TechField.CONSTRUCTION:
                            ConstructionPercentage += amountToAdd;
                            break;
                        case TechField.FORCE_FIELD:
                            ForceFieldPercentage += amountToAdd;
                            break;
                        case TechField.PLANETOLOGY:
                            PlanetologyPercentage += amountToAdd;
                            break;
                        case TechField.PROPULSION:
                            PropulsionPercentage += amountToAdd;
                            break;
                        case TechField.WEAPON:
                            WeaponPercentage += amountToAdd;
                            break;
                    }
                }
            }
        }
示例#14
0
 private int GetChanceForDiscovery(TechField whichField)
 {
     //Only items being currently researched have a chance of being discovered
     switch (whichField)
     {
         case TechField.COMPUTER:
         {
             if (ComputerPercentage > 0 && WhichComputerBeingResearched != null)
             {
                 int researchPointsRequired = (int)(WhichComputerBeingResearched.ResearchPoints * COST_MODIFIER * RaceModifiers[TechField.COMPUTER]);
                 if (ComputerResearchAmount > researchPointsRequired) //We now have a chance of discovering it
                 {
                     return (int)(((ComputerResearchAmount - researchPointsRequired) / (researchPointsRequired * 2)) * 100);
                 }
             }
         } break;
         case TechField.CONSTRUCTION:
             {
                 if (ConstructionPercentage > 0 && WhichConstructionBeingResearched != null)
                 {
                     int researchPointsRequired = (int)(WhichConstructionBeingResearched.ResearchPoints * COST_MODIFIER * RaceModifiers[TechField.CONSTRUCTION]);
                     if (ConstructionResearchAmount > researchPointsRequired) //We now have a chance of discovering it
                     {
                         return (int)(((ConstructionResearchAmount - researchPointsRequired) / (researchPointsRequired * 2)) * 100);
                     }
                 }
             } break;
         case TechField.FORCE_FIELD:
             {
                 if (ForceFieldPercentage > 0 && WhichForceFieldBeingResearched != null)
                 {
                     int researchPointsRequired = (int)(WhichForceFieldBeingResearched.ResearchPoints * COST_MODIFIER * RaceModifiers[TechField.FORCE_FIELD]);
                     if (ForceFieldResearchAmount > researchPointsRequired) //We now have a chance of discovering it
                     {
                         return (int)(((ForceFieldResearchAmount - researchPointsRequired) / (researchPointsRequired * 2)) * 100);
                     }
                 }
             } break;
         case TechField.PLANETOLOGY:
             {
                 if (PlanetologyPercentage > 0 && WhichPlanetologyBeingResearched != null)
                 {
                     int researchPointsRequired = (int)(WhichPlanetologyBeingResearched.ResearchPoints * COST_MODIFIER * RaceModifiers[TechField.PLANETOLOGY]);
                     if (PlanetologyResearchAmount > researchPointsRequired) //We now have a chance of discovering it
                     {
                         return (int)(((PlanetologyResearchAmount - researchPointsRequired) / (researchPointsRequired * 2)) * 100);
                     }
                 }
             } break;
         case TechField.PROPULSION:
             {
                 if (PropulsionPercentage > 0 && WhichPropulsionBeingResearched != null)
                 {
                     int researchPointsRequired = (int)(WhichPropulsionBeingResearched.ResearchPoints * COST_MODIFIER * RaceModifiers[TechField.PROPULSION]);
                     if (PropulsionResearchAmount > researchPointsRequired) //We now have a chance of discovering it
                     {
                         return (int)(((PropulsionResearchAmount - researchPointsRequired) / (researchPointsRequired * 2)) * 100);
                     }
                 }
             } break;
         case TechField.WEAPON:
             {
                 if (WeaponPercentage > 0 && WhichWeaponBeingResearched != null)
                 {
                     int researchPointsRequired = (int)(WhichWeaponBeingResearched.ResearchPoints * COST_MODIFIER * RaceModifiers[TechField.WEAPON]);
                     if (WeaponResearchAmount > researchPointsRequired) //We now have a chance of discovering it
                     {
                         return (int)(((WeaponResearchAmount - researchPointsRequired) / (researchPointsRequired * 2)) * 100);
                     }
                 }
             } break;
     }
     return 0;
 }
示例#15
0
 private float GetFieldInvestmentAmount(TechField whichField, float researchPoints)
 {
     switch (whichField)
     {
         case TechField.COMPUTER:
         {
             if (ComputerPercentage == 0)
             {
                 if (ComputerResearchAmount > 0)
                 {
                     //Lose 10% of total research invested if no research is being invested
                     return (ComputerResearchAmount * 0.9f) - ComputerResearchAmount;
                 }
                 return 0;
             }
             float interest = ComputerResearchAmount * 0.15f;
             float newPoints = (researchPoints * (ComputerPercentage * 0.01f));
             if ((newPoints * 2) < interest)
             {
                 //up to 15% interest, but if we contribute less than half the interest, then cap the interest to double the current investment
                 interest = newPoints * 2;
             }
             return (newPoints + interest);
         }
         case TechField.CONSTRUCTION:
         {
             if (ConstructionPercentage == 0)
             {
                 if (ConstructionResearchAmount > 0)
                 {
                     //Lose 10% of total research invested if no research is being invested
                     return (ConstructionResearchAmount * 0.9f) - ConstructionResearchAmount;
                 }
                 return 0;
             }
             float interest = ConstructionResearchAmount * 0.15f;
             float newPoints = (researchPoints * (ConstructionPercentage * 0.01f));
             if ((newPoints * 2) < interest)
             {
                 //up to 15% interest, but if we contribute less than half the interest, then cap the interest to double the current investment
                 interest = newPoints * 2;
             }
             return (newPoints + interest);
         }
         case TechField.FORCE_FIELD:
         {
             if (ForceFieldPercentage == 0)
             {
                 if (ForceFieldResearchAmount > 0)
                 {
                     //Lose 10% of total research invested if no research is being invested
                     return (ForceFieldResearchAmount * 0.9f) - ForceFieldResearchAmount;
                 }
                 return 0;
             }
             float interest = ForceFieldResearchAmount * 0.15f;
             float newPoints = (researchPoints * (ForceFieldPercentage * 0.01f));
             if ((newPoints * 2) < interest)
             {
                 //up to 15% interest, but if we contribute less than half the interest, then cap the interest to double the current investment
                 interest = newPoints * 2;
             }
             return (newPoints + interest);
         }
         case TechField.PLANETOLOGY:
         {
             if (PlanetologyPercentage == 0)
             {
                 if (PlanetologyResearchAmount > 0)
                 {
                     //Lose 10% of total research invested if no research is being invested
                     return (PlanetologyResearchAmount * 0.9f) - PlanetologyResearchAmount;
                 }
                 return 0;
             }
             float interest = PlanetologyResearchAmount * 0.15f;
             float newPoints = (researchPoints * (PlanetologyPercentage * 0.01f));
             if ((newPoints * 2) < interest)
             {
                 //up to 15% interest, but if we contribute less than half the interest, then cap the interest to double the current investment
                 interest = newPoints * 2;
             }
             return (newPoints + interest);
         }
         case TechField.PROPULSION:
         {
             if (PropulsionPercentage == 0)
             {
                 if (PropulsionResearchAmount > 0)
                 {
                     //Lose 10% of total research invested if no research is being invested
                     return (PropulsionResearchAmount * 0.9f) - PropulsionResearchAmount;
                 }
                 return 0;
             }
             float interest = PropulsionResearchAmount * 0.15f;
             float newPoints = (researchPoints * (PropulsionPercentage * 0.01f));
             if ((newPoints * 2) < interest)
             {
                 //up to 15% interest, but if we contribute less than half the interest, then cap the interest to double the current investment
                 interest = newPoints * 2;
             }
             return (newPoints + interest);
         }
         case TechField.WEAPON:
         {
             if (WeaponPercentage == 0)
             {
                 if (WeaponResearchAmount > 0)
                 {
                     //Lose 10% of total research invested if no research is being invested
                     return (WeaponResearchAmount * 0.9f) - WeaponResearchAmount;
                 }
                 return 0;
             }
             float interest = WeaponResearchAmount * 0.15f;
             float newPoints = (researchPoints * (WeaponPercentage * 0.01f));
             if ((newPoints * 2) < interest)
             {
                 //up to 15% interest, but if we contribute less than half the interest, then cap the interest to double the current investment
                 interest = newPoints * 2;
             }
             return (newPoints + interest);
         }
         default: return 0;
     }
 }
示例#16
0
 private void RefreshResearchedTechs(TechField whichField)
 {
     for (int i = 0; i < _techFieldButtons.Length; i++)
     {
         _techFieldButtons[i].Selected = false;
     }
     string techDescriptions = string.Empty;
     List<Technology> researchedTechs = new List<Technology>();
     switch (whichField)
     {
         case TechField.COMPUTER:
             {
                 _techFieldButtons[0].Selected = true;
                 researchedTechs = _gameMain.EmpireManager.CurrentEmpire.TechnologyManager.ResearchedComputerTechs;
             } break;
         case TechField.CONSTRUCTION:
             {
                 _techFieldButtons[1].Selected = true;
                 researchedTechs = _gameMain.EmpireManager.CurrentEmpire.TechnologyManager.ResearchedConstructionTechs;
             } break;
         case TechField.FORCE_FIELD:
             {
                 _techFieldButtons[2].Selected = true;
                 researchedTechs = _gameMain.EmpireManager.CurrentEmpire.TechnologyManager.ResearchedForceFieldTechs;
             } break;
         case TechField.PLANETOLOGY:
             {
                 _techFieldButtons[3].Selected = true;
                 researchedTechs = _gameMain.EmpireManager.CurrentEmpire.TechnologyManager.ResearchedPlanetologyTechs;
             } break;
         case TechField.PROPULSION:
             {
                 _techFieldButtons[4].Selected = true;
                 researchedTechs = _gameMain.EmpireManager.CurrentEmpire.TechnologyManager.ResearchedPropulsionTechs;
             } break;
         case TechField.WEAPON:
             {
                 _techFieldButtons[5].Selected = true;
                 researchedTechs = _gameMain.EmpireManager.CurrentEmpire.TechnologyManager.ResearchedWeaponTechs;
             } break;
     }
     foreach (var researchedTech in researchedTechs)
     {
         techDescriptions += researchedTech.TechName + " -\r\n" + researchedTech.TechDescription + "\r\n\r\n\r\n";
     }
     _researchedTechnologyDescriptions.SetText(techDescriptions);
     _researchedTechnologyDescriptions.ScrollToBottom();
 }
示例#17
0
        private int GetTotalPercentageExcludingTypeAndLocked(TechField techField)
        {
            int total = 0;

            if (!ComputerLocked && techField != TechField.COMPUTER)
            {
                total += ComputerPercentage;
            }
            if (!ConstructionLocked && techField != TechField.CONSTRUCTION)
            {
                total += ConstructionPercentage;
            }
            if (!ForceFieldLocked && techField != TechField.FORCE_FIELD)
            {
                total += ForceFieldPercentage;
            }
            if (!PlanetologyLocked && techField != TechField.PLANETOLOGY)
            {
                total += PlanetologyPercentage;
            }
            if (!PropulsionLocked && techField != TechField.PROPULSION)
            {
                total += PropulsionPercentage;
            }
            if (!WeaponLocked && techField != TechField.WEAPON)
            {
                total += WeaponPercentage;
            }

            return total;
        }
示例#18
0
 public void setCurrentResearchField(TechField currentResearchField)
 {
     this.currentResearchField = currentResearchField;
 }
示例#19
0
        public override bool MouseUp(int x, int y)
        {
            bool result = false;

            for (int i = 0; i < _techFieldButtons.Length; i++)
            {
                if (_techFieldButtons[i].MouseUp(x, y))
                {
                    switch (i)
                    {
                    case 0: RefreshResearchedTechs(TechField.COMPUTER);
                        break;

                    case 1: RefreshResearchedTechs(TechField.CONSTRUCTION);
                        break;

                    case 2: RefreshResearchedTechs(TechField.FORCE_FIELD);
                        break;

                    case 3: RefreshResearchedTechs(TechField.PLANETOLOGY);
                        break;

                    case 4: RefreshResearchedTechs(TechField.PROPULSION);
                        break;

                    case 5: RefreshResearchedTechs(TechField.WEAPON);
                        break;
                    }
                    result = true;
                }
            }
            for (int i = 0; i < _techLockButtons.Length; i++)
            {
                if (_techLockButtons[i].MouseUp(x, y))
                {
                    switch (i)
                    {
                    case 0:
                        _gameMain.EmpireManager.CurrentEmpire.TechnologyManager.ComputerLocked = !_gameMain.EmpireManager.CurrentEmpire.TechnologyManager.ComputerLocked;
                        break;

                    case 1:
                        _gameMain.EmpireManager.CurrentEmpire.TechnologyManager.ConstructionLocked = !_gameMain.EmpireManager.CurrentEmpire.TechnologyManager.ConstructionLocked;
                        break;

                    case 2:
                        _gameMain.EmpireManager.CurrentEmpire.TechnologyManager.ForceFieldLocked = !_gameMain.EmpireManager.CurrentEmpire.TechnologyManager.ForceFieldLocked;
                        break;

                    case 3:
                        _gameMain.EmpireManager.CurrentEmpire.TechnologyManager.PlanetologyLocked = !_gameMain.EmpireManager.CurrentEmpire.TechnologyManager.PlanetologyLocked;
                        break;

                    case 4:
                        _gameMain.EmpireManager.CurrentEmpire.TechnologyManager.PropulsionLocked = !_gameMain.EmpireManager.CurrentEmpire.TechnologyManager.PropulsionLocked;
                        break;

                    case 5:
                        _gameMain.EmpireManager.CurrentEmpire.TechnologyManager.WeaponLocked = !_gameMain.EmpireManager.CurrentEmpire.TechnologyManager.WeaponLocked;
                        break;
                    }
                    RefreshLockedStatus();
                }
            }
            for (int i = 0; i < _techSliders.Length; i++)
            {
                if (_techSliders[i].MouseUp(x, y))
                {
                    TechField whichField = TechField.COMPUTER;
                    switch (i)
                    {
                    case 1: whichField = TechField.CONSTRUCTION;
                        break;

                    case 2: whichField = TechField.FORCE_FIELD;
                        break;

                    case 3: whichField = TechField.PLANETOLOGY;
                        break;

                    case 4: whichField = TechField.PROPULSION;
                        break;

                    case 5: whichField = TechField.WEAPON;
                        break;
                    }
                    _gameMain.EmpireManager.CurrentEmpire.TechnologyManager.SetPercentage(whichField, _techSliders[i].TopIndex);
                    RefreshSliders();
                    RefreshProgressLabels();
                }
            }
            if (!base.MouseUp(x, y))
            {
                //Clicked outside window, close the window
                if (CloseWindow != null)
                {
                    CloseWindow();
                    return(true);
                }
            }
            return(result);
        }
示例#20
0
    public static void techLevel(Player player, TechField field, int level, TechField next_field)
    {
        string text = "Your scientists have completed research into Tech Level " + level + " for " + field.ToString() + ".  They will continue their efforts in the " + next_field.ToString() + " field.";

        player.getMessages().Add(new Message(MessageType.GainTechLevel, text));
    }
示例#21
0
        public string GetFieldProgressString(TechField whichField, float researchPoints)
        {
            string progressString = string.Empty;
            int chance = 0;
            float amount = 0;
            float researchedAmount = 0;
            int researchCost = 0;
            switch (whichField)
            {
                case TechField.COMPUTER:
                    {
                        if (WhichComputerBeingResearched == null)
                        {
                            return "N/A";
                        }
                        amount = GetFieldInvestmentAmount(whichField, researchPoints);
                        //Temporarily update the research amount to get accurate chance of discovery
                        float oldAmount = ComputerResearchAmount;
                        ComputerResearchAmount += amount;
                        chance = GetChanceForDiscovery(whichField);
                        ComputerResearchAmount = oldAmount;
                        researchedAmount = ComputerResearchAmount;
                        researchCost = (int)(WhichComputerBeingResearched.ResearchPoints * COST_MODIFIER * RaceModifiers[TechField.COMPUTER]);
                    } break;
                case TechField.CONSTRUCTION:
                    {
                        if (WhichConstructionBeingResearched == null)
                        {
                            return "N/A";
                        }
                        amount = GetFieldInvestmentAmount(whichField, researchPoints);
                        //Temporarily update the research amount to get accurate chance of discovery
                        float oldAmount = ConstructionResearchAmount;
                        ConstructionResearchAmount += amount;
                        chance = GetChanceForDiscovery(whichField);
                        ConstructionResearchAmount = oldAmount;
                        researchedAmount = ConstructionResearchAmount;
                        researchCost = (int)(WhichConstructionBeingResearched.ResearchPoints * COST_MODIFIER * RaceModifiers[TechField.CONSTRUCTION]);
                    } break;
                case TechField.FORCE_FIELD:
                    {
                        if (WhichForceFieldBeingResearched == null)
                        {
                            return "N/A";
                        }
                        amount = GetFieldInvestmentAmount(whichField, researchPoints);
                        //Temporarily update the research amount to get accurate chance of discovery
                        float oldAmount = ForceFieldResearchAmount;
                        ForceFieldResearchAmount += amount;
                        chance = GetChanceForDiscovery(whichField);
                        ForceFieldResearchAmount = oldAmount;
                        researchedAmount = ForceFieldResearchAmount;
                        researchCost = (int)(WhichForceFieldBeingResearched.ResearchPoints * COST_MODIFIER * RaceModifiers[TechField.FORCE_FIELD]);
                    } break;
                case TechField.PLANETOLOGY:
                    {
                        if (WhichPlanetologyBeingResearched == null)
                        {
                            return "N/A";
                        }
                        amount = GetFieldInvestmentAmount(whichField, researchPoints);
                        //Temporarily update the research amount to get accurate chance of discovery
                        float oldAmount = PlanetologyResearchAmount;
                        PlanetologyResearchAmount += amount;
                        chance = GetChanceForDiscovery(whichField);
                        PlanetologyResearchAmount = oldAmount;
                        researchedAmount = PlanetologyResearchAmount;
                        researchCost = (int)(WhichPlanetologyBeingResearched.ResearchPoints * COST_MODIFIER * RaceModifiers[TechField.PLANETOLOGY]);
                    } break;
                case TechField.PROPULSION:
                    {
                        if (WhichPropulsionBeingResearched == null)
                        {
                            return "N/A";
                        }
                        amount = GetFieldInvestmentAmount(whichField, researchPoints);
                        //Temporarily update the research amount to get accurate chance of discovery
                        float oldAmount = PropulsionResearchAmount;
                        PropulsionResearchAmount += amount;
                        chance = GetChanceForDiscovery(whichField);
                        PropulsionResearchAmount = oldAmount;
                        researchedAmount = PropulsionResearchAmount;
                        researchCost = (int)(WhichPropulsionBeingResearched.ResearchPoints * COST_MODIFIER * RaceModifiers[TechField.PROPULSION]);
                    } break;
                case TechField.WEAPON:
                    {
                        if (WhichWeaponBeingResearched == null)
                        {
                            return "N/A";
                        }
                        amount = GetFieldInvestmentAmount(whichField, researchPoints);
                        //Temporarily update the research amount to get accurate chance of discovery
                        float oldAmount = WeaponResearchAmount;
                        WeaponResearchAmount += amount;
                        chance = GetChanceForDiscovery(whichField);
                        WeaponResearchAmount = oldAmount;
                        researchedAmount = WeaponResearchAmount;
                        researchCost = (int)(WhichWeaponBeingResearched.ResearchPoints * COST_MODIFIER * RaceModifiers[TechField.WEAPON]);
                    } break;
            }
            progressString = string.Format("{0:0.0} / {1:0.0}", researchedAmount, researchCost);
            progressString += " (" + (amount >= 0 ? " +" : "") + string.Format("{0:0.0}", amount) + ")";
            if (chance > 0)
            {
                progressString += " " + chance + "%";
            }

            return progressString;
        }
示例#22
0
        public Technology(TechField techField, string name, string desc, int level,
						string secondaryName = "",
						//Optional arguments goes here
						int roboticControl = 0,
						int battleComputer = 0,
						bool battleScanner = false,
						int ECM = 0,
						int spaceScanner = 0,
						bool hyperSpaceCommunicator = false,
						bool oracleInterface = false,
						bool technologyNullifier = false,
						int armor = 0,
						bool reserveFuelTanks = false,
						int industrialTech = 10,
						int industrialWaste = 100,
						int groundArmor = 0,
						int repair = 0,
						int shield = 0,
						int personalShield = 0,
						int planetaryShield = 0,
						bool repulsorBeam = false,
						bool cloakingDevice = false,
						int missileShield = 0,
						bool statisField = false,
						bool blackHoleGenerator = false,
						int ecoCleanup = 0,
						int terraforming = 0,
						int terraformCost = 6,
						int colony = 0,
						int cloning = 20,
						int bioWeapon = 0,
						int bioAntidote = 0,
						int enrichment = 0,
						int speed = 0,
						int maneuverSpeed = 0,
						int fuelRange = 0,
						bool inertialstabilizer = false,
						bool energypulsar = false,
						bool warpDissipator = false,
						bool highEnergyFocus = false,
						bool stargate = false,
						bool subSpaceTeleporter = false,
						bool ionicPulsar = false,
						bool subspaceInterdictor = false,
						bool combatTransporters = false,
						bool inertialNullifier = false,
						bool displacementDevice = false,
						bool antiMissileRockets = false,
						bool ionStreamProjector = false,
						bool neutronStreamProjector = false,
						float smallSize = 0,
						float smallCost = 0,
						float smallPower = 0,
						float smallHP = 0,
						float mediumSize = 0,
						float mediumCost = 0,
						float mediumPower = 0,
						float mediumHP = 0,
						float largeSize = 0,
						float largeCost = 0,
						float largePower = 0,
						float largeHP = 0,
						float hugeSize = 0,
						float hugeCost = 0,
						float hugePower = 0,
						float hugeHP = 0,
						float genericSize = 0,
						float genericCost = 0,
						float genericPower = 0,
						float smallSecondarySize = 0,
						float smallSecondaryCost = 0,
						float smallSecondaryPower = 0,
						float smallSecondaryHP = 0,
						float mediumSecondarySize = 0,
						float mediumSecondaryCost = 0,
						float mediumSecondaryPower = 0,
						float mediumSecondaryHP = 0,
						float largeSecondarySize = 0,
						float largeSecondaryCost = 0,
						float largeSecondaryPower = 0,
						float largeSecondaryHP = 0,
						float hugeSecondarySize = 0,
						float hugeSecondaryCost = 0,
						float hugeSecondaryPower = 0,
						float hugeSecondaryHP = 0,
						float genericSecondarySize = 0,
						float genericSecondaryCost = 0,
						float genericSecondaryPower = 0,
						int weaponType = 0,
						int minimumWeaponDamage = 0,
						int minimumSecondaryWeaponDamage = 0,
						int maximumWeaponDamage = 0,
						int maximumSecondaryWeaponDamage = 0,
						bool shieldPiercing = false,
						float weaponRange = 0,
						int secondaryWeaponRange = 0,
						int numberOfShots = 0,
						bool streaming = false,
						int targetingBonus = 0,
						bool enveloping = false,
						bool dissipating = false,
						float missileSpeed = 0
						)
        {
            TechLevel = level;
            TechField = techField;
            TechName = name;
            TechDescription = desc;
            TechSecondaryName = secondaryName;
            RoboticControl = roboticControl;
            BattleComputer = battleComputer;
            BattleScanner = battleScanner;
            this.ECM = ECM;
            SpaceScanner = spaceScanner;
            HyperSpaceCommunicator = hyperSpaceCommunicator;
            OracleInterface = oracleInterface;
            TechnologyNullifier = technologyNullifier;
            Armor = armor;
            ReserveFuelTanks = reserveFuelTanks;
            IndustrialTech = industrialTech;
            IndustrialWaste = industrialWaste;
            GroundArmor = groundArmor;
            Repair = repair;
            Shield = shield;
            PersonalShield = personalShield;
            PlanetaryShield = planetaryShield;
            RepulsorBeam = repulsorBeam;
            CloakingDevice = cloakingDevice;
            MissileShield = missileShield;
            StatisField = statisField;
            BlackHoleGenerator = blackHoleGenerator;
            EcoCleanup = ecoCleanup;
            Terraforming = terraforming;
            TerraformCost = terraformCost;
            Colony = colony;
            Cloning = cloning;
            BioWeapon = bioWeapon;
            BioAntidote = bioAntidote;
            Enrichment = enrichment;
            Speed = speed;
            ManeuverSpeed = maneuverSpeed;
            FuelRange = fuelRange;
            InertialStabilizer = inertialstabilizer;
            EnergyPulsar = energypulsar;
            WarpDissipator = warpDissipator;
            HighEnergyFocus = highEnergyFocus;
            SubspaceTeleporter = subSpaceTeleporter;
            IonicPulsar = ionicPulsar;
            SubspaceInterdictor = subspaceInterdictor;
            CombatTransporters = combatTransporters;
            InertialNullifier = inertialNullifier;
            DisplacementDevice = displacementDevice;
            AntiMissileRockets = antiMissileRockets;
            IonStreamProjector = ionStreamProjector;
            NeutronStreamProjector = neutronStreamProjector;
            Stargate = stargate;

            //Ship component info
            SmallSize = smallSize;
            SmallCost = smallCost;
            SmallPower = smallPower;
            SmallHP = smallHP;
            MediumSize = mediumSize;
            MediumCost = mediumCost;
            MediumPower = mediumPower;
            MediumHP = mediumHP;
            LargeSize = largeSize;
            LargeCost = largeCost;
            LargePower = largePower;
            LargeHP = largeHP;
            HugeSize = hugeSize;
            HugeCost = hugeCost;
            HugePower = hugePower;
            HugeHP = hugeHP;
            GenericSize = genericSize;
            GenericCost = genericCost;
            GenericPower = genericPower;
            SmallSecondarySize = smallSecondarySize;
            SmallSecondaryCost = smallSecondaryCost;
            SmallSecondaryPower = smallSecondaryPower;
            SmallSecondaryHP = smallSecondaryHP;
            MediumSecondarySize = mediumSecondarySize;
            MediumSecondaryCost = mediumSecondaryCost;
            MediumSecondaryPower = mediumSecondaryPower;
            MediumSecondaryHP = mediumSecondaryHP;
            LargeSecondarySize = largeSecondarySize;
            LargeSecondaryCost = largeSecondaryCost;
            LargeSecondaryPower = largeSecondaryPower;
            LargeSecondaryHP = largeSecondaryHP;
            HugeSecondarySize = hugeSecondarySize;
            HugeSecondaryCost = hugeSecondaryCost;
            HugeSecondaryPower = hugeSecondaryPower;
            HugeSecondaryHP = hugeSecondaryHP;
            GenericSecondarySize = genericSecondarySize;
            GenericSecondaryCost = genericSecondaryCost;
            GenericSecondaryPower = genericSecondaryPower;

            WeaponType = weaponType;
            MinimumWeaponDamage = minimumWeaponDamage;
            MinimumSecondaryWeaponDamage = minimumSecondaryWeaponDamage;
            MaximumWeaponDamage = maximumWeaponDamage;
            MaximumSecondaryWeaponDamage = maximumSecondaryWeaponDamage;
            ShieldPiercing = shieldPiercing;
            WeaponRange = weaponRange;
            SecondaryWeaponRange = secondaryWeaponRange;
            NumberOfShots = numberOfShots;
            Streaming = streaming;
            TargetingBonus = targetingBonus;
            Enveloping = enveloping;
            Dissipating = dissipating;
            MissileSpeed = missileSpeed;
        }
示例#23
0
 private void LoadNextTech()
 {
     //Go in order from Computer, Construction, Force Field, Planetology, Propulsion, to Weapon
     if (_availableTopics.ContainsKey(TechField.COMPUTER))
     {
         _currentTechField = TechField.COMPUTER;
         //Check to see if there's a researched item
         bool hasDiscovered = false;
         foreach (var researchedItem in _discoveredTechs)
         {
             if (_currentEmpire.TechnologyManager.ResearchedComputerTechs.Contains(researchedItem))
             {
                 _techIcon = SpriteManager.GetSprite("RandomRace", _gameMain.Random);
                 _techDescription.SetText(researchedItem.TechName + "\n\r\n\r" + researchedItem.TechDescription);
                 hasDiscovered = true;
                 break;
             }
         }
         if (!hasDiscovered)
         {
             _techIcon = SpriteManager.GetSprite("RandomRace", _gameMain.Random);
             _techDescription.SetText("Computer technologies help with increasing number of factories, better scanners, improving your attack and missile defense on ships, and spying efforts benefits from higher computer tech level.");
         }
     }
     else if (_availableTopics.ContainsKey(TechField.CONSTRUCTION))
     {
         _currentTechField = TechField.CONSTRUCTION;
         //Check to see if there's a researched item
         bool hasDiscovered = false;
         foreach (var researchedItem in _discoveredTechs)
         {
             if (_currentEmpire.TechnologyManager.ResearchedConstructionTechs.Contains(researchedItem))
             {
                 _techIcon = SpriteManager.GetSprite("RandomRace", _gameMain.Random);
                 _techDescription.SetText(researchedItem.TechName + "\n\r\n\r" + researchedItem.TechDescription);
                 hasDiscovered = true;
                 break;
             }
         }
         if (!hasDiscovered)
         {
             _techIcon = SpriteManager.GetSprite("RandomRace", _gameMain.Random);
             _techDescription.SetText("Construction technologies gives you better armor, cheaper factories, reduced pollution, and higher construction tech levels gives you more room on ships.");
         }
     }
     else if (_availableTopics.ContainsKey(TechField.FORCE_FIELD))
     {
         _currentTechField = TechField.FORCE_FIELD;
         //Check to see if there's a researched item
         bool hasDiscovered = false;
         foreach (var researchedItem in _discoveredTechs)
         {
             if (_currentEmpire.TechnologyManager.ResearchedForceFieldTechs.Contains(researchedItem))
             {
                 _techIcon = SpriteManager.GetSprite("RandomRace", _gameMain.Random);
                 _techDescription.SetText(researchedItem.TechName + "\n\r\n\r" + researchedItem.TechDescription);
                 hasDiscovered = true;
                 break;
             }
         }
         if (!hasDiscovered)
         {
             _techIcon = SpriteManager.GetSprite("RandomRace", _gameMain.Random);
             _techDescription.SetText("Force field technologies gives you better shields, as well as planetary shields and nifty special items.");
         }
     }
     else if (_availableTopics.ContainsKey(TechField.PLANETOLOGY))
     {
         _currentTechField = TechField.PLANETOLOGY;
         //Check to see if there's a researched item
         bool hasDiscovered = false;
         foreach (var researchedItem in _discoveredTechs)
         {
             if (_currentEmpire.TechnologyManager.ResearchedPlanetologyTechs.Contains(researchedItem))
             {
                 _techIcon = SpriteManager.GetSprite("RandomRace", _gameMain.Random);
                 _techDescription.SetText(researchedItem.TechName + "\n\r\n\r" + researchedItem.TechDescription);
                 hasDiscovered = true;
                 break;
             }
         }
         if (!hasDiscovered)
         {
             _techIcon = SpriteManager.GetSprite("RandomRace", _gameMain.Random);
             _techDescription.SetText("Planetology technologies gives you terraforming and bigger planets, cheaper pollution cleanup, as well as expanding the number of planets you can colonize.  Also includes biological warfare.");
         }
     }
     else if (_availableTopics.ContainsKey(TechField.PROPULSION))
     {
         _currentTechField = TechField.PROPULSION;
         //Check to see if there's a researched item
         bool hasDiscovered = false;
         foreach (var researchedItem in _discoveredTechs)
         {
             if (_currentEmpire.TechnologyManager.ResearchedPropulsionTechs.Contains(researchedItem))
             {
                 _techIcon = SpriteManager.GetSprite("RandomRace", _gameMain.Random);
                 _techDescription.SetText(researchedItem.TechName + "\n\r\n\r" + researchedItem.TechDescription);
                 hasDiscovered = true;
                 break;
             }
         }
         if (!hasDiscovered)
         {
             _techIcon = SpriteManager.GetSprite("RandomRace", _gameMain.Random);
             _techDescription.SetText("Propulsion technologies gives you faster engines, expanded range, and powerful special equipment.");
         }
     }
     else if (_availableTopics.ContainsKey(TechField.WEAPON))
     {
         _currentTechField = TechField.WEAPON;
         //Check to see if there's a researched item
         bool hasDiscovered = false;
         foreach (var researchedItem in _discoveredTechs)
         {
             if (_currentEmpire.TechnologyManager.ResearchedWeaponTechs.Contains(researchedItem))
             {
                 _techIcon = SpriteManager.GetSprite("RandomRace", _gameMain.Random);
                 _techDescription.SetText(researchedItem.TechName + "\n\r\n\r" + researchedItem.TechDescription);
                 hasDiscovered = true;
                 break;
             }
         }
         if (!hasDiscovered)
         {
             _techIcon = SpriteManager.GetSprite("RandomRace", _gameMain.Random);
             _techDescription.SetText("Weapon technologies gives you weapons. A lot of weapons.");
         }
     }
     if (_availableTopics[_currentTechField].Count > 0)
     {
         if (_availableTopics[_currentTechField].Count > _availableTechsToResearchButtons.Length)
         {
             _maxVisible = _availableTechsToResearchButtons.Length;
             _scrollBar.SetEnabledState(true);
             _scrollBar.SetAmountOfItems(_availableTopics[_currentTechField].Count);
         }
         else
         {
             _maxVisible = _availableTopics[_currentTechField].Count;
             _scrollBar.SetAmountOfItems(_availableTechsToResearchButtons.Length);
             _scrollBar.SetEnabledState(false);
         }
         RefreshTechButtons();
     }
 }