From ddbc6b03af51e698d9569190bd748ba172b5dccd Mon Sep 17 00:00:00 2001 From: Mads Boddum Date: Fri, 23 Feb 2018 00:15:42 +0100 Subject: [PATCH 1/2] Prevent location AoE from throwing exceptions --- .../holocore/services/combat/CombatManager.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/projectswg/holocore/services/combat/CombatManager.java b/src/main/java/com/projectswg/holocore/services/combat/CombatManager.java index af4534146..1c3934ab8 100644 --- a/src/main/java/com/projectswg/holocore/services/combat/CombatManager.java +++ b/src/main/java/com/projectswg/holocore/services/combat/CombatManager.java @@ -169,7 +169,7 @@ public class CombatManager extends Manager { // TODO implement support for remaining HitTypes switch (c.getHitType()) { case ATTACK: - handleAttack(source, target, null, c); + handleAttack(source, target, null, c, cci.getArguments()); break; case BUFF: handleBuff(source, target, c); @@ -188,7 +188,7 @@ public class CombatManager extends Manager { combat.updateLastCombat(); } - private void handleAttack(CreatureObject source, SWGObject target, SWGObject delayEgg, CombatCommand command) { + private void handleAttack(CreatureObject source, SWGObject target, SWGObject delayEgg, CombatCommand command, String[] arguments) { if (!handleStatus(source, canPerform(source, target, command))) return; @@ -205,8 +205,14 @@ public class CombatManager extends Manager { doCombatArea(source, source, info, weapon, command, false); break; case TARGET_AREA: - doCombatArea(source, delayEgg != null ? delayEgg : target, info, weapon, command, true); - break; // Same as AREA, but the target is the destination for the AoE and can take damage + if (target != null) { + // Same as AREA, but the target is the destination for the AoE and can take damage + doCombatArea(source, delayEgg != null ? delayEgg : target, info, weapon, command, true); + } else { + // TODO AoE based on Location instead of delay egg + } + + break; default: break; } @@ -271,7 +277,7 @@ public class CombatManager extends Manager { delayEgg.sendObservers(new PlayClientEffectObjectMessage(delayAttackParticle, "", delayEgg.getObjectId(), "")); // Handle the attack of this loop - handleAttack(source, target, delayEgg, combatCommand); + handleAttack(source, target, delayEgg, combatCommand, null); if (currentLoop < combatCommand.getDelayAttackLoops()) { // Recursively schedule another loop if that wouldn't exceed the amount of loops we need to perform From 2aec0af6d4b6aece1ee19e23c0817e37738ad184 Mon Sep 17 00:00:00 2001 From: Mads Boddum Date: Fri, 23 Feb 2018 00:17:49 +0100 Subject: [PATCH 2/2] Removed debug code from CombatManager --- .../projectswg/holocore/services/combat/CombatManager.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/projectswg/holocore/services/combat/CombatManager.java b/src/main/java/com/projectswg/holocore/services/combat/CombatManager.java index 24646621b..5c41a9879 100644 --- a/src/main/java/com/projectswg/holocore/services/combat/CombatManager.java +++ b/src/main/java/com/projectswg/holocore/services/combat/CombatManager.java @@ -169,7 +169,7 @@ public class CombatManager extends Manager { // TODO implement support for remaining HitTypes switch (c.getHitType()) { case ATTACK: - handleAttack(source, target, null, c, cci.getArguments()); + handleAttack(source, target, null, c); break; case BUFF: handleBuff(source, target, c); @@ -188,7 +188,7 @@ public class CombatManager extends Manager { combat.updateLastCombat(); } - private void handleAttack(CreatureObject source, SWGObject target, SWGObject delayEgg, CombatCommand command, String[] arguments) { + private void handleAttack(CreatureObject source, SWGObject target, SWGObject delayEgg, CombatCommand command) { if (!handleStatus(source, canPerform(source, target, command))) return; @@ -277,7 +277,7 @@ public class CombatManager extends Manager { delayEgg.sendObservers(new PlayClientEffectObjectMessage(delayAttackParticle, "", delayEgg.getObjectId(), "")); // Handle the attack of this loop - handleAttack(source, target, delayEgg, combatCommand, null); + handleAttack(source, target, delayEgg, combatCommand); if (currentLoop < combatCommand.getDelayAttackLoops()) { // Recursively schedule another loop if that wouldn't exceed the amount of loops we need to perform