Temporary fix for some of our combat checks not being called properly. A

better fix will be coming soon.
This commit is contained in:
GJ 2013-01-24 23:03:00 -05:00
parent ba7ebe1319
commit 06cf0ff2c2

View File

@ -56,9 +56,9 @@ public class Combat {
boolean targetIsPlayer = (target.getType() == EntityType.PLAYER); boolean targetIsPlayer = (target.getType() == EntityType.PLAYER);
boolean targetIsTamedPet = (target instanceof Tameable) ? ((Tameable) target).isTamed() : false; boolean targetIsTamedPet = (target instanceof Tameable) ? ((Tameable) target).isTamed() : false;
switch (damager.getType()) { switch (event.getDamager().getType()) {
case PLAYER: case PLAYER:
Player attacker = (Player) damager; Player attacker = (Player) event.getDamager();
if (Misc.isNPCPlayer(attacker)) { if (Misc.isNPCPlayer(attacker)) {
return; return;
@ -133,7 +133,7 @@ public class Combat {
break; break;
case WOLF: case WOLF:
Wolf wolf = (Wolf) damager; Wolf wolf = (Wolf) event.getDamager();
if (wolf.isTamed() && wolf.getOwner() instanceof Player) { if (wolf.isTamed() && wolf.getOwner() instanceof Player) {
Player master = (Player) wolf.getOwner(); Player master = (Player) wolf.getOwner();
@ -158,7 +158,7 @@ public class Combat {
break; break;
case ARROW: case ARROW:
LivingEntity shooter = ((Arrow) damager).getShooter(); LivingEntity shooter = ((Arrow) event.getDamager()).getShooter();
//TODO: Is there a reason we're breaking here instead of returning? //TODO: Is there a reason we're breaking here instead of returning?
if (shooter == null || shooter.getType() != EntityType.PLAYER) { if (shooter == null || shooter.getType() != EntityType.PLAYER) {
@ -184,10 +184,10 @@ public class Combat {
if (targetIsPlayer) { if (targetIsPlayer) {
Player player = (Player) target; Player player = (Player) target;
if (damager instanceof Player) { if (event.getDamager() instanceof Player) {
if (Swords.pvpEnabled) { if (Swords.pvpEnabled) {
SwordsManager swordsManager = new SwordsManager(player); SwordsManager swordsManager = new SwordsManager(player);
swordsManager.counterAttackChecks((LivingEntity) damager, event.getDamage()); swordsManager.counterAttackChecks((LivingEntity) event.getDamager(), event.getDamage());
} }
if (Acrobatics.pvpEnabled) { if (Acrobatics.pvpEnabled) {
@ -201,13 +201,13 @@ public class Combat {
} }
} }
else { else {
if (Swords.pveEnabled && damager instanceof LivingEntity) { if (Swords.pveEnabled && event.getDamager() instanceof LivingEntity) {
SwordsManager swordsManager = new SwordsManager(player); SwordsManager swordsManager = new SwordsManager(player);
swordsManager.counterAttackChecks((LivingEntity) damager, event.getDamage()); swordsManager.counterAttackChecks((LivingEntity) event.getDamager(), event.getDamage());
} }
if (Acrobatics.pveEnabled) { if (Acrobatics.pveEnabled) {
if (!(damager instanceof LightningStrike && Acrobatics.dodgeLightningDisabled)) { if (!(event.getDamager() instanceof LightningStrike && Acrobatics.dodgeLightningDisabled)) {
AcrobaticsManager acrobaticsManager = new AcrobaticsManager(player); AcrobaticsManager acrobaticsManager = new AcrobaticsManager(player);
acrobaticsManager.dodgeCheck(event); acrobaticsManager.dodgeCheck(event);
} }