From b8903b82f705c94d4619eec4ebb215cc7f8e83ff Mon Sep 17 00:00:00 2001 From: Ziggeh Date: Tue, 31 Dec 2013 13:17:29 +0100 Subject: [PATCH] Smuggler - Added Overridable Protection --- src/services/EquipmentService.java | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/services/EquipmentService.java b/src/services/EquipmentService.java index 7125fa32..b54a0d0d 100644 --- a/src/services/EquipmentService.java +++ b/src/services/EquipmentService.java @@ -171,6 +171,26 @@ public class EquipmentService implements INetworkDispatch { } + public void calculateOverridableProtection(CreatureObject actor, boolean add) { + + if (add == false) { + actor.addSkillMod("kinetic", actor.getSkillModBase("expertise_overridable_protection_generic") - ( actor.getSkillModBase("kinetic") / 2 ) ); + actor.addSkillMod("energy", actor.getSkillModBase("expertise_overridable_protection_generic") - ( actor.getSkillModBase("energy") / 2 ) ); + actor.addSkillMod("heat", actor.getSkillModBase("expertise_overridable_protection_generic") - ( actor.getSkillModBase("heat") / 2 ) ); + actor.addSkillMod("cold", actor.getSkillModBase("expertise_overridable_protection_generic") - ( actor.getSkillModBase("cold") / 2 ) ); + actor.addSkillMod("acid", actor.getSkillModBase("expertise_overridable_protection_generic") - ( actor.getSkillModBase("acid") / 2 ) ); + actor.addSkillMod("electricity", actor.getSkillModBase("expertise_overridable_protection_generic") - ( actor.getSkillModBase("electricity") / 2 ) ); + } else { + actor.deductSkillMod("kinetic", actor.getSkillModBase("expertise_overridable_protection_generic") - ( actor.getSkillModBase("kinetic") / 2 ) ); + actor.deductSkillMod("energy", actor.getSkillModBase("expertise_overridable_protection_generic") - ( actor.getSkillModBase("energy") / 2 ) ); + actor.deductSkillMod("heat", actor.getSkillModBase("expertise_overridable_protection_generic") - ( actor.getSkillModBase("heat") / 2 ) ); + actor.deductSkillMod("cold", actor.getSkillModBase("expertise_overridable_protection_generic") - ( actor.getSkillModBase("cold") / 2 ) ); + actor.deductSkillMod("acid", actor.getSkillModBase("expertise_overridable_protection_generic") - ( actor.getSkillModBase("acid") / 2 ) ); + actor.deductSkillMod("electricity", actor.getSkillModBase("expertise_overridable_protection_generic") - ( actor.getSkillModBase("electricity") / 2 ) ); + } + + } + public void equip(CreatureObject actor, SWGObject item) { String template = ((item.getAttachment("customServerTemplate") == null) ? item.getTemplate() : (item.getTemplate().split("shared_")[0] + "shared_" + ((String) item.getAttachment("customServerTemplate")) + ".iff")); @@ -182,6 +202,9 @@ public class EquipmentService implements INetworkDispatch { if (item.getStringAttribute("protection_level") != null) calculateForceProtection(actor, item, true); + if (actor.getSkillMod("expertise_overridable_protection_generic") != null) + calculateOverridableProtection(actor, true); + // TODO: faction restrictions - You had to be a Combatant as minimum in order to EQUIP an item. // TODO: Species restrictions // TODO: Gender restrictions @@ -231,6 +254,9 @@ public class EquipmentService implements INetworkDispatch { if (item.getStringAttribute("protection_level") != null) calculateForceProtection(actor, item, false); + if (actor.getSkillMod("expertise_overridable_protection_generic") != null) + calculateOverridableProtection(actor, false); + if(item.getStringAttribute("cat_wpn_damage.wpn_category") != null) if (actor.getSlotNameForObject(item).contentEquals("hold_r") == true) weaponCriticalToDisplay(actor, item, false);