removed ItemBase form Combat manager
This commit is contained in:
@@ -313,12 +313,12 @@ public enum CombatManager {
|
||||
|
||||
boolean isWeapon = true;
|
||||
Item weapon = equipped.get(weaponSlot);
|
||||
ItemBase wb = null;
|
||||
ItemTemplate wb = null;
|
||||
|
||||
if (weapon == null)
|
||||
isWeapon = false;
|
||||
else {
|
||||
ItemBase ib = weapon.getItemBase();
|
||||
ItemTemplate ib = weapon.template;
|
||||
|
||||
if (ib == null || !weapon.template.item_type.equals(ItemType.WEAPON))
|
||||
isWeapon = false;
|
||||
@@ -336,7 +336,7 @@ public enum CombatManager {
|
||||
Item weaponOff = equipped.get(EquipSlotType.RHELD);
|
||||
|
||||
if (weaponOff != null) {
|
||||
ItemBase ib = weaponOff.getItemBase();
|
||||
ItemTemplate ib = weaponOff.template;
|
||||
|
||||
if (ib == null || !weaponOff.template.item_type.equals(ItemType.WEAPON))
|
||||
hasNoWeapon = true;
|
||||
@@ -352,7 +352,7 @@ public enum CombatManager {
|
||||
//Source can attack.
|
||||
//NOTE Don't 'return;' beyond this point until timer created
|
||||
|
||||
boolean attackFailure = (wb != null) && (wb.getRange() > 35f) && abstractCharacter.isMoving();
|
||||
boolean attackFailure = (wb != null) && (wb.item_weapon_max_range > 35f) && abstractCharacter.isMoving();
|
||||
|
||||
//Target can't attack on move with ranged weapons.
|
||||
//if not enough stamina, then skip attack
|
||||
@@ -419,7 +419,7 @@ public enum CombatManager {
|
||||
if (hasNoWeapon || abstractCharacter.getObjectType().equals(GameObjectType.Mob))
|
||||
createTimer(abstractCharacter, slot, 20, true); //2 second for no weapon
|
||||
else {
|
||||
int wepSpeed = (int) (wb.getSpeed());
|
||||
int wepSpeed = (int) (wb.item_weapon_wepspeed);
|
||||
|
||||
if (weapon != null && weapon.getBonusPercent(ModType.WeaponSpeed, SourceType.NONE) != 0f) //add weapon speed bonus
|
||||
wepSpeed *= (1 + weapon.getBonus(ModType.WeaponSpeed, SourceType.NONE));
|
||||
@@ -460,7 +460,7 @@ public enum CombatManager {
|
||||
/**
|
||||
* Attempt to attack target
|
||||
*/
|
||||
private static void attack(AbstractCharacter attacker, AbstractWorldObject target, Item weapon, ItemBase wb, boolean mainHand) {
|
||||
private static void attack(AbstractCharacter attacker, AbstractWorldObject target, Item weapon, ItemTemplate wb, boolean mainHand) {
|
||||
|
||||
float atr;
|
||||
int minDamage, maxDamage;
|
||||
@@ -595,9 +595,9 @@ public enum CombatManager {
|
||||
// Apply Weapon power effect if any. don't try to apply twice if
|
||||
// dual wielding. Perform after passive test for sync purposes.
|
||||
|
||||
ItemTemplate template = ItemTemplate.templates.get(wb.getUUID());
|
||||
//ItemTemplate template = ItemTemplate.templates.get(wb.getUUID());
|
||||
|
||||
if (attacker.getObjectType().equals(GameObjectType.PlayerCharacter) && (mainHand || ItemTemplate.isTwoHanded(template))) {
|
||||
if (attacker.getObjectType().equals(GameObjectType.PlayerCharacter) && (mainHand || ItemTemplate.isTwoHanded(wb))) {
|
||||
|
||||
dpj = ((PlayerCharacter) attacker).getWeaponPower();
|
||||
|
||||
@@ -692,7 +692,7 @@ public enum CombatManager {
|
||||
SourceType damageType;
|
||||
|
||||
if (wb != null)
|
||||
damageType = wb.getDamageType();
|
||||
damageType = (SourceType) wb.item_weapon_damage.keySet().toArray()[0];
|
||||
else if (attacker.getObjectType().equals(GameObjectType.Mob) && ((Mob) attacker).isSiege())
|
||||
damageType = SourceType.SIEGE;
|
||||
else
|
||||
@@ -813,8 +813,7 @@ public enum CombatManager {
|
||||
// Apply Weapon power effect if any.
|
||||
// don't try to apply twice if dual wielding.
|
||||
|
||||
ItemTemplate template = ItemTemplate.templates.get(wb.getUUID());
|
||||
if (attacker.getObjectType().equals(GameObjectType.PlayerCharacter) && (mainHand || ItemTemplate.isTwoHanded(template))) {
|
||||
if (attacker.getObjectType().equals(GameObjectType.PlayerCharacter) && (mainHand || ItemTemplate.isTwoHanded(wb))) {
|
||||
dpj = ((PlayerCharacter) attacker).getWeaponPower();
|
||||
|
||||
if (dpj != null) {
|
||||
@@ -902,7 +901,7 @@ public enum CombatManager {
|
||||
if (item == null)
|
||||
return false;
|
||||
|
||||
ItemBase ib = item.getItemBase();
|
||||
ItemTemplate ib = item.template;
|
||||
|
||||
if (ib == null)
|
||||
return false;
|
||||
@@ -910,7 +909,7 @@ public enum CombatManager {
|
||||
if (item.template.item_type.equals(ItemType.WEAPON) == false)
|
||||
return false;
|
||||
|
||||
return ib.getRange() > MBServerStatics.RANGED_WEAPON_RANGE;
|
||||
return ib.item_weapon_max_range > MBServerStatics.RANGED_WEAPON_RANGE;
|
||||
|
||||
}
|
||||
|
||||
@@ -937,7 +936,7 @@ public enum CombatManager {
|
||||
return damage;
|
||||
}
|
||||
|
||||
private static void sendPassiveDefenseMessage(AbstractCharacter source, ItemBase wb, AbstractWorldObject target, int passiveType, DeferredPowerJob dpj, boolean mainHand) {
|
||||
private static void sendPassiveDefenseMessage(AbstractCharacter source, ItemTemplate wb, AbstractWorldObject target, int passiveType, DeferredPowerJob dpj, boolean mainHand) {
|
||||
|
||||
int swingAnimation = getSwingAnimation(wb, dpj, mainHand);
|
||||
|
||||
@@ -950,7 +949,7 @@ public enum CombatManager {
|
||||
|
||||
}
|
||||
|
||||
private static void sendCombatMessage(AbstractCharacter source, AbstractWorldObject target, float damage, ItemBase wb, DeferredPowerJob dpj, boolean mainHand) {
|
||||
private static void sendCombatMessage(AbstractCharacter source, AbstractWorldObject target, float damage, ItemTemplate wb, DeferredPowerJob dpj, boolean mainHand) {
|
||||
|
||||
int swingAnimation = getSwingAnimation(wb, dpj, mainHand);
|
||||
|
||||
@@ -967,7 +966,7 @@ public enum CombatManager {
|
||||
DispatchMessage.sendToAllInRange(target, cmm);
|
||||
}
|
||||
|
||||
public static int getSwingAnimation(ItemBase wb, DeferredPowerJob dpj, boolean mainHand) {
|
||||
public static int getSwingAnimation(ItemTemplate wb, DeferredPowerJob dpj, boolean mainHand) {
|
||||
int token = 0;
|
||||
|
||||
if (dpj != null)
|
||||
@@ -982,7 +981,7 @@ public enum CombatManager {
|
||||
if (wb == null)
|
||||
return 75;
|
||||
|
||||
ItemTemplate template = ItemTemplate.templates.get(wb.getUUID());
|
||||
ItemTemplate template = wb;
|
||||
|
||||
if (mainHand) {
|
||||
if (template.weapon_attack_anim_right.size() > 0) {
|
||||
@@ -1043,7 +1042,7 @@ public enum CombatManager {
|
||||
}
|
||||
|
||||
String required = template.item_skill_used;
|
||||
String mastery = wb.getMastery();
|
||||
String mastery = wb.item_skill_mastery_used;
|
||||
|
||||
if (required.equals("Unarmed Combat"))
|
||||
return 75;
|
||||
@@ -1109,7 +1108,7 @@ public enum CombatManager {
|
||||
pc.setLastPlayerAttackTime();
|
||||
}
|
||||
|
||||
public static float getWeaponRange(ItemBase weapon, PlayerBonuses bonus) {
|
||||
public static float getWeaponRange(ItemTemplate weapon, PlayerBonuses bonus) {
|
||||
|
||||
float rangeMod = 1.0f;
|
||||
|
||||
@@ -1119,7 +1118,7 @@ public enum CombatManager {
|
||||
if (bonus != null)
|
||||
rangeMod += bonus.getFloatPercentAll(ModType.WeaponRange, SourceType.NONE);
|
||||
|
||||
return weapon.getRange() * rangeMod;
|
||||
return weapon.item_weapon_max_range * rangeMod;
|
||||
}
|
||||
|
||||
public static void toggleCombat(ToggleCombatMsg msg, ClientConnection origin) {
|
||||
@@ -1327,7 +1326,7 @@ public enum CombatManager {
|
||||
return hitBox;
|
||||
}
|
||||
|
||||
private static void testItemDamage(AbstractCharacter ac, AbstractWorldObject awo, Item weapon, ItemBase wb) {
|
||||
private static void testItemDamage(AbstractCharacter ac, AbstractWorldObject awo, Item weapon, ItemTemplate wb) {
|
||||
|
||||
if (ac == null)
|
||||
return;
|
||||
@@ -1337,7 +1336,7 @@ public enum CombatManager {
|
||||
int chance = 4500;
|
||||
|
||||
if (wb != null)
|
||||
if (wb.isGlass()) //glass used weighted so fast weapons don't break faster
|
||||
if (wb.obj_name.contains("Glass")) //glass used weighted so fast weapons don't break faster
|
||||
chance = 9000 / weapon.template.item_wt;
|
||||
|
||||
//test damaging attackers weapon
|
||||
|
||||
Reference in New Issue
Block a user