コード例 #1
0
 public ResearchCost(ResearchCost researchCost)
 {
     this.energy        = researchCost.energy;
     this.weapons       = researchCost.weapons;
     this.propulsion    = researchCost.propulsion;
     this.construction  = researchCost.construction;
     this.electronics   = researchCost.electronics;
     this.biotechnology = researchCost.biotechnology;
 }
コード例 #2
0
 public ResearchCost() : base()
 {
     energy        = ResearchCostLevel.Standard;
     weapons       = ResearchCostLevel.Standard;
     propulsion    = ResearchCostLevel.Standard;
     construction  = ResearchCostLevel.Standard;
     electronics   = ResearchCostLevel.Standard;
     biotechnology = ResearchCostLevel.Standard;
 }
コード例 #3
0
 public ResearchCost(ResearchCostLevel energy, ResearchCostLevel weapons, ResearchCostLevel propulsion, ResearchCostLevel construction,
                     ResearchCostLevel electronics, ResearchCostLevel biotechnology) : base()
 {
     this.energy        = energy;
     this.weapons       = weapons;
     this.propulsion    = propulsion;
     this.construction  = construction;
     this.electronics   = electronics;
     this.biotechnology = biotechnology;
 }
コード例 #4
0
ファイル: Race.cs プロジェクト: TomCR94/UnityStars
    /**
     * 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);
    }
コード例 #5
0
 public void setElectronics(ResearchCostLevel electronics)
 {
     this.electronics = electronics;
 }
コード例 #6
0
 public void setBiotechnology(ResearchCostLevel biotechnology)
 {
     this.biotechnology = biotechnology;
 }
コード例 #7
0
 public void setConstruction(ResearchCostLevel construction)
 {
     this.construction = construction;
 }
コード例 #8
0
 public void setPropulsion(ResearchCostLevel propulsion)
 {
     this.propulsion = propulsion;
 }
コード例 #9
0
 public void setWeapons(ResearchCostLevel weapons)
 {
     this.weapons = weapons;
 }
コード例 #10
0
 public void setEnergy(ResearchCostLevel energy)
 {
     this.energy = energy;
 }
コード例 #11
0
/*
 * Get the Advantage points for a race
 */
    public static int getPointsAdvantage(Race race)
    {
        RacePointsCalculator.race = race;
        race.init();

        int points = Consts.raceStartingPoints;

        int habPoints = (int)(getHabRange() / 2000);

        int growthRateFactor = race.getGrowthRate();

        float grRate = growthRateFactor;

        if (growthRateFactor <= 5)
        {
            points += (6 - growthRateFactor) * 4200;
        }
        else if (growthRateFactor <= 13)
        {
            switch (growthRateFactor)
            {
            case 6:
                points += 3600;
                break;

            case 7:
                points += 2250;
                break;

            case 8:
                points += 600;
                break;

            case 9:
                points += 225;
                break;
            }
            growthRateFactor = growthRateFactor * 2 - 5;
        }
        else if (growthRateFactor < 20)
        {
            growthRateFactor = (growthRateFactor - 6) * 3;
        }
        else
        {
            growthRateFactor = 45;
        }

        points -= (int)(habPoints * growthRateFactor) / 24;

        int numImmunities = 0;

        for (int habType = 0; habType < 3; habType++)
        {
            if (race.isImmune(habType))
            {
                numImmunities++;
            }
            else
            {
                points += Mathf.Abs(race.getHabCenter(habType) - 50) * 4;
            }
        }

        if (numImmunities > 1)
        {
            points -= 150;
        }

        int operationPoints  = race.getNumFactories();
        int productionPoints = race.getFactoryOutput();

        if (operationPoints > 10 || productionPoints > 10)
        {
            operationPoints -= 9;
            if (operationPoints < 1)
            {
                operationPoints = 1;
            }
            productionPoints -= 9;
            if (productionPoints < 1)
            {
                productionPoints = 1;
            }

            int factoryProductionCost = 2;
            if (race.getPRT() == PRT.HE)
            {
                factoryProductionCost = 3;
            }

            productionPoints *= factoryProductionCost;

            if (numImmunities >= 2)
            {
                points -= (int)((productionPoints * operationPoints) * grRate) / 2;
            }
            else
            {
                points -= (int)((productionPoints * operationPoints) * grRate) / 9;
            }
        }

        int popEfficiency = race.getColonistsPerResource() / 100;

        if (popEfficiency > 25)
        {
            popEfficiency = 25;
        }

        if (popEfficiency <= 7)
        {
            points -= 2400;
        }
        else if (popEfficiency == 8)
        {
            points -= 1260;
        }
        else if (popEfficiency == 9)
        {
            points -= 600;
        }
        else if (popEfficiency > 10)
        {
            points += (popEfficiency - 10) * 120;
        }

        if (race.getPRT() == PRT.AR)
        {
            points += 210;
        }
        else
        {
            productionPoints = 10 - race.getFactoryOutput();
            int costPoints = 10 - race.getFactoryCost();
            operationPoints = 10 - race.getNumFactories();
            int tmpPoints = 0;

            if (productionPoints > 0)
            {
                tmpPoints = productionPoints * 100;
            }
            else
            {
                tmpPoints = productionPoints * 121;
            }

            if (costPoints > 0)
            {
                tmpPoints += costPoints * costPoints * -60;
            }
            else
            {
                tmpPoints += costPoints * -55;
            }

            if (operationPoints > 0)
            {
                tmpPoints += operationPoints * 40;
            }
            else
            {
                tmpPoints += operationPoints * 35;
            }

            int llfp = 700;
            if (tmpPoints > llfp)
            {
                tmpPoints = (tmpPoints - llfp) / 3 + llfp;
            }

            if (operationPoints <= -7)
            {
                if (operationPoints < -11)
                {
                    if (operationPoints < -14)
                    {
                        tmpPoints -= 360;
                    }
                    else
                    {
                        tmpPoints += (operationPoints + 7) * 45;
                    }
                }
                else
                {
                    tmpPoints += (operationPoints + 6) * 30;
                }
            }

            if (productionPoints <= -3)
            {
                tmpPoints += (productionPoints + 2) * 60;
            }

            points += tmpPoints;

            if (race.isFactoriesCostLess())
            {
                points -= 175;
            }
            productionPoints = 10 - race.getMineOutput();
            costPoints       = 3 - race.getMineCost();
            operationPoints  = 10 - race.getNumMines();
            tmpPoints        = 0;

            if (productionPoints > 0)
            {
                tmpPoints = productionPoints * 100;
            }
            else
            {
                tmpPoints = productionPoints * 169;
            }

            if (costPoints > 0)
            {
                tmpPoints -= 360;
            }
            else
            {
                tmpPoints += costPoints * (-65) + 80;
            }

            if (operationPoints > 0)
            {
                tmpPoints += operationPoints * 40;
            }
            else
            {
                tmpPoints += operationPoints * 35;
            }

            points += tmpPoints;
        }

        points += prtPointCost[race.getPRT()];

        // too many lrts
        int badLRTs  = 0;
        int goodLRTs = 0;

        foreach (LRT lrt in race.getLrts())
        {
            if (lrtPointCost[lrt] >= 0)
            {
                badLRTs++;
            }
            else
            {
                goodLRTs++;
            }
            points += lrtPointCost[lrt];
        }

        if (goodLRTs + badLRTs > 4)
        {
            points -= (goodLRTs + badLRTs) * (goodLRTs + badLRTs - 4) * 10;
        }
        if (badLRTs - goodLRTs > 3)
        {
            points -= (badLRTs - goodLRTs - 3) * 60;
        }
        if (goodLRTs - badLRTs > 3)
        {
            points -= (goodLRTs - badLRTs - 3) * 40;
        }

        if (race.getLrts().Contains(LRT.NAS))
        {
            if (race.getPRT() == PRT.PP)
            {
                points -= 280;
            }
            else if (race.getPRT() == PRT.SS)
            {
                points -= 200;
            }
            else if (race.getPRT() == PRT.JoaT)
            {
                points -= 40;
            }
        }

        int techcosts = 0;

        for (int i = 0; i < 6; i++)
        {
            ResearchCostLevel rc = race.getResearchCost().getAtIndex(i);
            if (rc == ResearchCostLevel.Extra)
            {
                techcosts--;
            }
            else if (rc == ResearchCostLevel.Less)
            {
                techcosts++;
            }
        }
        if (techcosts > 0)
        {
            points -= (techcosts * techcosts) * 130;
            if (techcosts >= 6)
            {
                points += 1430;
            }
            else if (techcosts == 5)
            {
                points += 520;
            }
        }
        else if (techcosts < 0)
        {
            int[] scienceCost = new int[] { 150, 330, 540, 780, 1050, 1380 };
            points += scienceCost[(-techcosts) - 1];
            if (techcosts < -4 && race.getColonistsPerResource() < 1000)
            {
                points -= 190;
            }
        }

        if (race.isTechsStartHigh())
        {
            points -= 180;
        }

        if (race.getPRT() == PRT.AR && race.getResearchCost().getEnergy() == ResearchCostLevel.Less)
        {
            points -= 100;
        }

        return(points / 3);
    }