Browse Source

Class reformat

combat-2
MagicBot 7 months ago
parent
commit
0286b63a8e
  1. 34
      src/engine/gameManager/CombatManager.java

34
src/engine/gameManager/CombatManager.java

@ -12,7 +12,6 @@ import engine.job.JobContainer; @@ -12,7 +12,6 @@ import engine.job.JobContainer;
import engine.job.JobScheduler;
import engine.jobs.AttackJob;
import engine.jobs.DeferredPowerJob;
import engine.math.Bounds;
import engine.mbEnums;
import engine.net.DispatchMessage;
import engine.net.client.ClientConnection;
@ -47,7 +46,7 @@ public enum CombatManager { @@ -47,7 +46,7 @@ public enum CombatManager {
switch (target.getObjectType()) {
case Building:
if (((Building) target).isVulnerable() == false)
if (!((Building) target).isVulnerable())
return;
break;
case PlayerCharacter:
@ -77,7 +76,7 @@ public enum CombatManager { @@ -77,7 +76,7 @@ public enum CombatManager {
return;
}
if (mainWeapon == null && offWeapon != null && offWeapon.template.item_skill_required.containsKey("Block") == false) {
if (mainWeapon == null && offWeapon != null && !offWeapon.template.item_skill_required.containsKey("Block")) {
//swing left hand only
processAttack(attacker, target, mbEnums.EquipSlotType.LHELD);
return;
@ -95,12 +94,11 @@ public enum CombatManager { @@ -95,12 +94,11 @@ public enum CombatManager {
return;
}
if (mainWeapon != null && offWeapon != null && offWeapon.template.item_skill_required.containsKey("Block") == false) {
if (mainWeapon != null && offWeapon != null && !offWeapon.template.item_skill_required.containsKey("Block")) {
//two weapons equipped, swing both hands
processAttack(attacker, target, mbEnums.EquipSlotType.RHELD);
if (attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter))
processAttack(attacker, target, mbEnums.EquipSlotType.LHELD);
return;
}
}
@ -172,7 +170,7 @@ public enum CombatManager { @@ -172,7 +170,7 @@ public enum CombatManager {
if (wepSpeed < 10)
wepSpeed = 10; //Old was 10, but it can be reached lower with legit buffs,effects.
delay = wepSpeed * 100;
delay = wepSpeed * 100L;
}
if (attacker.getObjectType().equals(mbEnums.GameObjectType.Mob))
@ -182,7 +180,7 @@ public enum CombatManager { @@ -182,7 +180,7 @@ public enum CombatManager {
//handle retaliate
if (AbstractCharacter.IsAbstractCharacter(target)) {
if(((AbstractCharacter)target).combatTarget == null || ((AbstractCharacter)target).combatTarget.isAlive() == false){
if (((AbstractCharacter) target).combatTarget == null || !((AbstractCharacter) target).combatTarget.isAlive()) {
((AbstractCharacter) target).combatTarget = attacker;
if (target.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter) && ((AbstractCharacter) target).isCombat())
combatCycle((AbstractCharacter) target, attacker);
@ -299,7 +297,7 @@ public enum CombatManager { @@ -299,7 +297,7 @@ public enum CombatManager {
passiveType = mbEnums.PassiveType.Parry;
if (passiveType.equals(mbEnums.PassiveType.None) == false) {
if (!passiveType.equals(mbEnums.PassiveType.None)) {
TargetedActionMsg msg = new TargetedActionMsg(attacker, passiveAnim, target, passiveType.value);
if (target.getObjectType() == mbEnums.GameObjectType.PlayerCharacter)
@ -337,7 +335,7 @@ public enum CombatManager { @@ -337,7 +335,7 @@ public enum CombatManager {
Resists resists;
if (AbstractCharacter.IsAbstractCharacter(target) == false)
if (!AbstractCharacter.IsAbstractCharacter(target))
resists = ((Building) target).getResists(); //this is a building
else
resists = ((AbstractCharacter) target).getResists(); //this is a character
@ -474,30 +472,30 @@ public enum CombatManager { @@ -474,30 +472,30 @@ public enum CombatManager {
public static int getSwingAnimation(ItemTemplate wb, DeferredPowerJob dpj, boolean mainHand) {
int token = 0;
int token;
if (dpj != null) {
token = (dpj.getPower() != null) ? dpj.getPower().getToken() : 0;
if (token == 563721004) //kick animation
return 79;
if(wb != null) {
if (mainHand) {
if (wb != null)
if (mainHand)
return wb.weapon_attack_anim_right.get(ThreadLocalRandom.current().nextInt(wb.weapon_attack_anim_right.size()))[0];
} else {
else
return wb.weapon_attack_anim_left.get(ThreadLocalRandom.current().nextInt(wb.weapon_attack_anim_left.size()))[0];
}
}
}
if (wb == null)
return 75;
if(mainHand){
if (mainHand)
return wb.weapon_attack_anim_right.get(0)[0];
} else{
else
return wb.weapon_attack_anim_left.get(0)[0];
}
}
public static void setAutoAttackJob(AbstractCharacter attacker, mbEnums.EquipSlotType slot, long delay) {

Loading…
Cancel
Save