Final CombatManager
This commit is contained in:
+4
-1
@@ -19,7 +19,10 @@ import java.util.EnumSet;
|
|||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
|
||||||
public class FinalCombatManager {
|
public enum CombatManager {
|
||||||
|
|
||||||
|
COMBAT_MANAGER;
|
||||||
|
|
||||||
public static void combatCycle(AbstractCharacter attacker, AbstractWorldObject target) {
|
public static void combatCycle(AbstractCharacter attacker, AbstractWorldObject target) {
|
||||||
|
|
||||||
//early exit checks
|
//early exit checks
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
package engine.jobs;
|
package engine.jobs;
|
||||||
|
|
||||||
import engine.gameManager.FinalCombatManager;
|
import engine.gameManager.CombatManager;
|
||||||
import engine.job.AbstractJob;
|
import engine.job.AbstractJob;
|
||||||
import engine.objects.AbstractCharacter;
|
import engine.objects.AbstractCharacter;
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ public class AttackJob extends AbstractJob {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doJob() {
|
protected void doJob() {
|
||||||
FinalCombatManager.combatCycle(this.source,this.source.combatTarget);
|
CombatManager.combatCycle(this.source, this.source.combatTarget);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean success() {
|
public boolean success() {
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ public class MobAI {
|
|||||||
ItemBase offHand = mob.getWeaponItemBase(false);
|
ItemBase offHand = mob.getWeaponItemBase(false);
|
||||||
|
|
||||||
if (mainHand == null && offHand == null) {
|
if (mainHand == null && offHand == null) {
|
||||||
FinalCombatManager.combatCycle(mob, target);
|
CombatManager.combatCycle(mob, target);
|
||||||
int delay = 3000;
|
int delay = 3000;
|
||||||
if (mob.isSiege())
|
if (mob.isSiege())
|
||||||
delay = 11000;
|
delay = 11000;
|
||||||
@@ -134,13 +134,13 @@ public class MobAI {
|
|||||||
int delay = 3000;
|
int delay = 3000;
|
||||||
if (mob.isSiege())
|
if (mob.isSiege())
|
||||||
delay = 11000;
|
delay = 11000;
|
||||||
FinalCombatManager.combatCycle(mob, target);
|
CombatManager.combatCycle(mob, target);
|
||||||
mob.setLastAttackTime(System.currentTimeMillis() + delay);
|
mob.setLastAttackTime(System.currentTimeMillis() + delay);
|
||||||
} else if (mob.getWeaponItemBase(false) != null) {
|
} else if (mob.getWeaponItemBase(false) != null) {
|
||||||
int attackDelay = 3000;
|
int attackDelay = 3000;
|
||||||
if (mob.isSiege())
|
if (mob.isSiege())
|
||||||
attackDelay = 11000;
|
attackDelay = 11000;
|
||||||
FinalCombatManager.combatCycle(mob, target);
|
CombatManager.combatCycle(mob, target);
|
||||||
mob.setLastAttackTime(System.currentTimeMillis() + attackDelay);
|
mob.setLastAttackTime(System.currentTimeMillis() + attackDelay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -179,7 +179,7 @@ public class MobAI {
|
|||||||
ItemBase offHand = mob.getWeaponItemBase(false);
|
ItemBase offHand = mob.getWeaponItemBase(false);
|
||||||
|
|
||||||
if (mainHand == null && offHand == null) {
|
if (mainHand == null && offHand == null) {
|
||||||
FinalCombatManager.combatCycle(mob, target);
|
CombatManager.combatCycle(mob, target);
|
||||||
int delay = 3000;
|
int delay = 3000;
|
||||||
if (mob.isSiege())
|
if (mob.isSiege())
|
||||||
delay = 15000;
|
delay = 15000;
|
||||||
@@ -188,13 +188,13 @@ public class MobAI {
|
|||||||
int attackDelay = 3000;
|
int attackDelay = 3000;
|
||||||
if (mob.isSiege())
|
if (mob.isSiege())
|
||||||
attackDelay = 15000;
|
attackDelay = 15000;
|
||||||
FinalCombatManager.combatCycle(mob, target);
|
CombatManager.combatCycle(mob, target);
|
||||||
mob.setLastAttackTime(System.currentTimeMillis() + attackDelay);
|
mob.setLastAttackTime(System.currentTimeMillis() + attackDelay);
|
||||||
} else if (mob.getWeaponItemBase(false) != null) {
|
} else if (mob.getWeaponItemBase(false) != null) {
|
||||||
int attackDelay = 3000;
|
int attackDelay = 3000;
|
||||||
if (mob.isSiege())
|
if (mob.isSiege())
|
||||||
attackDelay = 15000;
|
attackDelay = 15000;
|
||||||
FinalCombatManager.combatCycle(mob, target);
|
CombatManager.combatCycle(mob, target);
|
||||||
mob.setLastAttackTime(System.currentTimeMillis() + attackDelay);
|
mob.setLastAttackTime(System.currentTimeMillis() + attackDelay);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,7 +222,7 @@ public class MobAI {
|
|||||||
ItemBase offHand = mob.getWeaponItemBase(false);
|
ItemBase offHand = mob.getWeaponItemBase(false);
|
||||||
|
|
||||||
if (mainHand == null && offHand == null) {
|
if (mainHand == null && offHand == null) {
|
||||||
FinalCombatManager.combatCycle(mob, target);
|
CombatManager.combatCycle(mob, target);
|
||||||
int delay = 3000;
|
int delay = 3000;
|
||||||
if (mob.isSiege())
|
if (mob.isSiege())
|
||||||
delay = 11000;
|
delay = 11000;
|
||||||
@@ -231,13 +231,13 @@ public class MobAI {
|
|||||||
int attackDelay = 3000;
|
int attackDelay = 3000;
|
||||||
if (mob.isSiege())
|
if (mob.isSiege())
|
||||||
attackDelay = 11000;
|
attackDelay = 11000;
|
||||||
FinalCombatManager.combatCycle(mob, target);
|
CombatManager.combatCycle(mob, target);
|
||||||
mob.setLastAttackTime(System.currentTimeMillis() + attackDelay);
|
mob.setLastAttackTime(System.currentTimeMillis() + attackDelay);
|
||||||
} else if (mob.getWeaponItemBase(false) != null) {
|
} else if (mob.getWeaponItemBase(false) != null) {
|
||||||
int attackDelay = 3000;
|
int attackDelay = 3000;
|
||||||
if (mob.isSiege())
|
if (mob.isSiege())
|
||||||
attackDelay = 11000;
|
attackDelay = 11000;
|
||||||
FinalCombatManager.combatCycle(mob, target);
|
CombatManager.combatCycle(mob, target);
|
||||||
mob.setLastAttackTime(System.currentTimeMillis() + attackDelay);
|
mob.setLastAttackTime(System.currentTimeMillis() + attackDelay);
|
||||||
if (target.getCombatTarget() == null) {
|
if (target.getCombatTarget() == null) {
|
||||||
target.setCombatTarget(mob);
|
target.setCombatTarget(mob);
|
||||||
|
|||||||
@@ -1445,10 +1445,10 @@ public class ClientMessagePump implements NetMsgHandler {
|
|||||||
social((SocialMsg) msg, origin);
|
social((SocialMsg) msg, origin);
|
||||||
break;
|
break;
|
||||||
case COMBATMODE:
|
case COMBATMODE:
|
||||||
FinalCombatManager.toggleCombat(((ToggleCombatMsg) msg).toggleCombat(),origin);
|
CombatManager.toggleCombat(((ToggleCombatMsg) msg).toggleCombat(), origin);
|
||||||
break;
|
break;
|
||||||
case ARCCOMBATMODEATTACKING:
|
case ARCCOMBATMODEATTACKING:
|
||||||
FinalCombatManager.toggleCombat(((SetCombatModeMsg) msg).getToggle(),origin);
|
CombatManager.toggleCombat(((SetCombatModeMsg) msg).getToggle(), origin);
|
||||||
break;
|
break;
|
||||||
case MODIFYGUILDSTATE:
|
case MODIFYGUILDSTATE:
|
||||||
ToggleLfgRecruitingMsg tlrm = (ToggleLfgRecruitingMsg) msg;
|
ToggleLfgRecruitingMsg tlrm = (ToggleLfgRecruitingMsg) msg;
|
||||||
|
|||||||
@@ -3,12 +3,15 @@ package engine.net.client.handlers;
|
|||||||
import engine.Enum;
|
import engine.Enum;
|
||||||
import engine.exception.MsgSendException;
|
import engine.exception.MsgSendException;
|
||||||
import engine.gameManager.BuildingManager;
|
import engine.gameManager.BuildingManager;
|
||||||
import engine.gameManager.FinalCombatManager;
|
import engine.gameManager.CombatManager;
|
||||||
import engine.net.client.ClientConnection;
|
import engine.net.client.ClientConnection;
|
||||||
import engine.net.client.msg.AttackCmdMsg;
|
import engine.net.client.msg.AttackCmdMsg;
|
||||||
import engine.net.client.msg.ClientNetMsg;
|
import engine.net.client.msg.ClientNetMsg;
|
||||||
import engine.net.client.msg.TargetedActionMsg;
|
import engine.net.client.msg.TargetedActionMsg;
|
||||||
import engine.objects.*;
|
import engine.objects.AbstractWorldObject;
|
||||||
|
import engine.objects.Mob;
|
||||||
|
import engine.objects.NPC;
|
||||||
|
import engine.objects.PlayerCharacter;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @Author:
|
* @Author:
|
||||||
@@ -72,14 +75,14 @@ public class AttackCmdMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
if (!playerCharacter.isCombat()) {
|
if (!playerCharacter.isCombat()) {
|
||||||
//CombatManager.toggleCombat(true, origin);
|
//CombatManager.toggleCombat(true, origin);
|
||||||
FinalCombatManager.toggleCombat(true,origin);
|
CombatManager.toggleCombat(true, origin);
|
||||||
}
|
}
|
||||||
//make character stand if sitting
|
//make character stand if sitting
|
||||||
|
|
||||||
if (playerCharacter.isSit())
|
if (playerCharacter.isSit())
|
||||||
FinalCombatManager.toggleSit(false, origin);
|
CombatManager.toggleSit(false, origin);
|
||||||
|
|
||||||
FinalCombatManager.combatCycle(playerCharacter,target);
|
CombatManager.combatCycle(playerCharacter, target);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1328,7 +1328,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
//TODO why is Handle REtaliate and cancelontakedamage in modifyHealth? shouldnt this be outside this method?
|
//TODO why is Handle REtaliate and cancelontakedamage in modifyHealth? shouldnt this be outside this method?
|
||||||
if (value < 0f && !fromCost) {
|
if (value < 0f && !fromCost) {
|
||||||
this.cancelOnTakeDamage();
|
this.cancelOnTakeDamage();
|
||||||
FinalCombatManager.handleRetaliate(this, attacker);
|
CombatManager.handleRetaliate(this, attacker);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.getObjectType().equals(GameObjectType.Mob)){
|
if(this.getObjectType().equals(GameObjectType.Mob)){
|
||||||
@@ -1395,7 +1395,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
}
|
}
|
||||||
if (value < 0f && !fromCost) {
|
if (value < 0f && !fromCost) {
|
||||||
this.cancelOnTakeDamage();
|
this.cancelOnTakeDamage();
|
||||||
FinalCombatManager.handleRetaliate(this, attacker);
|
CombatManager.handleRetaliate(this, attacker);
|
||||||
}
|
}
|
||||||
return newMana - oldMana;
|
return newMana - oldMana;
|
||||||
}
|
}
|
||||||
@@ -1434,7 +1434,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
}
|
}
|
||||||
if (value < 0f && !fromCost) {
|
if (value < 0f && !fromCost) {
|
||||||
this.cancelOnTakeDamage();
|
this.cancelOnTakeDamage();
|
||||||
FinalCombatManager.handleRetaliate(this, attacker);
|
CombatManager.handleRetaliate(this, attacker);
|
||||||
}
|
}
|
||||||
return newStamina - oldStamina;
|
return newStamina - oldStamina;
|
||||||
}
|
}
|
||||||
@@ -1469,7 +1469,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
}
|
}
|
||||||
if (oldMana > newMana && !fromCost) {
|
if (oldMana > newMana && !fromCost) {
|
||||||
this.cancelOnTakeDamage();
|
this.cancelOnTakeDamage();
|
||||||
FinalCombatManager.handleRetaliate(this, attacker);
|
CombatManager.handleRetaliate(this, attacker);
|
||||||
}
|
}
|
||||||
return newMana - oldMana;
|
return newMana - oldMana;
|
||||||
}
|
}
|
||||||
@@ -1504,7 +1504,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
}
|
}
|
||||||
if (oldStamina > newStamina && !fromCost) {
|
if (oldStamina > newStamina && !fromCost) {
|
||||||
this.cancelOnTakeDamage();
|
this.cancelOnTakeDamage();
|
||||||
FinalCombatManager.handleRetaliate(this, attacker);
|
CombatManager.handleRetaliate(this, attacker);
|
||||||
}
|
}
|
||||||
return newStamina - oldStamina;
|
return newStamina - oldStamina;
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ package engine.powers.poweractions;
|
|||||||
import engine.Enum;
|
import engine.Enum;
|
||||||
import engine.Enum.ItemType;
|
import engine.Enum.ItemType;
|
||||||
import engine.gameManager.ChatManager;
|
import engine.gameManager.ChatManager;
|
||||||
import engine.gameManager.FinalCombatManager;
|
import engine.gameManager.CombatManager;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
import engine.net.Dispatch;
|
import engine.net.Dispatch;
|
||||||
import engine.net.DispatchMessage;
|
import engine.net.DispatchMessage;
|
||||||
@@ -132,7 +132,7 @@ public class StealPowerAction extends AbstractPowerAction {
|
|||||||
ownerPC.setLastPlayerAttackTime();
|
ownerPC.setLastPlayerAttackTime();
|
||||||
|
|
||||||
//Handle target attacking back if in combat and has no other target
|
//Handle target attacking back if in combat and has no other target
|
||||||
FinalCombatManager.handleRetaliate(ownerAC, sourcePlayer);
|
CombatManager.handleRetaliate(ownerAC, sourcePlayer);
|
||||||
|
|
||||||
} else
|
} else
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user