public static double getRangeDefence(Player p)
        {
            int    rangedDefenceBonus = p.getEquipment().getBonus(Equipment.BONUS.RANGED_DEFENCE);
            double defenceLevel       = p.getSkills().getCurLevel(Skills.SKILL.DEFENCE);

            AttackStyle.CombatSkill fightType = p.getAttackStyle().getSkill();
            if (fightType.Equals(AttackStyle.CombatSkill.DEFENSIVE))
            {
                defenceLevel *= 1.10; //%10 increase.
            }
            if (p.getPrayers().isPrayerActive(PrayerData.Prayer.THICK_SKIN))
            {
                defenceLevel *= 1.05; //5% increase.
            }
            else if (p.getPrayers().isPrayerActive(PrayerData.Prayer.ROCK_SKIN))
            {
                defenceLevel *= 1.10; //10% increase.
            }
            else if (p.getPrayers().isPrayerActive(PrayerData.Prayer.STEEL_SKIN))
            {
                defenceLevel *= 1.15; //15% increase.
            }
            else if (p.getPrayers().isPrayerActive(PrayerData.Prayer.SMITE))
            {
                defenceLevel *= 1.20; //20% increase.
            }
            else if (p.getPrayers().isPrayerActive(PrayerData.Prayer.CHIVALRY))
            {
                defenceLevel *= 1.25; //25% increase.
            }
            double rangeDefence = (defenceLevel * rangedDefenceBonus) / 200;

            return(rangeDefence);
        }
示例#2
0
        public static double getPlayerMaxHit(Player player, int strBonusIncrease)
        {
            AttackStyle.CombatSkill fightType = player.getAttackStyle().getSkill();
            double myCurStrength        = (double)player.getSkills().getCurLevel(Skills.SKILL.STRENGTH);
            double myEquipStrengthBonus = (double)(player.getEquipment().getBonus(Equipment.BONUS.STRENGTH) + strBonusIncrease);
            double fightingStyle        = 0;
            double powerMultiplier      = 1;
            double dharokModifier       = 1;
            double damageMultiplier     = 1;
            int    strPrayer            = player.getPrayers().getStrengthPrayer();

            if (strPrayer == 1)
            {
                powerMultiplier += 0.05;
            }
            else if (strPrayer == 2)
            {
                powerMultiplier += 0.1;
            }
            else if (strPrayer == 3)
            {
                powerMultiplier += 0.15;
            }
            else if (player.getPrayers().getSuperPrayer() == 1)
            {
                powerMultiplier += 0.18;
            }
            else if (player.getPrayers().getSuperPrayer() == 2)
            {
                powerMultiplier += 0.23;
            }

            if (wearingMeleeVoid(player))
            {
                damageMultiplier += 0.1;
            }
            else if (wearingDharok(player) && misc.random(3) == 0)
            {
                dharokModifier = misc.random((int)((player.getSkills().getGreaterLevel(Skills.SKILL.HITPOINTS) - player.getSkills().getCurLevel(Skills.SKILL.HITPOINTS)) * 0.1));
            }
            if (fightType.Equals(AttackStyle.CombatSkill.AGGRESSIVE))
            {
                fightingStyle = 3;
            }
            else if (fightType.Equals(AttackStyle.CombatSkill.CONTROLLED))
            {
                fightingStyle = 1;
            }

            double cumulativeStrength = ((myCurStrength) * (powerMultiplier) + fightingStyle) * dharokModifier;
            double maxHit             = ((13 + (cumulativeStrength) + (myEquipStrengthBonus / 8) + ((cumulativeStrength * myEquipStrengthBonus) / 64)) * damageMultiplier); // NEW MAX HIT FORMULA

            maxHit = maxHit / 10;                                                                                                                                           //this is temporary because I haven't yet fully implemented the huge damage system.
            return(maxHit);
        }
        public static double getPlayerMaxHit(Player player, int strBonusIncrease)
        {
            AttackStyle.CombatSkill fightType = player.getAttackStyle().getSkill();
            double myCurStrength        = player.getSkills().getCurLevel(Skills.SKILL.STRENGTH);
            double myEquipStrengthBonus = (player.getEquipment().getBonus(Equipment.BONUS.STRENGTH) + strBonusIncrease);
            double fightingStyle        = 0;
            double powerMultiplier      = 1;
            double dharokModifier       = 1;
            double damageMultiplier     = 1;
            int    strPrayer            = player.getPrayers().getStrengthPrayer();

            if (strPrayer == 1)
            {
                powerMultiplier += 0.05;
            }
            else if (strPrayer == 2)
            {
                powerMultiplier += 0.1;
            }
            else if (strPrayer == 3)
            {
                powerMultiplier += 0.15;
            }
            else if (player.getPrayers().getSuperPrayer() == 1)
            {
                powerMultiplier += 0.18;
            }
            else if (player.getPrayers().getSuperPrayer() == 2)
            {
                powerMultiplier += 0.23;
            }

            if (wearingMeleeVoid(player))
            {
                damageMultiplier += 0.1;
            }
            else if (wearingDharok(player))
            {
                dharokModifier = (player.getSkills().getGreaterLevel(Skills.SKILL.HITPOINTS) - player.getSkills().getCurLevel(Skills.SKILL.HITPOINTS)) * 0.1;
            }
            if (fightType.Equals(AttackStyle.CombatSkill.AGGRESSIVE))
            {
                fightingStyle = 3;
            }
            else if (fightType.Equals(AttackStyle.CombatSkill.CONTROLLED))
            {
                fightingStyle = 1;
            }

            double cumulativeStrength = ((myCurStrength) * (powerMultiplier) + fightingStyle) * dharokModifier;
            //Can't change this. For huge damage it's a visual effect, not real maxHit!
            double maxHit = ((13 + (cumulativeStrength) + (myEquipStrengthBonus / 8) + ((cumulativeStrength * myEquipStrengthBonus) / 64)) * damageMultiplier) / 10; // NEW MAX HIT FORMULA

            return(maxHit);
        }
