public static void addDamage(Entity killer, Entity target, int damage) { if (!target.isDead()) { target.addToHitCount(killer, damage); } }
protected static void addMagicXp(Player p, Entity target, double hit, int index, bool baseXp) { if (target is Npc) { double xp = 0; switch (index) { case 0: xp = 5.5; break; // Wind strike. case 1: xp = 7.5; break;// Water strike case 2: xp = 9.5; break;// Earth strike. case 3: xp = 11.5; break;// Fire strike. case 4: xp = 13.5; break;// Wind bolt. case 5: xp = 16.5; break;// Water bolt. case 6: xp = 19.5; break;// Earth bolt. case 7: xp = 21.5; break;// Fire bolt. case 8: xp = 25.5; break;// Wind blast. case 9: xp = 28.5; break;// Water blast. case 10: xp = 31.5; break;// Earth blast. case 11: xp = 34.5; break;// Fire blast. case 12: xp = 36.0; break;// Wind wave. case 13: xp = 37.5; break;// Water wave. case 14: xp = 40.0; break;// Earth wave. case 15: xp = 42.5; break;// Fire wave. case 32: xp = 24.5; break;// Crumble undead. case 33: xp = 30.0; break;// Slayer dart. case 34: xp = 30.0; break;// Bind. case 35: xp = 30.0; break;// Iban blast. case 36: xp = 60.0; break;// Snare. case 37: xp = 61.0; break;// Saradomin strike. case 38: xp = 61.0; break;// Claws of Guthix. case 39: xp = 61.0; break;// Flames of Zamorak. case 40: xp = 89.0; break;// Entangle. case 41: xp = 13.0; break;// Confuse. case 42: xp = 21.0; break;// Weaken. case 43: xp = 29.0; break;// Curse. case 44: xp = 83.0; break;// Enfeeble. case 45: xp = 90.0; break;// Stun. case 46: xp = 76.0; break;// Vulnerability. case 47: xp = 80.0; break;// Teleblock. case 16: xp = 30.0; break;// Smoke rush. case 17: xp = 31.0; break;// Shadow rush. case 18: xp = 33.0; break;// Blood rush. case 19: xp = 34.0; break;// Ice rush. case 20: xp = 36.0; break;// Smoke burst. case 21: xp = 37.0; break;// Shadow burst. case 22: xp = 39.0; break;// Blood burst. case 23: xp = 40.0; break;// Ice burst. case 24: xp = 42.0; break;// Smoke blitz. case 25: xp = 43.0; break;// Shadow blitz. case 26: xp = 45.0; break;// Blood blitz. case 27: xp = 46.0; break;// Ice blitz. case 28: xp = 48.0; break;// Smoke barrage. case 29: xp = 48.0; break;// Shadow barrage. case 30: xp = 51.0; break;// Blood barrage. case 31: xp = 52.0; break;// Ice barrage. case 48: xp = 36.0; break;// Miasmic rush. case 49: xp = 42.0; break;// Miasmic burst. case 50: xp = 48.0; break;// Miasmic blitz. case 51: xp = 54.0; break;// Miasmic barrage. } double finalXp = baseXp ? (xp + (hit * 2)) : (hit * 2); p.getSkills().addXp(Skills.SKILL.MAGIC, finalXp); p.getSkills().addXp(Skills.SKILL.HITPOINTS, hit * 1.33); target.addToHitCount(p, hit); } else if (target != null) { target.addToHitCount(p, hit); } }
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); }