Browse Source

Class reformat

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

Loading…
Cancel
Save