示例#4
0
        public static void addXp(Entity killer, Entity target, double damage)
        {
            int xpRate = 230;

            if ((killer is Player) && (target is Npc))
            {
                Player     p    = (Player)killer;
                CombatType type = p.getLastCombatType();
                AttackStyle.CombatSkill fightType  = p.getAttackStyle().getSkill();
                AttackStyle.CombatStyle fightStyle = p.getAttackStyle().getStyle();
                if (type == CombatType.MELEE)
                {
                    if (!fightType.Equals(AttackStyle.CombatSkill.CONTROLLED))
                    {
                        Skills.SKILL skill = Skills.SKILL.ATTACK;
                        if (fightType.Equals(AttackStyle.CombatSkill.ACCURATE))
                        {
                            skill = Skills.SKILL.ATTACK;
                        }
                        else if (fightType.Equals(AttackStyle.CombatSkill.DEFENSIVE))
                        {
                            skill = Skills.SKILL.DEFENCE;
                        }
                        else if (fightType.Equals(AttackStyle.CombatSkill.AGGRESSIVE))
                        {
                            skill = Skills.SKILL.STRENGTH;
                        }
                        p.getSkills().addXp(skill, (xpRate * damage));
                        p.getSkills().addXp(Skills.SKILL.HITPOINTS, (xpRate * 0.30));
                    }
                    else
                    {
                        p.getSkills().addXp(Skills.SKILL.ATTACK, ((xpRate * 0.30) * damage));
                        p.getSkills().addXp(Skills.SKILL.DEFENCE, ((xpRate * 0.30) * damage));
                        p.getSkills().addXp(Skills.SKILL.STRENGTH, ((xpRate * 0.30) * damage));
                        p.getSkills().addXp(Skills.SKILL.HITPOINTS, (0.25 * damage));
                    }
                }
                else
                {
                    if (fightStyle.Equals(AttackStyle.CombatStyle.RANGE_ACCURATE) || fightStyle.Equals(AttackStyle.CombatStyle.RANGE_RAPID))
                    {
                        p.getSkills().addXp(Skills.SKILL.RANGE, (xpRate * damage));
                    }
                    else if (fightStyle.Equals(AttackStyle.CombatStyle.RANGE_DEFENSIVE))
                    {
                        p.getSkills().addXp(Skills.SKILL.RANGE, ((xpRate * 0.50) * damage));
                        p.getSkills().addXp(Skills.SKILL.DEFENCE, ((xpRate * 0.50) * damage));
                    }
                    p.getSkills().addXp(Skills.SKILL.HITPOINTS, ((xpRate * 0.30) * damage));
                }
            }
            target.addToHitCount(killer, damage);
        }
