예제 #1
0
파일: Player.cs 프로젝트: zodern/VortexWars
        public int getDefenseWithBonus(int defaultDefense, GameSettings settings, bool usingDefenseBoost, Map map)
        {
            if (!settings.upgradesEnabled || bonusesDisabled)
            {
                return(defaultDefense);
            }

            double bonus = 1.0;

            if (race == 103)
            {
                bonus = 1.05;
            }
            if (race == 104)
            {
                bonus = 1.05;
            }
            if (race == 105)
            {
                bonus = 0.95;
            }
            if (race == 106)
            {
                bonus = 1.05;
            }
            if (race == 108)
            {
                bonus = 1.05;
            }
            if (race == 118)
            {
                bonus = 0.95;
            }
            if (race == 117 && usingDefenseBoost)
            {
                bonus = 1.1;
            }
            if (race == 121)
            {
                if (strength <= 5)
                {
                    bonus = 1.15;
                }
                else
                {
                    int max = map.GetRegionCount() / 2;
                    if (strength >= max)
                    {
                        bonus = 1;
                    }
                    else
                    {
                        bonus = 1 + 0.15 - 0.15 * (strength - 5.0) / (max - 5.0);
                    }
                }
            }

            if (bonus == 1)
            {
                return(defaultDefense);
            }

            return(bonus > 1.0 ? (int)Math.Floor(defaultDefense * bonus) : (int)Math.Ceiling(defaultDefense * bonus));
        }
예제 #2
0
파일: Player.cs 프로젝트: zodern/VortexWars
        public int getAttackWithBonus(int defaultAttack, GameSettings settings, int attackerStrength, int defenderStrength, bool usingAttackBoost, Map map, bool hasDefenseBoost)
        {
            if (!settings.upgradesEnabled || bonusesDisabled)
            {
                return(defaultAttack);
            }

            double bonus = 1.0;

            if (race == 102)
            {
                bonus = 1.05;
            }
            if (race == 104)
            {
                bonus = 1.05;
            }
            if (race == 105)
            {
                bonus = 0.95;
            }
            if (race == 107)
            {
                bonus = 1.05;
            }
            if (race == 108)
            {
                bonus = 1.05;
            }
            if (race == 114 && attackerStrength < defenderStrength)
            {
                bonus = 1.15;
            }
            if (race == 118)
            {
                bonus = 0.95;
            }
            if (race == 115 && usingAttackBoost)
            {
                bonus = 1.1;
            }
            if (race == 120)
            {
                if (strength <= 5)
                {
                    bonus = 1.15;
                }
                else
                {
                    int max = map.GetRegionCount() / 2;
                    if (strength >= max)
                    {
                        bonus = 1;
                    }
                    else
                    {
                        bonus = 1 + 0.15 - 0.15 * (strength - 5.0) / (max - 5.0);
                    }
                }
            }
            if (race == 122)
            {
                bonus = hasDefenseBoost ? 1.2 : 1.0;
            }

            Console.WriteLine("attack bonus: " + bonus);

            if (bonus == 1)
            {
                return(defaultAttack);
            }

            return(bonus > 1.0 ? (int)Math.Floor(defaultAttack * bonus) : (int)Math.Ceiling(defaultAttack * bonus));
        }