|
|
@ -491,9 +491,9 @@ public abstract class AbstractCharacter extends AbstractWorldObject { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static Regions InsideBuildingRegionGoingDown(AbstractCharacter player) { |
|
|
|
public static Regions InsideBuildingRegionGoingDown(AbstractCharacter abstractCharacter) { |
|
|
|
|
|
|
|
|
|
|
|
HashSet<AbstractWorldObject> buildings = WorldGrid.getObjectsInRangePartial(player, 1000, MBServerStatics.MASK_BUILDING); |
|
|
|
HashSet<AbstractWorldObject> buildings = WorldGrid.getObjectsInRangePartial(abstractCharacter, 1000, MBServerStatics.MASK_BUILDING); |
|
|
|
|
|
|
|
|
|
|
|
Regions tempRegion = null; |
|
|
|
Regions tempRegion = null; |
|
|
|
for (AbstractWorldObject awo : buildings) { |
|
|
|
for (AbstractWorldObject awo : buildings) { |
|
|
@ -502,12 +502,12 @@ public abstract class AbstractCharacter extends AbstractWorldObject { |
|
|
|
if (building.getBounds() == null) |
|
|
|
if (building.getBounds() == null) |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
|
|
if (!Bounds.collide(player.getLoc(), building.getBounds())) |
|
|
|
if (!Bounds.collide(abstractCharacter.getLoc(), building.getBounds())) |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
|
|
for (Regions region : building.getBounds().getRegions()) { |
|
|
|
for (Regions region : building.getBounds().getRegions()) { |
|
|
|
|
|
|
|
|
|
|
|
if (!region.isPointInPolygon(player.getLoc())) |
|
|
|
if (!region.isPointInPolygon(abstractCharacter.getLoc())) |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
|
|
if (!region.isOutside()) |
|
|
|
if (!region.isOutside()) |
|
|
@ -536,22 +536,22 @@ public abstract class AbstractCharacter extends AbstractWorldObject { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void teleport(AbstractCharacter worldObject, final Vector3fImmutable targetLoc) { |
|
|
|
public static void teleport(AbstractCharacter abstractCharacter, final Vector3fImmutable targetLoc) { |
|
|
|
worldObject.locationLock.writeLock().lock(); |
|
|
|
abstractCharacter.locationLock.writeLock().lock(); |
|
|
|
try { |
|
|
|
try { |
|
|
|
MovementManager.translocate(worldObject, targetLoc); |
|
|
|
MovementManager.translocate(abstractCharacter, targetLoc); |
|
|
|
if (worldObject.getObjectType().equals(GameObjectType.PlayerCharacter)) |
|
|
|
if (abstractCharacter.getObjectType().equals(GameObjectType.PlayerCharacter)) |
|
|
|
InterestManager.INTERESTMANAGER.HandleLoadForTeleport((PlayerCharacter) worldObject); |
|
|
|
InterestManager.INTERESTMANAGER.HandleLoadForTeleport((PlayerCharacter) abstractCharacter); |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
Logger.error(e); |
|
|
|
Logger.error(e); |
|
|
|
} finally { |
|
|
|
} finally { |
|
|
|
worldObject.locationLock.writeLock().unlock(); |
|
|
|
abstractCharacter.locationLock.writeLock().unlock(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void removeRune(PlayerCharacter pc, ClientConnection origin, int runeID) { |
|
|
|
public static void removeRune(PlayerCharacter playerCharacter, ClientConnection origin, int runeID) { |
|
|
|
|
|
|
|
|
|
|
|
if (pc == null || origin == null) { |
|
|
|
if (playerCharacter == null || origin == null) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -561,12 +561,12 @@ public abstract class AbstractCharacter extends AbstractWorldObject { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//see if pc has rune
|
|
|
|
//see if pc has rune
|
|
|
|
ArrayList<CharacterRune> runes = pc.getRunes(); |
|
|
|
ArrayList<CharacterRune> runes = playerCharacter.getRunes(); |
|
|
|
|
|
|
|
|
|
|
|
if (runes == null) |
|
|
|
if (runes == null) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
CharacterRune found = pc.getRune(runeID); |
|
|
|
CharacterRune found = playerCharacter.getRune(runeID); |
|
|
|
|
|
|
|
|
|
|
|
if (found == null) |
|
|
|
if (found == null) |
|
|
|
return; |
|
|
|
return; |
|
|
@ -574,16 +574,16 @@ public abstract class AbstractCharacter extends AbstractWorldObject { |
|
|
|
//TODO see if player needs to refine skills or powers first
|
|
|
|
//TODO see if player needs to refine skills or powers first
|
|
|
|
//attempt remove rune from player
|
|
|
|
//attempt remove rune from player
|
|
|
|
|
|
|
|
|
|
|
|
if (!CharacterRune.removeRune(pc, runeID)) |
|
|
|
if (!CharacterRune.removeRune(playerCharacter, runeID)) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
//update client with removed rune.
|
|
|
|
//update client with removed rune.
|
|
|
|
ApplyRuneMsg arm = new ApplyRuneMsg(pc.getObjectType().ordinal(), pc.getObjectUUID(), runeID); |
|
|
|
ApplyRuneMsg arm = new ApplyRuneMsg(playerCharacter.getObjectType().ordinal(), playerCharacter.getObjectUUID(), runeID); |
|
|
|
Dispatch dispatch = Dispatch.borrow(pc, arm); |
|
|
|
Dispatch dispatch = Dispatch.borrow(playerCharacter, arm); |
|
|
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY); |
|
|
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void removeAllBlessings(PlayerCharacter player) { |
|
|
|
public static void removeAllBlessings(PlayerCharacter playerCharacter) { |
|
|
|
|
|
|
|
|
|
|
|
PowersBase[] powers = new PowersBase[3]; |
|
|
|
PowersBase[] powers = new PowersBase[3]; |
|
|
|
|
|
|
|
|
|
|
@ -592,24 +592,24 @@ public abstract class AbstractCharacter extends AbstractWorldObject { |
|
|
|
powers[2] = PowersManager.getPowerByIDString("BLS-WISDOM"); |
|
|
|
powers[2] = PowersManager.getPowerByIDString("BLS-WISDOM"); |
|
|
|
|
|
|
|
|
|
|
|
for (PowersBase power : powers) { |
|
|
|
for (PowersBase power : powers) { |
|
|
|
PowersManager.removeEffect(player, power.getActions().get(0), true, false); |
|
|
|
PowersManager.removeEffect(playerCharacter, power.getActions().get(0), true, false); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
|
|
|
|
* @param abstractCharacter |
|
|
|
* @ Calculates Atr (both hands) Defense, and Damage for pc |
|
|
|
* @ Calculates Atr (both hands) Defense, and Damage for pc |
|
|
|
* @param playerCharacter |
|
|
|
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static void calculateAtrDefenseDamage(AbstractCharacter playerCharacter) { |
|
|
|
public static void calculateAtrDefenseDamage(AbstractCharacter abstractCharacter) { |
|
|
|
if (playerCharacter.charItemManager == null || playerCharacter.charItemManager.getEquipped() == null || playerCharacter.skills == null) { |
|
|
|
if (abstractCharacter.charItemManager == null || abstractCharacter.charItemManager.getEquipped() == null || abstractCharacter.skills == null) { |
|
|
|
Logger.error("Player " + playerCharacter.getObjectUUID() + " missing skills or equipment"); |
|
|
|
Logger.error("Player " + abstractCharacter.getObjectUUID() + " missing skills or equipment"); |
|
|
|
defaultAtrAndDamage(playerCharacter,true); |
|
|
|
defaultAtrAndDamage(abstractCharacter, true); |
|
|
|
defaultAtrAndDamage(playerCharacter,false); |
|
|
|
defaultAtrAndDamage(abstractCharacter, false); |
|
|
|
playerCharacter.defenseRating = 0; |
|
|
|
abstractCharacter.defenseRating = 0; |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
ConcurrentHashMap<EquipSlotType, Item> equipped = playerCharacter.charItemManager.getEquipped(); |
|
|
|
ConcurrentHashMap<EquipSlotType, Item> equipped = abstractCharacter.charItemManager.getEquipped(); |
|
|
|
|
|
|
|
|
|
|
|
// // Reset passives
|
|
|
|
// // Reset passives
|
|
|
|
// if (this.bonuses != null) {
|
|
|
|
// if (this.bonuses != null) {
|
|
|
@ -621,30 +621,30 @@ public abstract class AbstractCharacter extends AbstractWorldObject { |
|
|
|
// this.bonuses.setBool("Dodge", false);
|
|
|
|
// this.bonuses.setBool("Dodge", false);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// calculate atr and damage for each hand
|
|
|
|
// calculate atr and damage for each hand
|
|
|
|
calculateAtrDamageForWeapon(playerCharacter,equipped.get(EquipSlotType.RHELD), true, equipped.get(EquipSlotType.RHELD)); |
|
|
|
calculateAtrDamageForWeapon(abstractCharacter, equipped.get(EquipSlotType.RHELD), true, equipped.get(EquipSlotType.RHELD)); |
|
|
|
calculateAtrDamageForWeapon(playerCharacter,equipped.get(EquipSlotType.LHELD), false, equipped.get(EquipSlotType.LHELD)); |
|
|
|
calculateAtrDamageForWeapon(abstractCharacter, equipped.get(EquipSlotType.LHELD), false, equipped.get(EquipSlotType.LHELD)); |
|
|
|
|
|
|
|
|
|
|
|
// No Defense while in DeathShroud
|
|
|
|
// No Defense while in DeathShroud
|
|
|
|
if (playerCharacter.effects != null && playerCharacter.effects.containsKey("DeathShroud")) |
|
|
|
if (abstractCharacter.effects != null && abstractCharacter.effects.containsKey("DeathShroud")) |
|
|
|
playerCharacter.defenseRating = (short) 0; |
|
|
|
abstractCharacter.defenseRating = (short) 0; |
|
|
|
else { |
|
|
|
else { |
|
|
|
// calculate defense for equipment
|
|
|
|
// calculate defense for equipment
|
|
|
|
float defense = playerCharacter.statDexCurrent * 2; |
|
|
|
float defense = abstractCharacter.statDexCurrent * 2; |
|
|
|
defense += getShieldDefense(playerCharacter,equipped.get(EquipSlotType.LHELD)); |
|
|
|
defense += getShieldDefense(abstractCharacter, equipped.get(EquipSlotType.LHELD)); |
|
|
|
defense += getArmorDefense(playerCharacter,equipped.get(EquipSlotType.HELM)); |
|
|
|
defense += getArmorDefense(abstractCharacter, equipped.get(EquipSlotType.HELM)); |
|
|
|
defense += getArmorDefense(playerCharacter,equipped.get(EquipSlotType.CHEST)); |
|
|
|
defense += getArmorDefense(abstractCharacter, equipped.get(EquipSlotType.CHEST)); |
|
|
|
defense += getArmorDefense(playerCharacter,equipped.get(EquipSlotType.UPARM)); |
|
|
|
defense += getArmorDefense(abstractCharacter, equipped.get(EquipSlotType.UPARM)); |
|
|
|
defense += getArmorDefense(playerCharacter,equipped.get(EquipSlotType.HANDS)); |
|
|
|
defense += getArmorDefense(abstractCharacter, equipped.get(EquipSlotType.HANDS)); |
|
|
|
defense += getArmorDefense(playerCharacter,equipped.get(EquipSlotType.LEGS)); |
|
|
|
defense += getArmorDefense(abstractCharacter, equipped.get(EquipSlotType.LEGS)); |
|
|
|
defense += getArmorDefense(playerCharacter,equipped.get(EquipSlotType.FEET)); |
|
|
|
defense += getArmorDefense(abstractCharacter, equipped.get(EquipSlotType.FEET)); |
|
|
|
defense += getWeaponDefense(playerCharacter,equipped); |
|
|
|
defense += getWeaponDefense(abstractCharacter, equipped); |
|
|
|
|
|
|
|
|
|
|
|
if (playerCharacter.bonuses != null) { |
|
|
|
if (abstractCharacter.bonuses != null) { |
|
|
|
// add any bonuses
|
|
|
|
// add any bonuses
|
|
|
|
defense += (short) playerCharacter.bonuses.getFloat(ModType.DCV, SourceType.NONE); |
|
|
|
defense += (short) abstractCharacter.bonuses.getFloat(ModType.DCV, SourceType.NONE); |
|
|
|
|
|
|
|
|
|
|
|
// Finally multiply any percent modifiers. DO THIS LAST!
|
|
|
|
// Finally multiply any percent modifiers. DO THIS LAST!
|
|
|
|
float pos_Bonus = playerCharacter.bonuses.getFloatPercentPositive(ModType.DCV, SourceType.NONE); |
|
|
|
float pos_Bonus = abstractCharacter.bonuses.getFloatPercentPositive(ModType.DCV, SourceType.NONE); |
|
|
|
defense = (short) (defense * (1 + pos_Bonus)); |
|
|
|
defense = (short) (defense * (1 + pos_Bonus)); |
|
|
|
|
|
|
|
|
|
|
|
//Lucky rune applies next
|
|
|
|
//Lucky rune applies next
|
|
|
@ -653,7 +653,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject { |
|
|
|
|
|
|
|
|
|
|
|
//and negative percent modifiers
|
|
|
|
//and negative percent modifiers
|
|
|
|
//already done...
|
|
|
|
//already done...
|
|
|
|
float neg_Bonus = playerCharacter.bonuses.getFloatPercentNegative(ModType.DCV, SourceType.NONE); |
|
|
|
float neg_Bonus = abstractCharacter.bonuses.getFloatPercentNegative(ModType.DCV, SourceType.NONE); |
|
|
|
defense = (short) (defense * (1 + neg_Bonus)); |
|
|
|
defense = (short) (defense * (1 + neg_Bonus)); |
|
|
|
|
|
|
|
|
|
|
|
} else |
|
|
|
} else |
|
|
@ -661,14 +661,14 @@ public abstract class AbstractCharacter extends AbstractWorldObject { |
|
|
|
Logger.error("Error: missing bonuses"); |
|
|
|
Logger.error("Error: missing bonuses"); |
|
|
|
|
|
|
|
|
|
|
|
defense = (defense < 1) ? 1 : defense; |
|
|
|
defense = (defense < 1) ? 1 : defense; |
|
|
|
playerCharacter.defenseRating = (short) (defense + 0.5f); |
|
|
|
abstractCharacter.defenseRating = (short) (defense + 0.5f); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @ Calculates Atr, and Damage for each weapon |
|
|
|
* @ Calculates Atr, and Damage for each weapon |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static void calculateAtrDamageForWeapon(AbstractCharacter playerCharacter, Item weapon, boolean mainHand, Item otherHand) { |
|
|
|
public static void calculateAtrDamageForWeapon(AbstractCharacter abstractCharacter, Item weapon, boolean mainHand, Item otherHand) { |
|
|
|
|
|
|
|
|
|
|
|
// make sure weapon exists
|
|
|
|
// make sure weapon exists
|
|
|
|
boolean noWeapon = false; |
|
|
|
boolean noWeapon = false; |
|
|
@ -680,7 +680,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject { |
|
|
|
if (ib == null) |
|
|
|
if (ib == null) |
|
|
|
noWeapon = true; |
|
|
|
noWeapon = true; |
|
|
|
else if (!weapon.template.item_type.equals(ItemType.WEAPON)) { |
|
|
|
else if (!weapon.template.item_type.equals(ItemType.WEAPON)) { |
|
|
|
defaultAtrAndDamage(playerCharacter,mainHand); |
|
|
|
defaultAtrAndDamage(abstractCharacter, mainHand); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} else |
|
|
|
} else |
|
|
|
wb = ib; |
|
|
|
wb = ib; |
|
|
@ -697,22 +697,22 @@ public abstract class AbstractCharacter extends AbstractWorldObject { |
|
|
|
// get skill percentages and min and max damage for weapons
|
|
|
|
// get skill percentages and min and max damage for weapons
|
|
|
|
if (noWeapon) { |
|
|
|
if (noWeapon) { |
|
|
|
if (mainHand) { |
|
|
|
if (mainHand) { |
|
|
|
Item off = playerCharacter.charItemManager.getEquipped().get(EquipSlotType.LHELD); |
|
|
|
Item off = abstractCharacter.charItemManager.getEquipped().get(EquipSlotType.LHELD); |
|
|
|
if (off != null && off.template != null && off.template.item_type.equals(ItemType.WEAPON)) |
|
|
|
if (off != null && off.template != null && off.template.item_type.equals(ItemType.WEAPON)) |
|
|
|
playerCharacter.rangeHandOne = 10 * (1 + (playerCharacter.statStrBase / 600)); // Set
|
|
|
|
abstractCharacter.rangeHandOne = 10 * (1 + (abstractCharacter.statStrBase / 600)); // Set
|
|
|
|
// to
|
|
|
|
// to
|
|
|
|
// no
|
|
|
|
// no
|
|
|
|
// weapon
|
|
|
|
// weapon
|
|
|
|
// range
|
|
|
|
// range
|
|
|
|
else |
|
|
|
else |
|
|
|
playerCharacter.rangeHandOne = -1; // set to do not attack
|
|
|
|
abstractCharacter.rangeHandOne = -1; // set to do not attack
|
|
|
|
} else |
|
|
|
} else |
|
|
|
playerCharacter.rangeHandTwo = -1; // set to do not attack
|
|
|
|
abstractCharacter.rangeHandTwo = -1; // set to do not attack
|
|
|
|
|
|
|
|
|
|
|
|
skillPercentage = getModifiedAmount(playerCharacter.skills.get("Unarmed Combat")); |
|
|
|
skillPercentage = getModifiedAmount(abstractCharacter.skills.get("Unarmed Combat")); |
|
|
|
masteryPercentage = getModifiedAmount(playerCharacter.skills.get("Unarmed Combat Mastery")); |
|
|
|
masteryPercentage = getModifiedAmount(abstractCharacter.skills.get("Unarmed Combat Mastery")); |
|
|
|
if (masteryPercentage == 0f) |
|
|
|
if (masteryPercentage == 0f) |
|
|
|
mastDam = CharacterSkill.getQuickMastery(playerCharacter, "Unarmed Combat Mastery"); |
|
|
|
mastDam = CharacterSkill.getQuickMastery(abstractCharacter, "Unarmed Combat Mastery"); |
|
|
|
else |
|
|
|
else |
|
|
|
mastDam = masteryPercentage; |
|
|
|
mastDam = masteryPercentage; |
|
|
|
// TODO Correct these
|
|
|
|
// TODO Correct these
|
|
|
@ -720,27 +720,27 @@ public abstract class AbstractCharacter extends AbstractWorldObject { |
|
|
|
max = 3; |
|
|
|
max = 3; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if (mainHand) |
|
|
|
if (mainHand) |
|
|
|
playerCharacter.rangeHandOne = weapon.template.item_weapon_max_range * (1 + (playerCharacter.statStrBase / 600)); |
|
|
|
abstractCharacter.rangeHandOne = weapon.template.item_weapon_max_range * (1 + (abstractCharacter.statStrBase / 600)); |
|
|
|
else |
|
|
|
else |
|
|
|
playerCharacter.rangeHandTwo = weapon.template.item_weapon_max_range * (1 + (playerCharacter.statStrBase / 600)); |
|
|
|
abstractCharacter.rangeHandTwo = weapon.template.item_weapon_max_range * (1 + (abstractCharacter.statStrBase / 600)); |
|
|
|
|
|
|
|
|
|
|
|
if (playerCharacter.bonuses != null) { |
|
|
|
if (abstractCharacter.bonuses != null) { |
|
|
|
float range_bonus = 1 + playerCharacter.bonuses.getFloatPercentAll(ModType.WeaponRange, SourceType.NONE); |
|
|
|
float range_bonus = 1 + abstractCharacter.bonuses.getFloatPercentAll(ModType.WeaponRange, SourceType.NONE); |
|
|
|
|
|
|
|
|
|
|
|
if (mainHand) |
|
|
|
if (mainHand) |
|
|
|
playerCharacter.rangeHandOne *= range_bonus; |
|
|
|
abstractCharacter.rangeHandOne *= range_bonus; |
|
|
|
else |
|
|
|
else |
|
|
|
playerCharacter.rangeHandTwo *= range_bonus; |
|
|
|
abstractCharacter.rangeHandTwo *= range_bonus; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
skillPercentage = getModifiedAmount(playerCharacter.skills.get(weapon.template.item_skill_used)); |
|
|
|
skillPercentage = getModifiedAmount(abstractCharacter.skills.get(weapon.template.item_skill_used)); |
|
|
|
masteryPercentage = getModifiedAmount(playerCharacter.skills.get(wb.item_skill_mastery_used)); |
|
|
|
masteryPercentage = getModifiedAmount(abstractCharacter.skills.get(wb.item_skill_mastery_used)); |
|
|
|
if (masteryPercentage == 0f) |
|
|
|
if (masteryPercentage == 0f) |
|
|
|
mastDam = 0f; |
|
|
|
mastDam = 0f; |
|
|
|
// mastDam = CharacterSkill.getQuickMastery(this, wb.getMastery());
|
|
|
|
// mastDam = CharacterSkill.getQuickMastery(this, wb.getMastery());
|
|
|
|
else |
|
|
|
else |
|
|
|
mastDam = masteryPercentage; |
|
|
|
mastDam = masteryPercentage; |
|
|
|
int[] damages = (int[])wb.item_weapon_damage.values().toArray()[0]; |
|
|
|
int[] damages = (int[]) wb.item_weapon_damage.values().toArray()[0]; |
|
|
|
min = damages[0]; |
|
|
|
min = damages[0]; |
|
|
|
max = damages[1]; |
|
|
|
max = damages[1]; |
|
|
|
strBased = wb.item_primary_attr.equals(AttributeType.Strength); |
|
|
|
strBased = wb.item_primary_attr.equals(AttributeType.Strength); |
|
|
@ -758,29 +758,29 @@ public abstract class AbstractCharacter extends AbstractWorldObject { |
|
|
|
// }
|
|
|
|
// }
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (playerCharacter.effects != null && playerCharacter.effects.containsKey("DeathShroud")) |
|
|
|
if (abstractCharacter.effects != null && abstractCharacter.effects.containsKey("DeathShroud")) |
|
|
|
// No Atr in deathshroud.
|
|
|
|
// No Atr in deathshroud.
|
|
|
|
if (mainHand) |
|
|
|
if (mainHand) |
|
|
|
playerCharacter.atrHandOne = (short) 0; |
|
|
|
abstractCharacter.atrHandOne = (short) 0; |
|
|
|
else |
|
|
|
else |
|
|
|
playerCharacter.atrHandTwo = (short) 0; |
|
|
|
abstractCharacter.atrHandTwo = (short) 0; |
|
|
|
else { |
|
|
|
else { |
|
|
|
// calculate atr
|
|
|
|
// calculate atr
|
|
|
|
float atr = 0; |
|
|
|
float atr = 0; |
|
|
|
atr += (int) skillPercentage * 4f; //<-round down skill% -
|
|
|
|
atr += (int) skillPercentage * 4f; //<-round down skill% -
|
|
|
|
atr += (int) masteryPercentage * 3f; |
|
|
|
atr += (int) masteryPercentage * 3f; |
|
|
|
if (playerCharacter.statStrCurrent > playerCharacter.statDexCurrent) |
|
|
|
if (abstractCharacter.statStrCurrent > abstractCharacter.statDexCurrent) |
|
|
|
atr += playerCharacter.statStrCurrent / 2; |
|
|
|
atr += abstractCharacter.statStrCurrent / 2; |
|
|
|
else |
|
|
|
else |
|
|
|
atr += playerCharacter.statDexCurrent / 2; |
|
|
|
atr += abstractCharacter.statDexCurrent / 2; |
|
|
|
|
|
|
|
|
|
|
|
// add in any bonuses to atr
|
|
|
|
// add in any bonuses to atr
|
|
|
|
if (playerCharacter.bonuses != null) { |
|
|
|
if (abstractCharacter.bonuses != null) { |
|
|
|
// Add any base bonuses
|
|
|
|
// Add any base bonuses
|
|
|
|
atr += playerCharacter.bonuses.getFloat(ModType.OCV, SourceType.NONE); |
|
|
|
atr += abstractCharacter.bonuses.getFloat(ModType.OCV, SourceType.NONE); |
|
|
|
|
|
|
|
|
|
|
|
// Finally use any multipliers. DO THIS LAST!
|
|
|
|
// Finally use any multipliers. DO THIS LAST!
|
|
|
|
float pos_Bonus = (1 + playerCharacter.bonuses.getFloatPercentPositive(ModType.OCV, SourceType.NONE)); |
|
|
|
float pos_Bonus = (1 + abstractCharacter.bonuses.getFloatPercentPositive(ModType.OCV, SourceType.NONE)); |
|
|
|
atr *= pos_Bonus; |
|
|
|
atr *= pos_Bonus; |
|
|
|
|
|
|
|
|
|
|
|
// next precise
|
|
|
|
// next precise
|
|
|
@ -788,7 +788,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject { |
|
|
|
// atr *= (1 + ((float) this.bonuses.getShort("rune.Attack") / 100));
|
|
|
|
// atr *= (1 + ((float) this.bonuses.getShort("rune.Attack") / 100));
|
|
|
|
|
|
|
|
|
|
|
|
//and negative percent modifiers
|
|
|
|
//and negative percent modifiers
|
|
|
|
float neg_Bonus = playerCharacter.bonuses.getFloatPercentNegative(ModType.OCV, SourceType.NONE); |
|
|
|
float neg_Bonus = abstractCharacter.bonuses.getFloatPercentNegative(ModType.OCV, SourceType.NONE); |
|
|
|
|
|
|
|
|
|
|
|
atr *= (1 + neg_Bonus); |
|
|
|
atr *= (1 + neg_Bonus); |
|
|
|
} |
|
|
|
} |
|
|
@ -797,9 +797,9 @@ public abstract class AbstractCharacter extends AbstractWorldObject { |
|
|
|
|
|
|
|
|
|
|
|
// set atr
|
|
|
|
// set atr
|
|
|
|
if (mainHand) |
|
|
|
if (mainHand) |
|
|
|
playerCharacter.atrHandOne = (short) (atr + 0.5f); |
|
|
|
abstractCharacter.atrHandOne = (short) (atr + 0.5f); |
|
|
|
else |
|
|
|
else |
|
|
|
playerCharacter.atrHandTwo = (short) (atr + 0.5f); |
|
|
|
abstractCharacter.atrHandTwo = (short) (atr + 0.5f); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//calculate speed
|
|
|
|
//calculate speed
|
|
|
@ -808,8 +808,8 @@ public abstract class AbstractCharacter extends AbstractWorldObject { |
|
|
|
else |
|
|
|
else |
|
|
|
speed = 20f; //unarmed attack speed
|
|
|
|
speed = 20f; //unarmed attack speed
|
|
|
|
if (weapon != null) |
|
|
|
if (weapon != null) |
|
|
|
speed *= (1 + playerCharacter.bonuses.getFloatPercentAll(ModType.WeaponSpeed, SourceType.NONE)); |
|
|
|
speed *= (1 + abstractCharacter.bonuses.getFloatPercentAll(ModType.WeaponSpeed, SourceType.NONE)); |
|
|
|
speed *= (1 + playerCharacter.bonuses.getFloatPercentAll(ModType.AttackDelay, SourceType.NONE)); |
|
|
|
speed *= (1 + abstractCharacter.bonuses.getFloatPercentAll(ModType.AttackDelay, SourceType.NONE)); |
|
|
|
if (speed < 10) |
|
|
|
if (speed < 10) |
|
|
|
speed = 10; |
|
|
|
speed = 10; |
|
|
|
|
|
|
|
|
|
|
@ -850,37 +850,37 @@ public abstract class AbstractCharacter extends AbstractWorldObject { |
|
|
|
// calculate damage
|
|
|
|
// calculate damage
|
|
|
|
float minDamage; |
|
|
|
float minDamage; |
|
|
|
float maxDamage; |
|
|
|
float maxDamage; |
|
|
|
float pri = (strBased) ? (float) playerCharacter.statStrCurrent : (float) playerCharacter.statDexCurrent; |
|
|
|
float pri = (strBased) ? (float) abstractCharacter.statStrCurrent : (float) abstractCharacter.statDexCurrent; |
|
|
|
float sec = (strBased) ? (float) playerCharacter.statDexCurrent : (float) playerCharacter.statStrCurrent; |
|
|
|
float sec = (strBased) ? (float) abstractCharacter.statDexCurrent : (float) abstractCharacter.statStrCurrent; |
|
|
|
minDamage = (float) (min * ((0.0315f * Math.pow(pri, 0.75f)) + (0.042f * Math.pow(sec, 0.75f)) + (0.01f * ((int) skillPercentage + (int) mastDam)))); |
|
|
|
minDamage = (float) (min * ((0.0315f * Math.pow(pri, 0.75f)) + (0.042f * Math.pow(sec, 0.75f)) + (0.01f * ((int) skillPercentage + (int) mastDam)))); |
|
|
|
maxDamage = (float) (max * ((0.0785f * Math.pow(pri, 0.75f)) + (0.016f * Math.pow(sec, 0.75f)) + (0.0075f * ((int) skillPercentage + (int) mastDam)))); |
|
|
|
maxDamage = (float) (max * ((0.0785f * Math.pow(pri, 0.75f)) + (0.016f * Math.pow(sec, 0.75f)) + (0.0075f * ((int) skillPercentage + (int) mastDam)))); |
|
|
|
minDamage = (float) ((int) (minDamage + 0.5f)); //round to nearest decimal
|
|
|
|
minDamage = (float) ((int) (minDamage + 0.5f)); //round to nearest decimal
|
|
|
|
maxDamage = (float) ((int) (maxDamage + 0.5f)); //round to nearest decimal
|
|
|
|
maxDamage = (float) ((int) (maxDamage + 0.5f)); //round to nearest decimal
|
|
|
|
|
|
|
|
|
|
|
|
// Half damage if in death shroud
|
|
|
|
// Half damage if in death shroud
|
|
|
|
if (playerCharacter.effects != null && playerCharacter.effects.containsKey("DeathShroud")) { |
|
|
|
if (abstractCharacter.effects != null && abstractCharacter.effects.containsKey("DeathShroud")) { |
|
|
|
minDamage *= 0.5f; |
|
|
|
minDamage *= 0.5f; |
|
|
|
maxDamage *= 0.5f; |
|
|
|
maxDamage *= 0.5f; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// add in any bonuses to damage
|
|
|
|
// add in any bonuses to damage
|
|
|
|
if (playerCharacter.bonuses != null) { |
|
|
|
if (abstractCharacter.bonuses != null) { |
|
|
|
// Add any base bonuses
|
|
|
|
// Add any base bonuses
|
|
|
|
minDamage += playerCharacter.bonuses.getFloat(ModType.MinDamage, SourceType.NONE); |
|
|
|
minDamage += abstractCharacter.bonuses.getFloat(ModType.MinDamage, SourceType.NONE); |
|
|
|
maxDamage += playerCharacter.bonuses.getFloat(ModType.MaxDamage, SourceType.NONE); |
|
|
|
maxDamage += abstractCharacter.bonuses.getFloat(ModType.MaxDamage, SourceType.NONE); |
|
|
|
|
|
|
|
|
|
|
|
minDamage += playerCharacter.bonuses.getFloat(ModType.MeleeDamageModifier, SourceType.NONE); |
|
|
|
minDamage += abstractCharacter.bonuses.getFloat(ModType.MeleeDamageModifier, SourceType.NONE); |
|
|
|
maxDamage += playerCharacter.bonuses.getFloat(ModType.MeleeDamageModifier, SourceType.NONE); |
|
|
|
maxDamage += abstractCharacter.bonuses.getFloat(ModType.MeleeDamageModifier, SourceType.NONE); |
|
|
|
// Finally use any multipliers. DO THIS LAST!
|
|
|
|
// Finally use any multipliers. DO THIS LAST!
|
|
|
|
|
|
|
|
|
|
|
|
float percentMinDamage = 1; |
|
|
|
float percentMinDamage = 1; |
|
|
|
float percentMaxDamage = 1; |
|
|
|
float percentMaxDamage = 1; |
|
|
|
|
|
|
|
|
|
|
|
percentMinDamage += playerCharacter.bonuses.getFloatPercentAll(ModType.MinDamage, SourceType.NONE); |
|
|
|
percentMinDamage += abstractCharacter.bonuses.getFloatPercentAll(ModType.MinDamage, SourceType.NONE); |
|
|
|
percentMinDamage += playerCharacter.bonuses.getFloatPercentAll(ModType.MeleeDamageModifier, SourceType.NONE); |
|
|
|
percentMinDamage += abstractCharacter.bonuses.getFloatPercentAll(ModType.MeleeDamageModifier, SourceType.NONE); |
|
|
|
|
|
|
|
|
|
|
|
percentMaxDamage += playerCharacter.bonuses.getFloatPercentAll(ModType.MaxDamage, SourceType.NONE); |
|
|
|
percentMaxDamage += abstractCharacter.bonuses.getFloatPercentAll(ModType.MaxDamage, SourceType.NONE); |
|
|
|
percentMaxDamage += playerCharacter.bonuses.getFloatPercentAll(ModType.MeleeDamageModifier, SourceType.NONE); |
|
|
|
percentMaxDamage += abstractCharacter.bonuses.getFloatPercentAll(ModType.MeleeDamageModifier, SourceType.NONE); |
|
|
|
|
|
|
|
|
|
|
|
minDamage *= percentMinDamage; |
|
|
|
minDamage *= percentMinDamage; |
|
|
|
maxDamage *= percentMaxDamage; |
|
|
|
maxDamage *= percentMaxDamage; |
|
|
@ -889,20 +889,20 @@ public abstract class AbstractCharacter extends AbstractWorldObject { |
|
|
|
|
|
|
|
|
|
|
|
// set damages
|
|
|
|
// set damages
|
|
|
|
if (mainHand) { |
|
|
|
if (mainHand) { |
|
|
|
playerCharacter.minDamageHandOne = (int) minDamage; |
|
|
|
abstractCharacter.minDamageHandOne = (int) minDamage; |
|
|
|
playerCharacter.maxDamageHandOne = (int) maxDamage; |
|
|
|
abstractCharacter.maxDamageHandOne = (int) maxDamage; |
|
|
|
playerCharacter.speedHandOne = speed; |
|
|
|
abstractCharacter.speedHandOne = speed; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
playerCharacter.minDamageHandTwo = (int) minDamage; |
|
|
|
abstractCharacter.minDamageHandTwo = (int) minDamage; |
|
|
|
playerCharacter.maxDamageHandTwo = (int) maxDamage; |
|
|
|
abstractCharacter.maxDamageHandTwo = (int) maxDamage; |
|
|
|
playerCharacter.speedHandTwo = speed; |
|
|
|
abstractCharacter.speedHandTwo = speed; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @ Calculates Defense for shield |
|
|
|
* @ Calculates Defense for shield |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private static float getShieldDefense(AbstractCharacter playerCharacter, Item shield) { |
|
|
|
private static float getShieldDefense(AbstractCharacter abstractCharacter, Item shield) { |
|
|
|
|
|
|
|
|
|
|
|
if (shield == null) |
|
|
|
if (shield == null) |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
@ -915,7 +915,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject { |
|
|
|
if (ab == null) |
|
|
|
if (ab == null) |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
|
|
|
|
|
|
|
|
CharacterSkill blockSkill = playerCharacter.skills.get("Block"); |
|
|
|
CharacterSkill blockSkill = abstractCharacter.skills.get("Block"); |
|
|
|
|
|
|
|
|
|
|
|
float skillMod; |
|
|
|
float skillMod; |
|
|
|
|
|
|
|
|
|
|
@ -940,7 +940,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* @ Calculates Defense for armor |
|
|
|
* @ Calculates Defense for armor |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private static float getArmorDefense(AbstractCharacter playerCharacter, Item armor) { |
|
|
|
private static float getArmorDefense(AbstractCharacter abstractCharacter, Item armor) { |
|
|
|
|
|
|
|
|
|
|
|
if (armor == null) |
|
|
|
if (armor == null) |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
@ -956,10 +956,10 @@ public abstract class AbstractCharacter extends AbstractWorldObject { |
|
|
|
if (armor.template.item_skill_used.isEmpty()) |
|
|
|
if (armor.template.item_skill_used.isEmpty()) |
|
|
|
return ib.item_defense_rating; |
|
|
|
return ib.item_defense_rating; |
|
|
|
|
|
|
|
|
|
|
|
CharacterSkill armorSkill = playerCharacter.skills.get(armor.template.item_skill_used); |
|
|
|
CharacterSkill armorSkill = abstractCharacter.skills.get(armor.template.item_skill_used); |
|
|
|
|
|
|
|
|
|
|
|
if (playerCharacter.getObjectType().equals(GameObjectType.PlayerCharacter) && armorSkill == null) { |
|
|
|
if (abstractCharacter.getObjectType().equals(GameObjectType.PlayerCharacter) && armorSkill == null) { |
|
|
|
Logger.error("Player " + playerCharacter.getObjectUUID() |
|
|
|
Logger.error("Player " + abstractCharacter.getObjectUUID() |
|
|
|
+ " has armor equipped without the nescessary skill to equip it"); |
|
|
|
+ " has armor equipped without the nescessary skill to equip it"); |
|
|
|
return ib.item_defense_rating; |
|
|
|
return ib.item_defense_rating; |
|
|
|
} |
|
|
|
} |
|
|
@ -979,7 +979,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* @ Calculates Defense for weapon |
|
|
|
* @ Calculates Defense for weapon |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private static float getWeaponDefense(AbstractCharacter playerCharacter, ConcurrentHashMap<EquipSlotType, Item> equipped) { |
|
|
|
private static float getWeaponDefense(AbstractCharacter abstractCharacter, ConcurrentHashMap<EquipSlotType, Item> equipped) { |
|
|
|
Item weapon = equipped.get(EquipSlotType.RHELD); |
|
|
|
Item weapon = equipped.get(EquipSlotType.RHELD); |
|
|
|
ItemTemplate wb = null; |
|
|
|
ItemTemplate wb = null; |
|
|
|
CharacterSkill skill, mastery; |
|
|
|
CharacterSkill skill, mastery; |
|
|
@ -996,11 +996,11 @@ public abstract class AbstractCharacter extends AbstractWorldObject { |
|
|
|
if (wb == null) |
|
|
|
if (wb == null) |
|
|
|
unarmed = true; |
|
|
|
unarmed = true; |
|
|
|
if (unarmed) { |
|
|
|
if (unarmed) { |
|
|
|
skill = playerCharacter.skills.get("Unarmed Combat"); |
|
|
|
skill = abstractCharacter.skills.get("Unarmed Combat"); |
|
|
|
mastery = playerCharacter.skills.get("Unarmed Combat Mastery"); |
|
|
|
mastery = abstractCharacter.skills.get("Unarmed Combat Mastery"); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
skill = playerCharacter.skills.get(weapon.template.item_skill_used); |
|
|
|
skill = abstractCharacter.skills.get(weapon.template.item_skill_used); |
|
|
|
mastery = playerCharacter.skills.get(wb.item_skill_mastery_used); |
|
|
|
mastery = abstractCharacter.skills.get(wb.item_skill_mastery_used); |
|
|
|
} |
|
|
|
} |
|
|
|
if (skill != null) |
|
|
|
if (skill != null) |
|
|
|
val += (int) skill.getModifiedAmount() / 2f; |
|
|
|
val += (int) skill.getModifiedAmount() / 2f; |
|
|
@ -1011,15 +1011,15 @@ public abstract class AbstractCharacter extends AbstractWorldObject { |
|
|
|
|
|
|
|
|
|
|
|
//Don't call this function directly. linked from pc.calculateSkills()
|
|
|
|
//Don't call this function directly. linked from pc.calculateSkills()
|
|
|
|
//through SkillCalcJob. Designed to only run from one worker thread
|
|
|
|
//through SkillCalcJob. Designed to only run from one worker thread
|
|
|
|
public static void runSkillCalc(AbstractCharacter playerCharacter) { |
|
|
|
public static void runSkillCalc(AbstractCharacter abstractCharacter) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
//see if any new skills or powers granted
|
|
|
|
//see if any new skills or powers granted
|
|
|
|
CharacterSkill.calculateSkills(playerCharacter); |
|
|
|
CharacterSkill.calculateSkills(abstractCharacter); |
|
|
|
// calculate granted Trains in powers.
|
|
|
|
// calculate granted Trains in powers.
|
|
|
|
CharacterPower.grantTrains(playerCharacter); |
|
|
|
CharacterPower.grantTrains(abstractCharacter); |
|
|
|
//see if any new powers unlocked from previous check
|
|
|
|
//see if any new powers unlocked from previous check
|
|
|
|
CharacterPower.calculatePowers(playerCharacter); |
|
|
|
CharacterPower.calculatePowers(abstractCharacter); |
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
} |
|
|
|
} |
|
|
@ -1027,10 +1027,10 @@ public abstract class AbstractCharacter extends AbstractWorldObject { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//calculate item bonuses here
|
|
|
|
//calculate item bonuses here
|
|
|
|
public static void calculateItemBonuses(AbstractCharacter playerCharacter) { |
|
|
|
public static void calculateItemBonuses(AbstractCharacter abstractCharacter) { |
|
|
|
if (playerCharacter.charItemManager == null || playerCharacter.bonuses == null) |
|
|
|
if (abstractCharacter.charItemManager == null || abstractCharacter.bonuses == null) |
|
|
|
return; |
|
|
|
return; |
|
|
|
ConcurrentHashMap<EquipSlotType, Item> equipped = playerCharacter.charItemManager.getEquipped(); |
|
|
|
ConcurrentHashMap<EquipSlotType, Item> equipped = abstractCharacter.charItemManager.getEquipped(); |
|
|
|
for (Item item : equipped.values()) { |
|
|
|
for (Item item : equipped.values()) { |
|
|
|
ItemTemplate ib = item.template; |
|
|
|
ItemTemplate ib = item.template; |
|
|
|
if (ib == null) |
|
|
|
if (ib == null) |
|
|
@ -1042,19 +1042,19 @@ public abstract class AbstractCharacter extends AbstractWorldObject { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* @ Defaults ATR, Defense and Damage for player |
|
|
|
* @ Defaults ATR, Defense and Damage for player |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private static void defaultAtrAndDamage(AbstractCharacter playerCharacter, boolean mainHand) { |
|
|
|
private static void defaultAtrAndDamage(AbstractCharacter abstractCharacter, boolean mainHand) { |
|
|
|
if (mainHand) { |
|
|
|
if (mainHand) { |
|
|
|
playerCharacter.atrHandOne = 0; |
|
|
|
abstractCharacter.atrHandOne = 0; |
|
|
|
playerCharacter.minDamageHandOne = 0; |
|
|
|
abstractCharacter.minDamageHandOne = 0; |
|
|
|
playerCharacter.maxDamageHandOne = 0; |
|
|
|
abstractCharacter.maxDamageHandOne = 0; |
|
|
|
playerCharacter.rangeHandOne = -1; |
|
|
|
abstractCharacter.rangeHandOne = -1; |
|
|
|
playerCharacter.speedHandOne = 20; |
|
|
|
abstractCharacter.speedHandOne = 20; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
playerCharacter.atrHandTwo = 0; |
|
|
|
abstractCharacter.atrHandTwo = 0; |
|
|
|
playerCharacter.minDamageHandTwo = 0; |
|
|
|
abstractCharacter.minDamageHandTwo = 0; |
|
|
|
playerCharacter.maxDamageHandTwo = 0; |
|
|
|
abstractCharacter.maxDamageHandTwo = 0; |
|
|
|
playerCharacter.rangeHandTwo = -1; |
|
|
|
abstractCharacter.rangeHandTwo = -1; |
|
|
|
playerCharacter.speedHandTwo = 20; |
|
|
|
abstractCharacter.speedHandTwo = 20; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|