示例#5
0
        public static void setButtonForAttackStyle(Player p, int interfaceId)
        {
            if (interfaceId == -1)
            {
                return;
            }
            AttackStyle av = p.getAttackStyle();

            AttackStyle.CombatSkill type  = av.getSkill();
            AttackStyle.CombatStyle type2 = av.getStyle();
            int slot = av.getSlot();

            switch (interfaceId)
            {
            case 92:     // Unarmed
                if (type.Equals(AttackStyle.CombatSkill.ACCURATE) || slot == 0)
                {
                    p.getPackets().sendConfig(43, 0);
                }
                else if (type.Equals(AttackStyle.CombatSkill.AGGRESSIVE) || slot == 1)
                {
                    p.getPackets().sendConfig(43, 1);
                }
                else if (type.Equals(AttackStyle.CombatSkill.DEFENSIVE) || slot == 2 || slot == 3)
                {
                    p.getPackets().sendConfig(43, 2);
                    av.setSlot(2);
                }
                break;

            case 93:     // Whip attack interface.
                if (type.Equals(AttackStyle.CombatSkill.ACCURATE) || slot == 0)
                {
                    p.getPackets().sendConfig(43, 0);
                }
                else if (type.Equals(AttackStyle.CombatSkill.CONTROLLED) || slot == 1)
                {
                    p.getPackets().sendConfig(43, 1);
                }
                else if (type.Equals(AttackStyle.CombatSkill.DEFENSIVE) || slot == 2 || slot == 3)
                {
                    p.getPackets().sendConfig(43, 2);
                    av.setSlot(2);
                }
                break;

            case 89:     // Dagger attack interface.
                if (type.Equals(AttackStyle.CombatSkill.ACCURATE) || slot == 0)
                {
                    p.getPackets().sendConfig(43, 0);
                }
                else if ((type.Equals(AttackStyle.CombatSkill.AGGRESSIVE) && type2.Equals(AttackStyle.CombatStyle.STAB)) || slot == 1)
                {
                    p.getPackets().sendConfig(43, 1);
                }
                else if ((type.Equals(AttackStyle.CombatSkill.AGGRESSIVE) && type2.Equals(AttackStyle.CombatStyle.SLASH)))
                {
                    p.getPackets().sendConfig(43, 2);
                }
                else if (type.Equals(AttackStyle.CombatSkill.DEFENSIVE) || slot == 2 || slot == 3)
                {
                    p.getPackets().sendConfig(43, 3);
                    av.setSlot(3);
                }
                break;

            case 82:     // Longsword/scimitar attack interface.
                if (type.Equals(AttackStyle.CombatSkill.ACCURATE) || slot == 0)
                {
                    p.getPackets().sendConfig(43, 0);
                }
                else if (type.Equals(AttackStyle.CombatSkill.AGGRESSIVE) && type2.Equals(AttackStyle.CombatStyle.SLASH) || slot == 1)
                {
                    p.getPackets().sendConfig(43, 1);
                }
                else if (type.Equals(AttackStyle.CombatSkill.AGGRESSIVE) && type2.Equals(AttackStyle.CombatStyle.CRUSH))
                {
                    p.getPackets().sendConfig(43, 2);
                }
                else if (type.Equals(AttackStyle.CombatSkill.DEFENSIVE) || slot == 2 || slot == 3)
                {
                    p.getPackets().sendConfig(43, 3);
                    av.setSlot(3);
                }
                break;

            case 78:     // Claw attack interface.
                if (type.Equals(AttackStyle.CombatSkill.ACCURATE) || slot == 0)
                {
                    p.getPackets().sendConfig(43, 0);
                }
                else if (type.Equals(AttackStyle.CombatSkill.AGGRESSIVE) || slot == 1)
                {
                    p.getPackets().sendConfig(43, 1);
                }
                else if (type.Equals(AttackStyle.CombatSkill.CONTROLLED))
                {
                    p.getPackets().sendConfig(43, 2);
                }
                else if (type.Equals(AttackStyle.CombatSkill.DEFENSIVE) || slot == 2 || slot == 3)
                {
                    p.getPackets().sendConfig(43, 3);
                    av.setSlot(3);
                }
                break;

            case 81:     // Godsword attack interface.
                if (type.Equals(AttackStyle.CombatSkill.ACCURATE) || slot == 0)
                {
                    p.getPackets().sendConfig(43, 0);
                }
                else if (type.Equals(AttackStyle.CombatSkill.AGGRESSIVE) || slot == 1)
                {
                    p.getPackets().sendConfig(43, 1);
                }
                else if (type.Equals(AttackStyle.CombatSkill.CONTROLLED))
                {
                    p.getPackets().sendConfig(43, 2);
                }
                else if (type.Equals(AttackStyle.CombatSkill.DEFENSIVE) || slot == 2 || slot == 3)
                {
                    p.getPackets().sendConfig(43, 3);
                    av.setSlot(3);
                }
                break;

            case 88:     // Mace attack interface.
                if (type.Equals(AttackStyle.CombatSkill.ACCURATE) || slot == 0)
                {
                    p.getPackets().sendConfig(43, 0);
                }
                else if (type.Equals(AttackStyle.CombatSkill.AGGRESSIVE) || slot == 1)
                {
                    p.getPackets().sendConfig(43, 1);
                }
                else if (type.Equals(AttackStyle.CombatSkill.CONTROLLED))
                {
                    p.getPackets().sendConfig(43, 2);
                }
                else if (type.Equals(AttackStyle.CombatSkill.DEFENSIVE) || slot == 2 || slot == 3)
                {
                    p.getPackets().sendConfig(43, 3);
                    av.setSlot(3);
                }
                break;

            case 76:     // Granite maul attack interface.
                if (type.Equals(AttackStyle.CombatSkill.ACCURATE) || slot == 0)
                {
                    p.getPackets().sendConfig(43, 0);
                }
                else if (type.Equals(AttackStyle.CombatSkill.AGGRESSIVE) || slot == 1)
                {
                    p.getPackets().sendConfig(43, 1);
                }
                else if (type.Equals(AttackStyle.CombatSkill.DEFENSIVE) || slot == 2 || slot == 3)
                {
                    p.getPackets().sendConfig(43, 2);
                    av.setSlot(2);
                }
                break;

            case 77:     // Bow attack interface.
                if (type2.Equals(AttackStyle.CombatStyle.RANGE_ACCURATE) || slot == 0)
                {
                    p.getPackets().sendConfig(43, 0);
                }
                else if (type2.Equals(AttackStyle.CombatStyle.RANGE_RAPID) || slot == 1)
                {
                    p.getPackets().sendConfig(43, 1);
                }
                else if (type2.Equals(AttackStyle.CombatStyle.RANGE_DEFENSIVE) || slot == 2 || slot == 3)
                {
                    p.getPackets().sendConfig(43, 2);
                    av.setSlot(2);
                }
                break;

            case 75:     // Battleaxe attack interface.
                if (type.Equals(AttackStyle.CombatSkill.ACCURATE) || slot == 0)
                {
                    p.getPackets().sendConfig(43, 0);
                }
                else if (type.Equals(AttackStyle.CombatSkill.AGGRESSIVE) && type2.Equals(AttackStyle.CombatStyle.SLASH) || slot == 1)
                {
                    p.getPackets().sendConfig(43, 1);
                }
                else if (type.Equals(AttackStyle.CombatSkill.AGGRESSIVE) && type2.Equals(AttackStyle.CombatStyle.CRUSH))
                {
                    p.getPackets().sendConfig(43, 2);
                }
                else if (type.Equals(AttackStyle.CombatSkill.DEFENSIVE) || slot == 2 || slot == 3)
                {
                    p.getPackets().sendConfig(43, 3);
                    av.setSlot(3);
                }
                break;

            case 91:     // Thrown weapon
                if (type2.Equals(AttackStyle.CombatStyle.RANGE_ACCURATE) || slot == 0)
                {
                    p.getPackets().sendConfig(43, 0);
                }
                else if (type2.Equals(AttackStyle.CombatStyle.RANGE_RAPID) || slot == 1)
                {
                    p.getPackets().sendConfig(43, 1);
                }
                else if (type2.Equals(AttackStyle.CombatStyle.RANGE_DEFENSIVE) || slot == 2 || slot == 3)
                {
                    p.getPackets().sendConfig(43, 2);
                    av.setSlot(2);
                }
                break;

            case 85:     // Spear
                if (type.Equals(AttackStyle.CombatSkill.ACCURATE) || slot == 0)
                {
                    p.getPackets().sendConfig(43, 0);
                }
                else if (type.Equals(AttackStyle.CombatSkill.AGGRESSIVE) || slot == 1)
                {
                    p.getPackets().sendConfig(43, 1);
                }
                else if (type.Equals(AttackStyle.CombatSkill.DEFENSIVE) || slot == 2 || slot == 3)
                {
                    p.getPackets().sendConfig(43, 2);
                    av.setSlot(2);
                }
                break;

            case 90:     // Staff interface
                if (type.Equals(AttackStyle.CombatSkill.ACCURATE) || slot == 0)
                {
                    p.getPackets().sendConfig(43, 0);
                }
                else if (type.Equals(AttackStyle.CombatSkill.AGGRESSIVE) || slot == 1)
                {
                    p.getPackets().sendConfig(43, 1);
                }
                else if (type.Equals(AttackStyle.CombatSkill.DEFENSIVE) || slot == 2 || slot == 3)
                {
                    p.getPackets().sendConfig(43, 2);
                    av.setSlot(2);
                }
                break;
            }
        }