diff --git a/src/services/combat/CombatService.java b/src/services/combat/CombatService.java index 02e5be6f..87a9f7a8 100644 --- a/src/services/combat/CombatService.java +++ b/src/services/combat/CombatService.java @@ -306,6 +306,9 @@ public class CombatService implements INetworkDispatch { if(actionCost == 0 && healthCost == 0) return true; + if(attacker.getSkillMod("expertise_action_all") != null) + actionCost *= attacker.getSkillMod("expertise_action_all").getBase(); + float newAction = attacker.getAction() - actionCost; if(newAction <= 0) return false; @@ -544,6 +547,95 @@ public class CombatService implements INetworkDispatch { } + public boolean attemptHeal(CreatureObject healer, CreatureObject target) { + + if(healer == target) + return true; + + if(healer.getFaction().equals(target.getFaction())) { + + if(healer.getFactionStatus() < target.getFactionStatus()) + return false; + + return true; + + } else { + + if(target.getFactionStatus() == 0) + return true; + + return false; + + } + + } + + public void doHeal(CreatureObject healer, CreatureObject target, WeaponObject weapon, CombatCommand command, int actionCounter) { + + if(!applySpecialCost(healer, weapon, command)) + return; + + if((command.getAttackType() == 0 || command.getAttackType() == 1 || command.getAttackType() == 3) && !attemptHeal(healer, target)) + return; + + if(command.getAttackType() == 1) + doSingleTargetHeal(healer, target, weapon, command, actionCounter); + else if(command.getAttackType() == 0 || command.getAttackType() == 2 || command.getAttackType() == 3) + doAreaHeal(healer, target, weapon, command, actionCounter); + + } + + private void doSingleTargetHeal(CreatureObject healer, CreatureObject target, WeaponObject weapon, CombatCommand command, int actionCounter) { + + int healAmount = command.getAddedDamage(); + + if(healer.getSkillMod("expertise_healing_all") != null) { + int healPotency = healer.getSkillMod("expertise_healing_all").getBase(); + if(healer.getSkillMod("expertise_healing_line_me_heal") != null) + healPotency += healer.getSkillMod("expertise_healing_line_me_heal").getBase(); + if(healer.getSkillMod("expertise_healing_line_of_heal") != null) + healPotency += healer.getSkillMod("expertise_healing_line_of_heal").getBase(); + if(healer.getSkillMod("expertise_healing_line_sm_heal") != null) + healPotency += healer.getSkillMod("expertise_healing_line_sm_heal").getBase(); + if(healer.getSkillMod("expertise_healing_line_sp_heal") != null) + healPotency += healer.getSkillMod("expertise_healing_line_sp_heal").getBase(); + healAmount += (healAmount * (healPotency / 100)); + } + + target.setHealth(target.getHealth() + healAmount); + + if(FileUtilities.doesFileExist("scripts/commands/combat" + command.getCommandName() + ".py")) + core.scriptService.callScript("scripts/commands/combat", command.getCommandName(), "run", core, healer, target, null); + + } + + private void doAreaHeal(CreatureObject healer, CreatureObject target, WeaponObject weapon, CombatCommand command, int actionCounter) { + + float range = command.getConeLength(); + + List inRangeObjects = core.simulationService.get(healer.getPlanet(), target.getWorldPosition().x, target.getWorldPosition().z, (int) range); + + for(SWGObject obj : inRangeObjects) { + + if(!(obj instanceof CreatureObject)) + continue; + + if(obj instanceof CreatureObject && (((CreatureObject) obj).getPosture() == 14)) + continue; + + if(!core.simulationService.checkLineOfSight(target, obj)) + continue; + + if(!attemptHeal(healer, (CreatureObject) obj)) + continue; + + doSingleTargetHeal(healer, (CreatureObject) obj, weapon, command, actionCounter); + + } + + + } + public enum HitType{; diff --git a/src/services/command/CommandService.java b/src/services/command/CommandService.java index 8a1b6f7a..413ca1bf 100644 --- a/src/services/command/CommandService.java +++ b/src/services/command/CommandService.java @@ -142,7 +142,10 @@ public class CommandService implements INetworkDispatch { boolean success = true; - if(!(command.getAttackType() == 0) && !(command.getAttackType() == 2) && !(command.getAttackType() == 3)) { + if((command.getHitType() == 5 || command.getHitType() == 7) && !(target instanceof CreatureObject)) + success = false; + + if(!(command.getAttackType() == 2) && !(command.getHitType() == 5)) { if(target == null || !(target instanceof TangibleObject) || target == attacker) success = false; } else { @@ -153,11 +156,15 @@ public class CommandService implements INetworkDispatch { } if(attacker.getPosture() == 13 || attacker.getPosture() == 14) - success = false; + success = false; if(target instanceof CreatureObject) { - if(((CreatureObject) target).getPosture() == 13 || ((CreatureObject) target).getPosture() == 14) - success = false; + if(!(command.getHitType() == 5)) + if(((CreatureObject) target).getPosture() == 13) + success = false; + if(!(command.getHitType() == 7)) + if(((CreatureObject) target).getPosture() == 14) + success = false; } WeaponObject weapon; @@ -200,6 +207,12 @@ public class CommandService implements INetworkDispatch { ObjControllerMessage objController = new ObjControllerMessage(0x0B, commandRemove); attacker.getClient().getSession().write(objController.serialize()); } else { + + if(command.getHitType() == 5) { + core.combatService.doHeal(attacker, (CreatureObject) target, weapon, command, actionCounter); + return; + } + core.combatService.doCombat(attacker, (TangibleObject) target, weapon, command, actionCounter); }