mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-09-12 22:45:31 -04:00
Armor - Protection is added to character sheet
This commit is contained in:
@@ -56,7 +56,7 @@ public class EquipmentService implements INetworkDispatch {
|
||||
|
||||
private int getWeaponCriticalChance(CreatureObject actor, SWGObject item) {
|
||||
int weaponCriticalChance = 0;
|
||||
String weaponCriticalSkillMod = (core.scriptService.getMethod("scripts/equipment/", "weapon_critical", item.getStringAttribute("cat_wpn_damage.wpn_category")/*.replace(" ", "").replace("-", "") + "_" */).__call__().asString());
|
||||
String weaponCriticalSkillMod = (core.scriptService.getMethod("scripts/equipment/", "weapon_critical", item.getStringAttribute("cat_wpn_damage.wpn_category")).__call__().asString());
|
||||
|
||||
if(weaponCriticalSkillMod.contains(" "))
|
||||
weaponCriticalSkillMod.replace(" ", "");
|
||||
@@ -65,7 +65,7 @@ public class EquipmentService implements INetworkDispatch {
|
||||
weaponCriticalSkillMod.replace("-", "");
|
||||
|
||||
if(actor.getSkillMod(weaponCriticalSkillMod) != null)
|
||||
weaponCriticalChance = actor.getSkillModBase((core.scriptService.getMethod("scripts/equipment/", "weapon_critical", item.getStringAttribute("cat_wpn_damage.wpn_category").replace(" ", "").replace("-", "") + "_" ).__call__().asString()));
|
||||
weaponCriticalChance = actor.getSkillModBase(weaponCriticalSkillMod);
|
||||
|
||||
return weaponCriticalChance;
|
||||
}
|
||||
@@ -132,12 +132,34 @@ public class EquipmentService implements INetworkDispatch {
|
||||
return result;
|
||||
}
|
||||
|
||||
private float calculateArmorProtection (float protection, String slotName) {
|
||||
return protection *= (Float.parseFloat(core.scriptService.getMethod("scripts/equipment/", "slot_protection", slotName).__call__().asString()) / 100);
|
||||
}
|
||||
|
||||
private void addArmorProtection(CreatureObject actor, String protectionType, float protection, String slotName) {
|
||||
actor.addSkillMod(protectionType, (int) (calculateArmorProtection(protection, slotName)));
|
||||
}
|
||||
|
||||
private void deductArmorProtection(CreatureObject actor, String protectionType, float protection, String slotName) {
|
||||
actor.deductSkillMod(protectionType, (int) calculateArmorProtection(protection, slotName));
|
||||
}
|
||||
|
||||
private void addForceProtection(CreatureObject actor, SWGObject item) {
|
||||
actor.addSkillMod("expertise_innate_protection_all", getForceProtection(item));
|
||||
actor.addSkillMod("kinetic", getForceProtection(item));
|
||||
actor.addSkillMod("energy", getForceProtection(item));
|
||||
actor.addSkillMod("heat", getForceProtection(item));
|
||||
actor.addSkillMod("cold", getForceProtection(item));
|
||||
actor.addSkillMod("acid", getForceProtection(item));
|
||||
actor.addSkillMod("electricity", getForceProtection(item));
|
||||
}
|
||||
|
||||
private void deductForceProtection(CreatureObject actor, SWGObject item) {
|
||||
actor.deductSkillMod("expertise_innate_protection_all", getForceProtection(item));
|
||||
actor.deductSkillMod("kinetic", getForceProtection(item));
|
||||
actor.deductSkillMod("energy", getForceProtection(item));
|
||||
actor.deductSkillMod("heat", getForceProtection(item));
|
||||
actor.deductSkillMod("cold", getForceProtection(item));
|
||||
actor.deductSkillMod("acid", getForceProtection(item));
|
||||
actor.deductSkillMod("electricity", getForceProtection(item));
|
||||
}
|
||||
|
||||
private int getForceProtection(SWGObject item) {
|
||||
@@ -163,8 +185,7 @@ public class EquipmentService implements INetworkDispatch {
|
||||
// TODO: bio-link (assign it by objectID with setAttachment and then just display the customName for that objectID).
|
||||
|
||||
if(item.getStringAttribute("cat_wpn_damage.wpn_category") != null)
|
||||
if (actor.getSlotNameForObject(item).contentEquals("hold_r") == true)
|
||||
addWeaponCriticalChance(actor, item);
|
||||
addWeaponCriticalChance(actor, item);
|
||||
|
||||
Map<String, Object> attributes = new TreeMap<String, Object>(item.getAttributes());
|
||||
|
||||
@@ -177,6 +198,14 @@ public class EquipmentService implements INetworkDispatch {
|
||||
core.skillModService.addSkillMod(actor, e.getKey().replace("cat_stat_mod_bonus.@stat_n:", ""), Integer.parseInt((String) e.getValue()));
|
||||
}
|
||||
|
||||
if(e.getKey().startsWith("cat_armor_standard_protection")) {
|
||||
addArmorProtection(actor, e.getKey().replace("cat_armor_standard_protection.armor_eff_", ""), Float.parseFloat((String) e.getValue()), actor.getSlotNameForObject(item));
|
||||
}
|
||||
|
||||
if(e.getKey().startsWith("cat_armor_special_protection")) {
|
||||
addArmorProtection(actor, e.getKey().replace("cat_armor_special_protection.special_protection_type_", ""), Float.parseFloat((String) e.getValue()), actor.getSlotNameForObject(item));
|
||||
}
|
||||
|
||||
if(e.getKey().startsWith("cat_attrib_mod_bonus.attr_health")) {
|
||||
actor.setMaxHealth(actor.getMaxHealth() + Integer.parseInt((String) e.getValue()));
|
||||
}
|
||||
@@ -184,6 +213,7 @@ public class EquipmentService implements INetworkDispatch {
|
||||
if(e.getKey().startsWith("cat_attrib_mod_bonus.attr_action")) {
|
||||
actor.setMaxAction(actor.getMaxAction() + Integer.parseInt((String) e.getValue()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(!actor.getEquipmentList().contains(item))
|
||||
@@ -215,6 +245,15 @@ public class EquipmentService implements INetworkDispatch {
|
||||
if(e.getKey().startsWith("cat_stat_mod_bonus.@stat_n:")) {
|
||||
core.skillModService.deductSkillMod(actor, e.getKey().replace("cat_stat_mod_bonus.@stat_n:", ""), Integer.parseInt((String) e.getValue()));
|
||||
}
|
||||
|
||||
if(e.getKey().startsWith("cat_armor_standard_protection")) {
|
||||
deductArmorProtection(actor, e.getKey().replace("cat_armor_standard_protection.armor_eff_", ""), Float.parseFloat((String) e.getValue()), actor.getSlotNameForObject(item));
|
||||
}
|
||||
|
||||
if(e.getKey().startsWith("cat_armor_special_protection")) {
|
||||
deductArmorProtection(actor, e.getKey().replace("cat_armor_special_protection.special_protection_type_", ""), Float.parseFloat((String) e.getValue()), actor.getSlotNameForObject(item));
|
||||
}
|
||||
|
||||
if(e.getKey().startsWith("cat_attrib_mod_bonus.attr_health")) {
|
||||
actor.setMaxHealth(actor.getMaxHealth() - Integer.parseInt((String) e.getValue()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user