From bb085477c4de5085cf5ff5f8e70f21a73b26117e Mon Sep 17 00:00:00 2001 From: Light2 Date: Mon, 25 Nov 2013 22:10:33 +0100 Subject: [PATCH] Added Heal Over Time buffs, finished most of commando except kill meter and some abilities --- scripts/buffs/armor_break.py | 10 ++ scripts/buffs/co_base_of_operations.py | 12 ++ scripts/buffs/co_position_secured.py | 55 +++++++++ scripts/buffs/co_stand_fast.py | 19 +++ scripts/commands/co_position_secured.py | 14 +++ scripts/commands/combat/co_armor_cracker.py | 9 ++ scripts/commands/combat/co_del_ae_cc_1_1.py | 15 +++ scripts/commands/combat/co_del_ae_cc_1_2.py | 15 +++ scripts/commands/combat/co_del_ae_cc_1_3.py | 15 +++ scripts/commands/combat/co_del_ae_cc_2_1.py | 15 +++ scripts/commands/combat/co_del_ae_cc_2_2.py | 15 +++ scripts/commands/combat/co_del_ae_dm_1.py | 15 +++ scripts/commands/combat/co_del_ae_dm_2.py | 15 +++ scripts/commands/combat/co_del_ae_dm_3.py | 15 +++ scripts/commands/combat/co_riddle_armor.py | 9 ++ scripts/commands/combat/co_stand_fast.py | 9 ++ .../skillMods/expertise_critical_niche_all.py | 4 +- .../expertise_innate_protection_all.py | 12 ++ .../objects/creature/CreatureObject.java | 24 ++-- src/services/GroupService.java | 13 +- src/services/PlayerService.java | 4 +- src/services/SkillModService.java | 13 +- src/services/SkillService.java | 24 +++- src/services/combat/CombatCommands.java | 11 +- src/services/combat/CombatService.java | 116 +++++++++++++++++- src/services/command/CommandService.java | 7 +- 26 files changed, 447 insertions(+), 38 deletions(-) create mode 100644 scripts/buffs/armor_break.py create mode 100644 scripts/buffs/co_base_of_operations.py create mode 100644 scripts/buffs/co_position_secured.py create mode 100644 scripts/buffs/co_stand_fast.py create mode 100644 scripts/commands/co_position_secured.py create mode 100644 scripts/commands/combat/co_armor_cracker.py create mode 100644 scripts/commands/combat/co_del_ae_cc_1_1.py create mode 100644 scripts/commands/combat/co_del_ae_cc_1_2.py create mode 100644 scripts/commands/combat/co_del_ae_cc_1_3.py create mode 100644 scripts/commands/combat/co_del_ae_cc_2_1.py create mode 100644 scripts/commands/combat/co_del_ae_cc_2_2.py create mode 100644 scripts/commands/combat/co_del_ae_dm_1.py create mode 100644 scripts/commands/combat/co_del_ae_dm_2.py create mode 100644 scripts/commands/combat/co_del_ae_dm_3.py create mode 100644 scripts/commands/combat/co_riddle_armor.py create mode 100644 scripts/commands/combat/co_stand_fast.py diff --git a/scripts/buffs/armor_break.py b/scripts/buffs/armor_break.py new file mode 100644 index 00000000..89b7585d --- /dev/null +++ b/scripts/buffs/armor_break.py @@ -0,0 +1,10 @@ +import sys + +def setup(core, actor, buff): + actor.addSkillMod('expertise_innate_reduction_all_player', 6 * buff.getStacks()) + return + +def removeBuff(core, actor, buff): + actor.deductSkillMod('expertise_innate_reduction_all_player', 6 * buff.getStacks()) + return + \ No newline at end of file diff --git a/scripts/buffs/co_base_of_operations.py b/scripts/buffs/co_base_of_operations.py new file mode 100644 index 00000000..894c389c --- /dev/null +++ b/scripts/buffs/co_base_of_operations.py @@ -0,0 +1,12 @@ +import sys + +def setup(core, actor, buff): + core.skillModService.addSkillMod(actor, 'expertise_innate_protection_all', 1000) + core.skillModService.addSkillMod(actor, 'expertise_critical_niche_all', 5) + return + +def removeBuff(core, actor, buff): + core.skillModService.deductSkillMod(actor, 'expertise_innate_protection_all', 1000) + core.skillModService.deductSkillMod(actor, 'expertise_critical_niche_all', 5) + return + \ No newline at end of file diff --git a/scripts/buffs/co_position_secured.py b/scripts/buffs/co_position_secured.py new file mode 100644 index 00000000..b81046bf --- /dev/null +++ b/scripts/buffs/co_position_secured.py @@ -0,0 +1,55 @@ +import sys + +def setup(core, actor, buff): + + actor.setSpeedMultiplierMod(0) + + core.skillModService.addSkillMod(actor, 'precision_modified', 200) + core.skillModService.addSkillMod(actor, 'strength_modified', 200) + + if actor.getSkillMod('expertise_action_line_co_imp_pos_sec'): + core.skillModService.addSkillMod(actor, 'expertise_action_all', actor.getSkillMod('expertise_action_line_co_imp_pos_sec').getBase()) + #if actor.getSkillMod('expertise_co_pos_secured_line_burst_fire_proc'): + if actor.getSkillMod('expertise_co_pos_secured_line_burst_fire_devastation_bonus'): + core.skillModService.addSkillMod(actor, 'expertise_devastation_bonus', actor.getSkillMod('expertise_co_pos_secured_line_burst_fire_devastation_bonus').getBase() * 10) + if actor.getSkillMod('expertise_co_pos_secured_line_critical'): + core.skillModService.addSkillMod(actor, 'display_only_critical', actor.getSkillMod('expertise_co_pos_secured_line_critical').getBase() * 100) + if actor.getSkillMod('expertise_co_pos_secured_line_protection'): + core.skillModService.addSkillMod(actor, 'display_only_expertise_critical_hit_reduction', actor.getSkillMod('expertise_co_pos_secured_line_protection').getBase() * 100) + + if actor.hasSkill('expertise_co_base_of_operations_1'): + if actor.getGroupId() != 0 and core.objectService.getObject(actor.getGroupId()): + group = core.objectService.getObject(actor.getGroupId()) + for member in group.getMemberList(): + core.buffService.addBuffToCreature(member, 'co_base_of_operations') + else: + core.buffService.addBuffToCreature(actor, 'co_base_of_operations') + + return + +def removeBuff(core, actor, buff): + + actor.setSpeedMultiplierMod(1) + + core.skillModService.deductSkillMod(actor, 'precision_modified', 200) + core.skillModService.deductSkillMod(actor, 'strength_modified', 200) + + if actor.getSkillMod('expertise_action_line_co_imp_pos_sec'): + core.skillModService.deductSkillMod(actor, 'expertise_action_all', actor.getSkillMod('expertise_action_line_co_imp_pos_sec').getBase()) + #if actor.getSkillMod('expertise_co_pos_secured_line_burst_fire_proc'): + if actor.getSkillMod('expertise_co_pos_secured_line_burst_fire_devastation_bonus'): + core.skillModService.deductSkillMod(actor, 'expertise_devastation_bonus', actor.getSkillMod('expertise_co_pos_secured_line_burst_fire_devastation_bonus').getBase() * 10) + if actor.getSkillMod('expertise_co_pos_secured_line_critical'): + core.skillModService.deductSkillMod(actor, 'display_only_critical', actor.getSkillMod('expertise_co_pos_secured_line_critical').getBase() * 100) + if actor.getSkillMod('expertise_co_pos_secured_line_protection'): + core.skillModService.deductSkillMod(actor, 'display_only_expertise_critical_hit_reduction', actor.getSkillMod('expertise_co_pos_secured_line_protection').getBase() * 100) + + if actor.hasSkill('expertise_co_base_of_operations_1'): + if actor.getGroupId() != 0 and core.objectService.getObject(actor.getGroupId()): + group = core.objectService.getObject(actor.getGroupId()) + for member in group.getMemberList(): + core.buffService.removeBuffToCreature(member, 'co_base_of_operations') + else: + core.buffService.removeBuffToCreature(actor, 'co_base_of_operations') + + return \ No newline at end of file diff --git a/scripts/buffs/co_stand_fast.py b/scripts/buffs/co_stand_fast.py new file mode 100644 index 00000000..17563ff9 --- /dev/null +++ b/scripts/buffs/co_stand_fast.py @@ -0,0 +1,19 @@ +import sys + +def setup(core, actor, buff): + if actor.getSkillMod('expertise_buff_duration_line_co_stand_fast'): + buff.setDuration(buff.getDuration() + actor.getSkillMod('expertise_buff_duration_line_co_stand_fast').getBase()) + + if actor.getSkillMod('expertise_damage_decrease_percentage'): + core.skillModService.addSkillMod(actor, 'damage_decrease_percentage', (60 + actor.getSkillMod('expertise_damage_decrease_percentage').getBase()) / 2) + else: + core.skillModService.addSkillMod(actor, 'damage_decrease_percentage', 60 / 2) + + return + +def removeBuff(core, actor, buff): + if actor.getSkillMod('expertise_damage_decrease_percentage'): + core.skillModService.deductSkillMod(actor, 'damage_decrease_percentage', (60 + actor.getSkillMod('expertise_damage_decrease_percentage').getBase()) / 2) + else: + core.skillModService.deductSkillMod(actor, 'damage_decrease_percentage', 60 / 2) + return \ No newline at end of file diff --git a/scripts/commands/co_position_secured.py b/scripts/commands/co_position_secured.py new file mode 100644 index 00000000..41be0614 --- /dev/null +++ b/scripts/commands/co_position_secured.py @@ -0,0 +1,14 @@ +import sys + +def setup(): + return + +def run(core, actor, target, commandString): + + if actor.hasBuff('co_position_secured'): + core.buffService.removeBuffFromCreature(actor, actor.getBuff('co_position_secured')) + else: + core.buffService.addBuffToCreature(actor, 'co_position_secured') + + return + \ No newline at end of file diff --git a/scripts/commands/combat/co_armor_cracker.py b/scripts/commands/combat/co_armor_cracker.py new file mode 100644 index 00000000..c065b7ca --- /dev/null +++ b/scripts/commands/combat/co_armor_cracker.py @@ -0,0 +1,9 @@ +import sys + +def setup(core, actor, target, command): + if actor.getSkillMod('expertise_cooldown_line_co_riddle_armor'): + command.setCooldown(command.getCooldown() - actor.getSkillMod('expertise_cooldown_line_co_riddle_armor').getBase()) + return + +def run(core, actor, target, commandString): + return \ No newline at end of file diff --git a/scripts/commands/combat/co_del_ae_cc_1_1.py b/scripts/commands/combat/co_del_ae_cc_1_1.py new file mode 100644 index 00000000..ad1f5ab5 --- /dev/null +++ b/scripts/commands/combat/co_del_ae_cc_1_1.py @@ -0,0 +1,15 @@ +import sys + +def setup(core, actor, target, command): + if actor.getSkillMod('expertise_area_size_line_co_grenade'): + command.setConeLength(command.getConeLength() + actor.getSkillMod('expertise_area_size_line_co_grenade').getBase()) + if actor.getSkillMod('expertise_damage_line_co_grenade'): + command.setAddedDamage(command.getAddedDamage() * (1 + (actor.getSkillMod('expertise_damage_line_co_grenade').getBase() / 100))) + if actor.getSkillMod('expertise_action_line_co_grenade'): + command.setActionCost(command.getActionCost() * (1 - (actor.getSkillMod('expertise_action_line_co_grenade').getBase() / 100))) + if actor.getSkillMod('expertise_delay_reduce_line_co_grenade'): + command.setDelayAttackInterval(command.getDelayAttackInterval() - 1) + return + +def run(core, actor, target, commandString): + return \ No newline at end of file diff --git a/scripts/commands/combat/co_del_ae_cc_1_2.py b/scripts/commands/combat/co_del_ae_cc_1_2.py new file mode 100644 index 00000000..ad1f5ab5 --- /dev/null +++ b/scripts/commands/combat/co_del_ae_cc_1_2.py @@ -0,0 +1,15 @@ +import sys + +def setup(core, actor, target, command): + if actor.getSkillMod('expertise_area_size_line_co_grenade'): + command.setConeLength(command.getConeLength() + actor.getSkillMod('expertise_area_size_line_co_grenade').getBase()) + if actor.getSkillMod('expertise_damage_line_co_grenade'): + command.setAddedDamage(command.getAddedDamage() * (1 + (actor.getSkillMod('expertise_damage_line_co_grenade').getBase() / 100))) + if actor.getSkillMod('expertise_action_line_co_grenade'): + command.setActionCost(command.getActionCost() * (1 - (actor.getSkillMod('expertise_action_line_co_grenade').getBase() / 100))) + if actor.getSkillMod('expertise_delay_reduce_line_co_grenade'): + command.setDelayAttackInterval(command.getDelayAttackInterval() - 1) + return + +def run(core, actor, target, commandString): + return \ No newline at end of file diff --git a/scripts/commands/combat/co_del_ae_cc_1_3.py b/scripts/commands/combat/co_del_ae_cc_1_3.py new file mode 100644 index 00000000..ad1f5ab5 --- /dev/null +++ b/scripts/commands/combat/co_del_ae_cc_1_3.py @@ -0,0 +1,15 @@ +import sys + +def setup(core, actor, target, command): + if actor.getSkillMod('expertise_area_size_line_co_grenade'): + command.setConeLength(command.getConeLength() + actor.getSkillMod('expertise_area_size_line_co_grenade').getBase()) + if actor.getSkillMod('expertise_damage_line_co_grenade'): + command.setAddedDamage(command.getAddedDamage() * (1 + (actor.getSkillMod('expertise_damage_line_co_grenade').getBase() / 100))) + if actor.getSkillMod('expertise_action_line_co_grenade'): + command.setActionCost(command.getActionCost() * (1 - (actor.getSkillMod('expertise_action_line_co_grenade').getBase() / 100))) + if actor.getSkillMod('expertise_delay_reduce_line_co_grenade'): + command.setDelayAttackInterval(command.getDelayAttackInterval() - 1) + return + +def run(core, actor, target, commandString): + return \ No newline at end of file diff --git a/scripts/commands/combat/co_del_ae_cc_2_1.py b/scripts/commands/combat/co_del_ae_cc_2_1.py new file mode 100644 index 00000000..ad1f5ab5 --- /dev/null +++ b/scripts/commands/combat/co_del_ae_cc_2_1.py @@ -0,0 +1,15 @@ +import sys + +def setup(core, actor, target, command): + if actor.getSkillMod('expertise_area_size_line_co_grenade'): + command.setConeLength(command.getConeLength() + actor.getSkillMod('expertise_area_size_line_co_grenade').getBase()) + if actor.getSkillMod('expertise_damage_line_co_grenade'): + command.setAddedDamage(command.getAddedDamage() * (1 + (actor.getSkillMod('expertise_damage_line_co_grenade').getBase() / 100))) + if actor.getSkillMod('expertise_action_line_co_grenade'): + command.setActionCost(command.getActionCost() * (1 - (actor.getSkillMod('expertise_action_line_co_grenade').getBase() / 100))) + if actor.getSkillMod('expertise_delay_reduce_line_co_grenade'): + command.setDelayAttackInterval(command.getDelayAttackInterval() - 1) + return + +def run(core, actor, target, commandString): + return \ No newline at end of file diff --git a/scripts/commands/combat/co_del_ae_cc_2_2.py b/scripts/commands/combat/co_del_ae_cc_2_2.py new file mode 100644 index 00000000..ad1f5ab5 --- /dev/null +++ b/scripts/commands/combat/co_del_ae_cc_2_2.py @@ -0,0 +1,15 @@ +import sys + +def setup(core, actor, target, command): + if actor.getSkillMod('expertise_area_size_line_co_grenade'): + command.setConeLength(command.getConeLength() + actor.getSkillMod('expertise_area_size_line_co_grenade').getBase()) + if actor.getSkillMod('expertise_damage_line_co_grenade'): + command.setAddedDamage(command.getAddedDamage() * (1 + (actor.getSkillMod('expertise_damage_line_co_grenade').getBase() / 100))) + if actor.getSkillMod('expertise_action_line_co_grenade'): + command.setActionCost(command.getActionCost() * (1 - (actor.getSkillMod('expertise_action_line_co_grenade').getBase() / 100))) + if actor.getSkillMod('expertise_delay_reduce_line_co_grenade'): + command.setDelayAttackInterval(command.getDelayAttackInterval() - 1) + return + +def run(core, actor, target, commandString): + return \ No newline at end of file diff --git a/scripts/commands/combat/co_del_ae_dm_1.py b/scripts/commands/combat/co_del_ae_dm_1.py new file mode 100644 index 00000000..ad1f5ab5 --- /dev/null +++ b/scripts/commands/combat/co_del_ae_dm_1.py @@ -0,0 +1,15 @@ +import sys + +def setup(core, actor, target, command): + if actor.getSkillMod('expertise_area_size_line_co_grenade'): + command.setConeLength(command.getConeLength() + actor.getSkillMod('expertise_area_size_line_co_grenade').getBase()) + if actor.getSkillMod('expertise_damage_line_co_grenade'): + command.setAddedDamage(command.getAddedDamage() * (1 + (actor.getSkillMod('expertise_damage_line_co_grenade').getBase() / 100))) + if actor.getSkillMod('expertise_action_line_co_grenade'): + command.setActionCost(command.getActionCost() * (1 - (actor.getSkillMod('expertise_action_line_co_grenade').getBase() / 100))) + if actor.getSkillMod('expertise_delay_reduce_line_co_grenade'): + command.setDelayAttackInterval(command.getDelayAttackInterval() - 1) + return + +def run(core, actor, target, commandString): + return \ No newline at end of file diff --git a/scripts/commands/combat/co_del_ae_dm_2.py b/scripts/commands/combat/co_del_ae_dm_2.py new file mode 100644 index 00000000..ad1f5ab5 --- /dev/null +++ b/scripts/commands/combat/co_del_ae_dm_2.py @@ -0,0 +1,15 @@ +import sys + +def setup(core, actor, target, command): + if actor.getSkillMod('expertise_area_size_line_co_grenade'): + command.setConeLength(command.getConeLength() + actor.getSkillMod('expertise_area_size_line_co_grenade').getBase()) + if actor.getSkillMod('expertise_damage_line_co_grenade'): + command.setAddedDamage(command.getAddedDamage() * (1 + (actor.getSkillMod('expertise_damage_line_co_grenade').getBase() / 100))) + if actor.getSkillMod('expertise_action_line_co_grenade'): + command.setActionCost(command.getActionCost() * (1 - (actor.getSkillMod('expertise_action_line_co_grenade').getBase() / 100))) + if actor.getSkillMod('expertise_delay_reduce_line_co_grenade'): + command.setDelayAttackInterval(command.getDelayAttackInterval() - 1) + return + +def run(core, actor, target, commandString): + return \ No newline at end of file diff --git a/scripts/commands/combat/co_del_ae_dm_3.py b/scripts/commands/combat/co_del_ae_dm_3.py new file mode 100644 index 00000000..ad1f5ab5 --- /dev/null +++ b/scripts/commands/combat/co_del_ae_dm_3.py @@ -0,0 +1,15 @@ +import sys + +def setup(core, actor, target, command): + if actor.getSkillMod('expertise_area_size_line_co_grenade'): + command.setConeLength(command.getConeLength() + actor.getSkillMod('expertise_area_size_line_co_grenade').getBase()) + if actor.getSkillMod('expertise_damage_line_co_grenade'): + command.setAddedDamage(command.getAddedDamage() * (1 + (actor.getSkillMod('expertise_damage_line_co_grenade').getBase() / 100))) + if actor.getSkillMod('expertise_action_line_co_grenade'): + command.setActionCost(command.getActionCost() * (1 - (actor.getSkillMod('expertise_action_line_co_grenade').getBase() / 100))) + if actor.getSkillMod('expertise_delay_reduce_line_co_grenade'): + command.setDelayAttackInterval(command.getDelayAttackInterval() - 1) + return + +def run(core, actor, target, commandString): + return \ No newline at end of file diff --git a/scripts/commands/combat/co_riddle_armor.py b/scripts/commands/combat/co_riddle_armor.py new file mode 100644 index 00000000..c065b7ca --- /dev/null +++ b/scripts/commands/combat/co_riddle_armor.py @@ -0,0 +1,9 @@ +import sys + +def setup(core, actor, target, command): + if actor.getSkillMod('expertise_cooldown_line_co_riddle_armor'): + command.setCooldown(command.getCooldown() - actor.getSkillMod('expertise_cooldown_line_co_riddle_armor').getBase()) + return + +def run(core, actor, target, commandString): + return \ No newline at end of file diff --git a/scripts/commands/combat/co_stand_fast.py b/scripts/commands/combat/co_stand_fast.py new file mode 100644 index 00000000..36b4a557 --- /dev/null +++ b/scripts/commands/combat/co_stand_fast.py @@ -0,0 +1,9 @@ +import sys + +def setup(core, actor, target, command): + if actor.getSkillMod('expertise_cooldown_line_co_stand_fast'): + command.setCooldown(command.getCooldown() - actor.getSkillMod('expertise_cooldown_line_co_stand_fast').getBase()) + return + +def run(core, actor, target, commandString): + return \ No newline at end of file diff --git a/scripts/skillMods/expertise_critical_niche_all.py b/scripts/skillMods/expertise_critical_niche_all.py index 4f2871ac..ef07415a 100644 --- a/scripts/skillMods/expertise_critical_niche_all.py +++ b/scripts/skillMods/expertise_critical_niche_all.py @@ -2,11 +2,11 @@ import sys def add(core, actor, name, base): actor.addSkillMod(name, base) - core.skillModService.addSkillMod(actor, 'display_only_critical', 100 * (actor.getSkillModBase('expertise_critical_niche_all'))) + core.skillModService.addSkillMod(actor, 'display_only_critical', 100 * base) return def deduct(core, actor, name, base): actor.deductSkillMod(name, base) - core.skillModService.deductSkillMod(actor, 'display_only_critical', 100 * (actor.getSkillModBase('expertise_critical_niche_all'))) + core.skillModService.deductSkillMod(actor, 'display_only_critical', 100 * base) return \ No newline at end of file diff --git a/scripts/skillMods/expertise_innate_protection_all.py b/scripts/skillMods/expertise_innate_protection_all.py index ee7769e2..cceb61ec 100644 --- a/scripts/skillMods/expertise_innate_protection_all.py +++ b/scripts/skillMods/expertise_innate_protection_all.py @@ -1,10 +1,22 @@ import sys def add(core, actor, name, base): + actor.addSkillMod('energy', base) + actor.addSkillMod('kinetic', base) + actor.addSkillMod('acid', base) + actor.addSkillMod('heat', base) + actor.addSkillMod('cold', base) + actor.addSkillMod('electricity', base) actor.addSkillMod(name, base) return def deduct(core, actor, name, base): + actor.deductSkillMod('energy', base) + actor.deductSkillMod('kinetic', base) + actor.deductSkillMod('acid', base) + actor.deductSkillMod('heat', base) + actor.deductSkillMod('cold', base) + actor.deductSkillMod('electricity', base) actor.deductSkillMod(name, base) return \ No newline at end of file diff --git a/src/resources/objects/creature/CreatureObject.java b/src/resources/objects/creature/CreatureObject.java index 705898a2..cff18a9b 100644 --- a/src/resources/objects/creature/CreatureObject.java +++ b/src/resources/objects/creature/CreatureObject.java @@ -45,6 +45,7 @@ import engine.clients.Client; import resources.objects.Buff; import resources.objects.DamageOverTime; import resources.objects.SWGList; +import engine.resources.common.CRC; import engine.resources.objects.IPersistent; import engine.resources.objects.MissionCriticalObject; import engine.resources.objects.SWGObject; @@ -926,32 +927,25 @@ public class CreatureObject extends TangibleObject implements IPersistent { if(destination != getClient()) { UpdatePVPStatusMessage upvpm = new UpdatePVPStatusMessage(getObjectID()); - if (factionStatus == 1 && faction == "imperial") { + if (factionStatus == 1 && faction.equals("imperial")) { upvpm.setFaction(UpdatePVPStatusMessage.factionCRC.Imperial); upvpm.setStatus(16); - } - - if (factionStatus == 1 && faction == "rebel") { + } else if (factionStatus == 1 && faction.equals("rebel")) { upvpm.setFaction(UpdatePVPStatusMessage.factionCRC.Rebel); upvpm.setStatus(16); - } - - if (factionStatus == 2 && faction == "imperial") { + } else if (factionStatus == 2 && faction.equals("imperial")) { upvpm.setFaction(UpdatePVPStatusMessage.factionCRC.Imperial); upvpm.setStatus(55); - } - if (factionStatus == 2 && faction == "rebel") { + } else if (factionStatus == 2 && faction.equals("rebel")) { upvpm.setFaction(UpdatePVPStatusMessage.factionCRC.Rebel); upvpm.setStatus(55); - } - if(factionStatus == 0 && faction == "neutral" && getClient() != null) { - upvpm.setFaction(UpdatePVPStatusMessage.factionCRC.Neutral); + } else if(getSlottedObject("ghost") != null) { + upvpm.setFaction(CRC.StringtoCRC(faction)); upvpm.setStatus(16); - } - else { + } else { upvpm.setFaction(UpdatePVPStatusMessage.factionCRC.Neutral); upvpm.setStatus(0); - } + } destination.getSession().write(upvpm.serialize()); } } diff --git a/src/services/GroupService.java b/src/services/GroupService.java index b3c1832f..092648a8 100644 --- a/src/services/GroupService.java +++ b/src/services/GroupService.java @@ -201,7 +201,7 @@ public class GroupService implements INetworkDispatch { creature.setGroupId(0); creature.makeUnaware(group); creature.sendSystemMessage("You have left the group.", (byte) 0); - + for(SWGObject member : memberList) { CreatureObject creature2 = (CreatureObject) member; @@ -209,6 +209,12 @@ public class GroupService implements INetworkDispatch { } + // Remove group buffs + + if(creature.hasBuff("co_base_of_operations")) + core.buffService.removeBuffFromCreature(creature, creature.getBuffByName("co_base_of_operations")); + + } else { for(SWGObject member : memberList) { @@ -224,6 +230,11 @@ public class GroupService implements INetworkDispatch { creature2.makeUnaware(group); creature2.sendSystemMessage("The group has been disbanded.", (byte) 0); + + // Remove group buffs + + if(creature2.hasBuff("co_base_of_operations")) + core.buffService.removeBuffFromCreature(creature2, creature2.getBuffByName("co_base_of_operations")); } diff --git a/src/services/PlayerService.java b/src/services/PlayerService.java index ed08b68b..dc422aec 100644 --- a/src/services/PlayerService.java +++ b/src/services/PlayerService.java @@ -169,7 +169,7 @@ public class PlayerService implements INetworkDispatch { }); - swgOpcodes.put(Opcodes.ExpertiseRequestMessage, new INetworkRemoteEvent() { + /*swgOpcodes.put(Opcodes.ExpertiseRequestMessage, new INetworkRemoteEvent() { @Override public void handlePacket(IoSession session, IoBuffer buffer) throws Exception { @@ -198,7 +198,7 @@ public class PlayerService implements INetworkDispatch { } - }); + });*/ } diff --git a/src/services/SkillModService.java b/src/services/SkillModService.java index f7fabe0e..dfc1bb56 100644 --- a/src/services/SkillModService.java +++ b/src/services/SkillModService.java @@ -23,6 +23,7 @@ package services; import java.util.Map; +import resources.common.FileUtilities; import resources.objects.SWGList; import resources.objects.creature.CreatureObject; import main.NGECore; @@ -40,13 +41,19 @@ public class SkillModService implements INetworkDispatch { public void addSkillMod(CreatureObject creature, String skillMod, int value) { - core.scriptService.callScript("scripts/skillMods/", skillMod, "add", core, creature, skillMod, value); - + if(FileUtilities.doesFileExist("scripts/skillMods/" + skillMod + ".py")) + core.scriptService.callScript("scripts/skillMods/", skillMod, "add", core, creature, skillMod, value); + else + creature.addSkillMod(skillMod, value); } public void deductSkillMod(CreatureObject creature, String skillMod, int value) { - core.scriptService.callScript("scripts/skillMods/", skillMod, "deduct", core, creature, skillMod, value); + if(FileUtilities.doesFileExist("scripts/skillMods/" + skillMod + ".py")) + core.scriptService.callScript("scripts/skillMods/", skillMod, "deduct", core, creature, skillMod, value); + else + creature.deductSkillMod(skillMod, value); + } diff --git a/src/services/SkillService.java b/src/services/SkillService.java index 35fef3db..a6cd92c4 100644 --- a/src/services/SkillService.java +++ b/src/services/SkillService.java @@ -30,6 +30,7 @@ import org.apache.mina.core.session.IoSession; import protocol.swg.ExpertiseRequestMessage; import resources.common.Console; +import resources.common.FileUtilities; import resources.common.Opcodes; import resources.objects.creature.CreatureObject; import resources.objects.player.PlayerObject; @@ -144,8 +145,10 @@ public class SkillService implements INetworkDispatch { } } - for (String ability : abilities) { - creature.addAbility(ability); + if(!skill.contains("expertise")) { // only mark 1 abilities in datatable need to remove abilities per script + for (String ability : abilities) { + creature.addAbility(ability); + } } for (String skillMod : skillMods) { @@ -209,8 +212,10 @@ public class SkillService implements INetworkDispatch { //creature.addExpertisePoints(pointsRequired); } - for (String ability : abilities) { - creature.removeAbility(ability); + if(!skill.contains("expertise")) { // only mark 1 abilities in datatable need to remove abilities per script + for (String ability : abilities) { + creature.removeAbility(ability); + } } for (String skillMod : skillMods) { @@ -235,7 +240,7 @@ public class SkillService implements INetworkDispatch { @Override public void insertOpcodes(Map swgOpcodes, Map objControllerOpcodes) { - /*swgOpcodes.put(Opcodes.ExpertiseRequestMessage, new INetworkRemoteEvent() { + swgOpcodes.put(Opcodes.ExpertiseRequestMessage, new INetworkRemoteEvent() { @Override public void handlePacket(IoSession session, IoBuffer buffer) throws Exception { @@ -256,13 +261,20 @@ public class SkillService implements INetworkDispatch { return; CreatureObject creature = (CreatureObject) client.getParent(); + PlayerObject player = (PlayerObject) creature.getSlottedObject("ghost"); + + if(player == null) + return; for(String expertiseName : expertise.getExpertiseSkills()) { addSkill(creature, expertiseName); + if(!FileUtilities.doesFileExist("scripts/expertise/" + expertiseName + ".py")) + continue; + core.scriptService.callScript("scripts/expertise/", "addAbilities", expertiseName, core, creature, player); } } - });*/ + }); } diff --git a/src/services/combat/CombatCommands.java b/src/services/combat/CombatCommands.java index b2ab9acd..4c199d95 100644 --- a/src/services/combat/CombatCommands.java +++ b/src/services/combat/CombatCommands.java @@ -64,7 +64,6 @@ public class CombatCommands { core.commandService.registerCombatCommand("fireStunCannon"); core.commandService.registerCombatCommand("fireVoidRocketLauncher"); - // Bounty Hunter core.commandService.registerCombatCommand("bh_ae_dm_1"); @@ -130,8 +129,6 @@ public class CombatCommands { core.commandService.registerCombatCommand("bh_sh_2"); core.commandService.registerCombatCommand("bh_sh_3"); - - // Jedi core.commandService.registerCombatCommand("fs_sweep_1"); @@ -195,7 +192,6 @@ public class CombatCommands { core.commandService.registerCommand("fs_buff_invis_1"); // Force Cloak core.commandService.registerCombatCommand("fs_force_throw_1"); core.commandService.registerCommand("forceThrow"); - // Commando @@ -233,8 +229,8 @@ public class CombatCommands { core.commandService.registerCombatCommand("co_ae_hw_dot_kinetic_4"); core.commandService.registerCombatCommand("co_ae_hw_dot_kinetic_5"); core.commandService.registerCombatCommand("co_armor_cracker"); - core.commandService.registerCombatCommand("co_cluster_bomb"); - core.commandService.registerCombatCommand("co_cluster_bomblet"); + //core.commandService.registerCombatCommand("co_cluster_bomb"); + //core.commandService.registerCombatCommand("co_cluster_bomblet"); core.commandService.registerCombatCommand("co_del_ae_cc_1_1"); core.commandService.registerCombatCommand("co_del_ae_cc_1_2"); core.commandService.registerCombatCommand("co_del_ae_cc_1_3"); @@ -307,9 +303,10 @@ public class CombatCommands { core.commandService.registerCombatCommand("co_sh_1"); core.commandService.registerCombatCommand("co_sh_2"); core.commandService.registerCombatCommand("co_sh_3"); + core.commandService.registerCombatCommand("co_stand_fast"); core.commandService.registerCommand("co_hw_dot"); core.commandService.registerCommand("co_ae_hw_dot"); - + core.commandService.registerCommand("co_position_secured"); // Entertainer diff --git a/src/services/combat/CombatService.java b/src/services/combat/CombatService.java index 1522fce0..305b2581 100644 --- a/src/services/combat/CombatService.java +++ b/src/services/combat/CombatService.java @@ -327,6 +327,11 @@ public class CombatService implements INetworkDispatch { } + if(command.getAttackType() != 1 && target.getSkillMod("area_damage_resist_full_percentage") != null) { + if(new Random().nextFloat() <= target.getSkillModBase("area_damage_resist_full_percentage")) + damage = 0; + } + if(damage > 0) applyDamage(attacker, target, (int) damage); @@ -433,6 +438,9 @@ public class CombatService implements INetworkDispatch { baseArmor = target.getSkillMod("electricity").getBase(); } + + if(target.getSkillMod("expertise_innate_reduction_all_player") != null) + baseArmor *= (100 - target.getSkillMod("expertise_innate_reduction_all_player").getBase()) / 100; float mitigation = (float) (90 * (1 - Math.exp(-0.000125 * baseArmor)) + baseArmor / 9000); @@ -677,7 +685,7 @@ public class CombatService implements INetworkDispatch { } - float critChance = (float) attacker.getSkillMod("display_only_critical").getBase() / 10000; + float critChance = (float) (attacker.getSkillMod("display_only_critical").getBase() - target.getSkillModBase("display_only_expertise_critical_hit_reduction")) / 10000; r = random.nextFloat(); if(r <= critChance) return HitType.CRITICAL; @@ -845,6 +853,12 @@ public class CombatService implements INetworkDispatch { private void doSingleTargetHeal(CreatureObject healer, CreatureObject target, WeaponObject weapon, CombatCommand command, int actionCounter) { + if(command.getDotDuration() > 0) { + addHealOverTimeToCreature(healer, target, command); + return; + } + + int healAmount = command.getAddedDamage(); int healPotency = 0; @@ -1123,6 +1137,10 @@ public class CombatService implements INetworkDispatch { } + if(target.getSkillMod("expertise_innate_reduction_all_player") != null) { + baseArmor *= (100 - target.getSkillMod("expertise_innate_reduction_all_player").getBase()) / 100; + } + if(baseArmor > 0) { float mitigation = (float) (90 * (1 - Math.exp(-0.000125 * baseArmor)) + baseArmor / 9000); mitigation /= 100; @@ -1137,7 +1155,101 @@ public class CombatService implements INetworkDispatch { applyDamage(attacker, target, damage); } + + public void doSelfBuff(CreatureObject creature, WeaponObject weapon, CombatCommand command, int actionCounter) { + + boolean success = true; + + if(!applySpecialCost(creature, weapon, command)) + success = false; + + if(!success) { + IoSession session = creature.getClient().getSession(); + CommandEnqueueRemove commandRemove = new CommandEnqueueRemove(creature.getObjectId(), actionCounter); + session.write(new ObjControllerMessage(0x0B, commandRemove).serialize()); + StartTask startTask = new StartTask(actionCounter, creature.getObjectID(), command.getCommandCRC(), CRC.StringtoCRC(command.getCooldownGroup()), -1); + session.write(new ObjControllerMessage(0x0B, startTask).serialize()); + return; + } + + core.buffService.addBuffToCreature(creature, command.getBuffNameSelf()); + StartTask startTask = new StartTask(actionCounter, creature.getObjectID(), command.getCommandCRC(), CRC.StringtoCRC(command.getCooldownGroup()), command.getCooldown()); + ObjControllerMessage objController2 = new ObjControllerMessage(0x0B, startTask); + creature.getClient().getSession().write(objController2.serialize()); + + CommandEnqueueRemove commandRemove = new CommandEnqueueRemove(creature.getObjectID(), actionCounter); + ObjControllerMessage objController3 = new ObjControllerMessage(0x0B, commandRemove); + creature.getClient().getSession().write(objController3.serialize()); + + + } + + public void addHealOverTimeToCreature(final CreatureObject healer, final CreatureObject target, final CombatCommand command) { + + if(target.getDotByName(command.getCommandName()) != null) { + + DamageOverTime oldDot = target.getDotByName(command.getCommandName()); + oldDot.getTask().cancel(true); + target.removeDot(oldDot); + + } + + final DamageOverTime dot = new DamageOverTime(command.getCommandName(), null, command.getDotType(), command.getDotDuration(), command.getDotIntensity()); + target.addDot(dot); + dot.setStartTime(System.currentTimeMillis()); + + final ScheduledFuture task = scheduler.scheduleAtFixedRate(new Runnable() { + + @Override + public void run() { + + if(dot.getRemainingDuration() <= 0) { + target.removeDot(dot); + dot.getTask().cancel(true); + } + + doHealOverTimeTick(healer, target, command, dot); + + } + + + + }, 0, command.getDotDuration() / (command.getAddedDamage() / command.getDotIntensity()), TimeUnit.SECONDS); + + dot.setTask(task); + + + } + + private void doHealOverTimeTick(CreatureObject healer, CreatureObject target, CombatCommand command, DamageOverTime dot) { + + int healAmount = command.getDotIntensity(); + int healPotency = 0; + + if(healer.getSkillMod("expertise_healing_all") != null) + 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(); + if(healPotency > 0) + healAmount += (healAmount * (healPotency / 100)); + if(target.getSkillMod("expertise_healing_reduction") != null) + healAmount *= (1 - target.getSkillMod("expertise_healing_reduction").getBase() / 100); + + synchronized(target.getMutex()) { + target.setHealth(target.getHealth() + healAmount); + } + + target.notifyObservers(new PlayClientEffectLocMessage("appearance/pt_heal_2.prt", target.getPlanet().getName(), target.getWorldPosition()), true); + + } + public enum HitType{; public static final byte MISS = 0; @@ -1166,4 +1278,6 @@ public class CombatService implements INetworkDispatch { } + + } diff --git a/src/services/command/CommandService.java b/src/services/command/CommandService.java index 41ce0c64..f6483fab 100644 --- a/src/services/command/CommandService.java +++ b/src/services/command/CommandService.java @@ -168,7 +168,7 @@ public class CommandService implements INetworkDispatch { //if((command.getHitType() == 5 || command.getHitType() == 7) && !(target instanceof CreatureObject)) // success = false; - if(!(command.getAttackType() == 2) && !(command.getHitType() == 5)) { + if(!(command.getAttackType() == 2) && !(command.getHitType() == 5) && !(command.getHitType() == 0)) { if(target == null || !(target instanceof TangibleObject) || target == attacker) success = false; } else { @@ -245,6 +245,11 @@ public class CommandService implements INetworkDispatch { core.combatService.doRevive(attacker, (CreatureObject) target, weapon, command, actionCounter); return; } + + if(command.getHitType() == 0 && command.getBuffNameSelf().length() > 0) { + core.combatService.doSelfBuff(attacker, weapon, command, actionCounter); + return; + } core.combatService.doCombat(attacker, (TangibleObject) target, weapon, command, actionCounter); }