mirror of
https://github.com/OMGeeky/andors-trail.git
synced 2026-02-23 15:38:29 +01:00
Dual wield skill bugfixes.
(Seen when using a pair of Rapier of Lifesteal) : Adds boost to Max HP
from off-hand weapon (25% for Dual Wield lv 0, 50% for DW lv 1, and 100%
for DW lv 2)
(Seen when using a non-crit weap in the main hand, and a crit one in the
offhand) : Adds boost to Critical chance from off-hand weapon (25% for
DW0, 50% for DW1, 100% for DW2). Set critical multiplier as max of main
hand weapon's CM and off-hand weapon's CM multiplied by {0.25 for DW0,
0.5 for DW1, 1.0 for DW2).
This commit is contained in:
@@ -328,12 +328,15 @@ public final class SkillController {
|
||||
if (skillLevelFightStyle == 2) {
|
||||
percent = SkillCollection.DUALWIELD_EFFICIENCY_LEVEL2;
|
||||
playerTraits.attackCost = Math.max(attackCostMainHand, attackCostOffHand);
|
||||
playerTraits.criticalMultiplier = Math.max(mainHandItem.effects_equip.stats.setCriticalMultiplier, getPercentage(offHandItem.effects_equip.stats.setCriticalMultiplier, SkillCollection.DUALWIELD_EFFICIENCY_LEVEL2, 0));
|
||||
} else if (skillLevelFightStyle == 1) {
|
||||
percent = SkillCollection.DUALWIELD_EFFICIENCY_LEVEL1;
|
||||
playerTraits.attackCost = attackCostMainHand + getPercentage(attackCostOffHand, SkillCollection.DUALWIELD_LEVEL1_OFFHAND_AP_COST_PERCENT, 0);
|
||||
playerTraits.criticalMultiplier = Math.max(mainHandItem.effects_equip.stats.setCriticalMultiplier, getPercentage(offHandItem.effects_equip.stats.setCriticalMultiplier, SkillCollection.DUALWIELD_EFFICIENCY_LEVEL1, 0));
|
||||
} else {
|
||||
percent = SkillCollection.DUALWIELD_EFFICIENCY_LEVEL0;
|
||||
playerTraits.attackCost = attackCostMainHand + attackCostOffHand;
|
||||
playerTraits.criticalMultiplier = Math.max(mainHandItem.effects_equip.stats.setCriticalMultiplier, getPercentage(offHandItem.effects_equip.stats.setCriticalMultiplier, SkillCollection.DUALWIELD_EFFICIENCY_LEVEL0, 0));
|
||||
}
|
||||
|
||||
final int skillLevel = getSkillLevelForItemType(player, offHandItem);
|
||||
@@ -345,6 +348,7 @@ public final class SkillController {
|
||||
addPercentBlockChance(player, offHandItem, percent, 100);
|
||||
addPercentDamage(player, offHandItem, percent, 100);
|
||||
addPercentCriticalSkill(player, offHandItem, percent, 100);
|
||||
addPercentMaxHPBoost(player, offHandItem, percent, 100);
|
||||
}
|
||||
|
||||
int skillLevelSpecialization = player.getSkillLevel(SkillID.specializationDualWield);
|
||||
@@ -375,6 +379,11 @@ public final class SkillController {
|
||||
if (itemType.effects_equip == null) return;
|
||||
player.criticalSkill += getPercentage(itemType.effects_equip.stats.increaseCriticalSkill, percentForPositiveValues, percentForNegativeValues);
|
||||
}
|
||||
|
||||
private static void addPercentMaxHPBoost(Player player, ItemType itemType, int percentForPositiveValues, int percentForNegativeValues) {
|
||||
if (itemType.effects_equip == null) return;
|
||||
player.health.addToMax(getPercentage(itemType.effects_equip.stats.increaseMaxHP, percentForPositiveValues, percentForNegativeValues));
|
||||
}
|
||||
|
||||
private static int getPercentage(int originalValue, int percentForPositiveValues, int percentForNegativeValues) {
|
||||
if (originalValue == 0) {
|
||||
@@ -385,6 +394,16 @@ public final class SkillController {
|
||||
return (int) FloatMath.floor(originalValue * percentForNegativeValues / 100.0f);
|
||||
}
|
||||
}
|
||||
|
||||
private static float getPercentage(float originalValue, int percentForPositiveValues, int percentForNegativeValues) {
|
||||
if (originalValue == 0) {
|
||||
return 0;
|
||||
} else if (originalValue > 0) {
|
||||
return originalValue * percentForPositiveValues / 100.0f;
|
||||
} else {
|
||||
return originalValue * percentForNegativeValues / 100.0f;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isDualWielding(ItemType mainHandItem, ItemType offHandItem) {
|
||||
if (mainHandItem == null) return false;
|
||||
@@ -403,4 +422,4 @@ public final class SkillController {
|
||||
if (offHandItem == null) return false;
|
||||
return mainHandItem.isWeapon() && offHandItem.isShield();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user