Fix bug where mcMMO damage wasn't awarding XP.

Fixes #1400
This commit is contained in:
GJ 2013-09-09 12:00:37 -04:00
parent 14daee3b1b
commit 71ab678945
5 changed files with 18 additions and 14 deletions

View File

@ -90,7 +90,7 @@ public class ArcheryManager extends SkillManager {
getPlayer().sendMessage(LocaleLoader.getString("Combat.TargetDazed"));
}
CombatUtils.dealDamage(defender, Archery.dazeModifier, DamageCause.PROJECTILE, arrow);
CombatUtils.dealDamage(defender, Archery.dazeModifier, DamageCause.PROJECTILE, arrow, mcMMOPlayer, SkillType.ARCHERY);
}
/**
@ -104,6 +104,6 @@ public class ArcheryManager extends SkillManager {
double damageBonusPercent = Math.min(((getSkillLevel() / Archery.skillShotIncreaseLevel) * Archery.skillShotIncreasePercentage), Archery.skillShotMaxBonusPercentage);
double archeryBonus = damage * damageBonusPercent;
CombatUtils.dealDamage(target, archeryBonus, DamageCause.PROJECTILE, arrow);
CombatUtils.dealDamage(target, archeryBonus, DamageCause.PROJECTILE, arrow, mcMMOPlayer, SkillType.ARCHERY);
}
}

View File

@ -57,7 +57,7 @@ public class AxesManager extends SkillManager {
public void axeMastery(LivingEntity target) {
double axeBonus = Math.min(getSkillLevel() / (Axes.bonusDamageMaxBonusLevel / Axes.bonusDamageMaxBonus), Axes.bonusDamageMaxBonus);
CombatUtils.dealDamage(target, axeBonus, getPlayer());
CombatUtils.dealDamage(target, axeBonus, getPlayer(), mcMMOPlayer, SkillType.AXES);
}
/**
@ -84,7 +84,7 @@ public class AxesManager extends SkillManager {
damage = (damage * Axes.criticalHitPVEModifier) - damage;
}
CombatUtils.dealDamage(target, damage, player);
CombatUtils.dealDamage(target, damage, player, mcMMOPlayer, SkillType.AXES);
}
/**
@ -134,7 +134,7 @@ public class AxesManager extends SkillManager {
}
}
CombatUtils.dealDamage(target, Axes.greaterImpactBonusDamage, player);
CombatUtils.dealDamage(target, Axes.greaterImpactBonusDamage, player, mcMMOPlayer, SkillType.AXES);
}
/**

View File

@ -123,11 +123,11 @@ public class TamingManager extends SkillManager {
getPlayer().sendMessage(LocaleLoader.getString("Combat.Gore"));
damage = (damage * Taming.goreModifier) - damage;
CombatUtils.dealDamage(target, damage, wolf);
CombatUtils.dealDamage(target, damage, wolf, mcMMOPlayer, SkillType.TAMING);
}
public void sharpenedClaws(LivingEntity target, Wolf wolf) {
CombatUtils.dealDamage(target, Taming.sharpenedClawsBonusDamage, wolf);
CombatUtils.dealDamage(target, Taming.sharpenedClawsBonusDamage, wolf, mcMMOPlayer, SkillType.TAMING);
}
/**

View File

@ -116,7 +116,7 @@ public class UnarmedManager extends SkillManager {
public void berserkDamage(LivingEntity target, double damage) {
damage = (damage * Unarmed.berserkDamageModifier) - damage;
CombatUtils.dealDamage(target, damage, getPlayer());
CombatUtils.dealDamage(target, damage, getPlayer(), mcMMOPlayer, SkillType.UNARMED);
}
/**
@ -127,7 +127,7 @@ public class UnarmedManager extends SkillManager {
public void ironArm(LivingEntity target) {
int unarmedBonus = Math.min(Unarmed.ironArmMinBonusDamage + (getSkillLevel() / Unarmed.ironArmIncreaseLevel), Unarmed.ironArmMaxBonusDamage);
CombatUtils.dealDamage(target, unarmedBonus, getPlayer());
CombatUtils.dealDamage(target, unarmedBonus, getPlayer(), mcMMOPlayer, SkillType.UNARMED);
}
/**

View File

@ -348,7 +348,7 @@ public final class CombatUtils {
* @param damage Amount of damage to attempt to do
*/
public static void dealDamage(LivingEntity target, double damage) {
dealDamage(target, damage, DamageCause.CUSTOM, null);
dealDamage(target, damage, DamageCause.CUSTOM, null, null, null);
}
/**
@ -358,8 +358,8 @@ public final class CombatUtils {
* @param damage Amount of damage to attempt to do
* @param attacker Player to pass to event as damager
*/
public static void dealDamage(LivingEntity target, double damage, LivingEntity attacker) {
dealDamage(target, damage, DamageCause.ENTITY_ATTACK, attacker);
public static void dealDamage(LivingEntity target, double damage, LivingEntity attacker, McMMOPlayer mcMMOPlayer, SkillType skill) {
dealDamage(target, damage, DamageCause.ENTITY_ATTACK, attacker, mcMMOPlayer, skill);
}
/**
@ -369,7 +369,7 @@ public final class CombatUtils {
* @param damage Amount of damage to attempt to do
* @param attacker Player to pass to event as damager
*/
public static void dealDamage(LivingEntity target, double damage, DamageCause cause, Entity attacker) {
public static void dealDamage(LivingEntity target, double damage, DamageCause cause, Entity attacker, McMMOPlayer mcMMOPlayer, SkillType skill) {
if (target.isDead()) {
return;
}
@ -385,6 +385,10 @@ public final class CombatUtils {
damage = damageEvent.getDamage();
}
if (mcMMOPlayer != null) {
startGainXp(mcMMOPlayer, target, skill);
}
target.damage(damage);
}
@ -432,7 +436,7 @@ public final class CombatUtils {
break;
}
dealDamage(livingEntity, damageAmount, attacker);
dealDamage(livingEntity, damageAmount, attacker, UserManager.getPlayer(attacker), type);
numberOfTargets--;
}
}