示例#1
0
    public int getNavelProjection(Nation player)
    {
        int   capacity    = getNavalUnitCapacity(player);
        float strength    = 0;
        float infantryMod = 0.6f;
        float cavalryMod  = 0.75f;
        float fighterMod  = 1.0f;

        if (player.GetTechnologies().Contains("flintlock"))
        {
            infantryMod = 1f;
            cavalryMod  = 1.1f;
        }
        if (player.GetTechnologies().Contains("breech_loaded_arms"))
        {
            infantryMod = 1.2f;
            cavalryMod  = 1.2f;
        }
        if (player.GetTechnologies().Contains("machine_guns"))
        {
            infantryMod = 1.5f;
            cavalryMod  = 1.3f;
        }
        if (player.GetTechnologies().Contains("bolt_action_rifles"))
        {
            infantryMod = 1.8f;
            cavalryMod  = 1.4f;
        }
        float artMod  = 1.0f;
        float tankMod = 2.0f;

        if (player.GetTechnologies().Contains("breech_loaded_arms"))
        {
            artMod = 1.15f;
        }
        if (player.GetTechnologies().Contains("indirect_fire"))
        {
            artMod = 1.45f;
        }
        if (player.GetTechnologies().Contains("heavy_armament"))
        {
            artMod  = 1.8f;
            tankMod = 1.22f;
        }

        if (player.GetTechnologies().Contains("bombers"))
        {
            fighterMod = 1.25f;
        }

        if (player.GetTechnologies().Contains("radar"))
        {
            fighterMod = 1.5f;
        }

        int numInf     = PlayerCalculator.getTotalNumberInfantry(player);
        int numCav     = PlayerCalculator.getTotalNumberCavalry(player);
        int numArt     = PlayerCalculator.getTotalNumberArtillery(player);
        int numTank    = PlayerCalculator.getTotalNumberTanks(player);
        int numFighter = PlayerCalculator.getTotalNumberFighters(player);

        strength += fighterMod * 2.8f * numFighter;

        for (int i = 0; i < numInf; i++)
        {
            strength += infantryMod;
            capacity -= 1;
            if (capacity < 1)
            {
                return((int)strength);
            }
        }

        for (int i = 0; i < numTank; i++)
        {
            strength += tankMod * 3.5f;
            capacity -= 3;
            if (capacity < 1)
            {
                return((int)strength);
            }
        }

        for (int i = 0; i < numArt; i++)
        {
            strength += artMod * 1.33f;
            capacity -= 2;
            if (capacity < 1)
            {
                return((int)strength);
            }
        }

        for (int i = 0; i < numArt; i++)
        {
            strength += cavalryMod * 1.22f;
            capacity -= 2;
            if (capacity < 1)
            {
                return((int)strength);
            }
        }
        return((int)strength);
    }