forked from MagicBane/Server
Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c0cd365c1d | |||
| ee5620036d | |||
| 8ff06b1200 | |||
| a348056c86 | |||
| 1c10f8a872 | |||
| 4f28fefbc2 | |||
| 9ff7e07545 | |||
| d5809fc4b1 | |||
| 0c00832264 | |||
| 300452d2d8 | |||
| 9a9ea99bc7 | |||
| d9ab1032f4 | |||
| c2ea4424cf | |||
| b22c07b000 | |||
| 8e70e0597e | |||
| cf58e7b984 | |||
| ba81a24622 | |||
| 007299eae5 | |||
| 5f92345d3e |
@@ -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.Vector3f;
|
|
||||||
import engine.mbEnums;
|
import engine.mbEnums;
|
||||||
import engine.net.client.ClientConnection;
|
import engine.net.client.ClientConnection;
|
||||||
import engine.net.client.msg.TargetedActionMsg;
|
import engine.net.client.msg.TargetedActionMsg;
|
||||||
@@ -48,7 +47,7 @@ public enum CombatManager {
|
|||||||
public static final int COMBAT_PARRY_ANIMATION = 299;
|
public static final int COMBAT_PARRY_ANIMATION = 299;
|
||||||
public static final int COMBAT_DODGE_ANIMATION = 300;
|
public static final int COMBAT_DODGE_ANIMATION = 300;
|
||||||
|
|
||||||
public static void combatCycle(AbstractCharacter attacker, AbstractWorldObject target) {
|
public static void combatCycle(AbstractCharacter attacker, AbstractWorldObject target, long addedDelay) {
|
||||||
|
|
||||||
//early exit checks
|
//early exit checks
|
||||||
|
|
||||||
@@ -79,61 +78,58 @@ public enum CombatManager {
|
|||||||
|
|
||||||
if (mainWeapon == null && offWeapon == null) {
|
if (mainWeapon == null && offWeapon == null) {
|
||||||
//no weapons equipped, punch with both fists
|
//no weapons equipped, punch with both fists
|
||||||
processAttack(attacker, target, mbEnums.EquipSlotType.RHELD);
|
processAttack(attacker, target, mbEnums.EquipSlotType.RHELD,addedDelay);
|
||||||
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,addedDelay);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mainWeapon != null && offWeapon == null) {
|
if (mainWeapon != null && offWeapon == null) {
|
||||||
//swing right hand only
|
//swing right hand only
|
||||||
processAttack(attacker, target, mbEnums.EquipSlotType.RHELD);
|
processAttack(attacker, target, mbEnums.EquipSlotType.RHELD,addedDelay);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mainWeapon == null && offWeapon != null && !offWeapon.template.item_skill_used.equals("Block")) {
|
if (mainWeapon == null && offWeapon != null && !offWeapon.template.item_skill_used.equals("Block")) {
|
||||||
//swing left hand only
|
//swing left hand only
|
||||||
processAttack(attacker, target, mbEnums.EquipSlotType.LHELD);
|
processAttack(attacker, target, mbEnums.EquipSlotType.LHELD,addedDelay);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mainWeapon == null && offWeapon != null && offWeapon.template.item_skill_used.equals("Block")) {
|
if (mainWeapon == null && offWeapon != null && offWeapon.template.item_skill_used.equals("Block")) {
|
||||||
//no weapon equipped with a shield, punch with one hand
|
//no weapon equipped with a shield, punch with one hand
|
||||||
processAttack(attacker, target, mbEnums.EquipSlotType.RHELD);
|
processAttack(attacker, target, mbEnums.EquipSlotType.RHELD,addedDelay);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mainWeapon != null && offWeapon != null && offWeapon.template.item_skill_used.equals("Block")) {
|
if (mainWeapon != null && offWeapon != null && offWeapon.template.item_skill_used.equals("Block")) {
|
||||||
//one weapon equipped with a shield, swing with one hand
|
//one weapon equipped with a shield, swing with one hand
|
||||||
processAttack(attacker, target, mbEnums.EquipSlotType.RHELD);
|
processAttack(attacker, target, mbEnums.EquipSlotType.RHELD,addedDelay);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mainWeapon != null && offWeapon != null && !offWeapon.template.item_skill_used.equals("Block")) {
|
if (mainWeapon != null && offWeapon != null && !offWeapon.template.item_skill_used.equals("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,addedDelay);
|
||||||
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,addedDelay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void processAttack(AbstractCharacter attacker, AbstractWorldObject target, mbEnums.EquipSlotType slot) {
|
public static void processAttack(AbstractCharacter attacker, AbstractWorldObject target, mbEnums.EquipSlotType slot, long addedDelay) {
|
||||||
|
|
||||||
|
if (slot == null || target == null || attacker == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if (attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)) {
|
if (attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)) {
|
||||||
if (!attacker.isCombat())
|
if (!attacker.isCombat())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//check if this slot is on attack timer, if timer has passed clear it, else early exit
|
|
||||||
if(attacker.getTimers() != null && attacker.getTimers().containsKey("Attack"+slot.name()))
|
|
||||||
if(attacker.getTimers().get("Attack"+slot.name()).timeToExecutionLeft() <= 0)
|
|
||||||
attacker.getTimers().remove("Attack"+slot.name());
|
|
||||||
else
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
target.combatLock.writeLock().lock();
|
||||||
|
|
||||||
// check if character is in range to attack target
|
// check if character is in range to attack target
|
||||||
|
try {
|
||||||
PlayerBonuses bonus = attacker.getBonuses();
|
PlayerBonuses bonus = attacker.getBonuses();
|
||||||
|
|
||||||
float rangeMod = 1.0f;
|
float rangeMod = 1.0f;
|
||||||
@@ -158,10 +154,13 @@ public enum CombatManager {
|
|||||||
if (AbstractCharacter.IsAbstractCharacter(target)) {
|
if (AbstractCharacter.IsAbstractCharacter(target)) {
|
||||||
attackRange += ((AbstractCharacter) target).calcHitBox();
|
attackRange += ((AbstractCharacter) target).calcHitBox();
|
||||||
} else {
|
} else {
|
||||||
|
//need to handle building attacks range calculations here
|
||||||
}
|
}
|
||||||
|
|
||||||
if(attackRange > 15 && attacker.isMoving()){
|
attackRange += 4; // need to add 4 to the attack range to offset where the client stops short of legitimate range
|
||||||
|
|
||||||
|
float distance = target.loc.distance(attacker.loc);
|
||||||
|
if (attackRange > 25 && attacker.isMoving()) {
|
||||||
//cannot shoot bow while moving;
|
//cannot shoot bow while moving;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -200,25 +199,33 @@ public enum CombatManager {
|
|||||||
//get delay for the auto attack job
|
//get delay for the auto attack job
|
||||||
long delay = 5000;
|
long delay = 5000;
|
||||||
|
|
||||||
if (weapon != null) {
|
//if (weapon != null) {
|
||||||
|
|
||||||
int wepSpeed = (int) (weapon.template.item_weapon_wepspeed);
|
// int wepSpeed = (int) (weapon.template.item_weapon_wepspeed);
|
||||||
|
|
||||||
if (weapon.getBonusPercent(mbEnums.ModType.WeaponSpeed, mbEnums.SourceType.None) != 0f) //add weapon speed bonus
|
// if (weapon.getBonusPercent(mbEnums.ModType.WeaponSpeed, mbEnums.SourceType.None) != 0f) //add weapon speed bonus
|
||||||
wepSpeed *= (1 + weapon.getBonus(mbEnums.ModType.WeaponSpeed, mbEnums.SourceType.None));
|
// wepSpeed *= (1 + weapon.getBonus(mbEnums.ModType.WeaponSpeed, mbEnums.SourceType.None));
|
||||||
|
|
||||||
if (attacker.getBonuses() != null && attacker.getBonuses().getFloatPercentAll(mbEnums.ModType.AttackDelay, mbEnums.SourceType.None) != 0f) //add effects speed bonus
|
// if (attacker.getBonuses() != null && attacker.getBonuses().getFloatPercentAll(mbEnums.ModType.AttackDelay, mbEnums.SourceType.None) != 0f) //add effects speed bonus
|
||||||
wepSpeed *= (1 + attacker.getBonuses().getFloatPercentAll(mbEnums.ModType.AttackDelay, mbEnums.SourceType.None));
|
// wepSpeed *= (1 + attacker.getBonuses().getFloatPercentAll(mbEnums.ModType.AttackDelay, mbEnums.SourceType.None));
|
||||||
|
|
||||||
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 * 100L;
|
// delay = wepSpeed * 100L;
|
||||||
|
//}
|
||||||
|
|
||||||
|
if(attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)){
|
||||||
|
if(slot.equals(mbEnums.EquipSlotType.RHELD)){
|
||||||
|
delay = (long)(attacker.speedHandOne * 100L);
|
||||||
|
}else{
|
||||||
|
delay = (long)(attacker.speedHandTwo * 100L);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attacker.getObjectType().equals(mbEnums.GameObjectType.Mob))
|
if (attacker.getObjectType().equals(mbEnums.GameObjectType.Mob))
|
||||||
((Mob) attacker).nextAttackTime = System.currentTimeMillis() + delay;
|
((Mob) attacker).nextAttackTime = System.currentTimeMillis() + delay;
|
||||||
|
delay += addedDelay;
|
||||||
if (inRange) {
|
if (inRange) {
|
||||||
|
|
||||||
//handle retaliate
|
//handle retaliate
|
||||||
@@ -226,7 +233,7 @@ public enum CombatManager {
|
|||||||
if (((AbstractCharacter) target).combatTarget == null || !((AbstractCharacter) target).combatTarget.isAlive()) {
|
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,0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -440,7 +447,9 @@ public enum CombatManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//calculate resisted damage including fortitude
|
//calculate resisted damage including fortitude
|
||||||
|
if(attacker.getObjectType().equals(mbEnums.GameObjectType.Mob))
|
||||||
|
if(((Mob)attacker).isPet())
|
||||||
|
damage *= attacker.level * 0.1f;
|
||||||
damage = (int) resists.getResistedDamage(attacker, (AbstractCharacter) target, damageType, damage, 0);
|
damage = (int) resists.getResistedDamage(attacker, (AbstractCharacter) target, damageType, damage, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -470,7 +479,12 @@ public enum CombatManager {
|
|||||||
|
|
||||||
//set auto attack job
|
//set auto attack job
|
||||||
setAutoAttackJob(attacker, slot, delay);
|
setAutoAttackJob(attacker, slot, delay);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
cancelAutoAttackJob(attacker,slot);
|
||||||
|
//Logger.error("COMBAT CAUGHT ERROR: " + ex.getMessage());
|
||||||
|
} finally {
|
||||||
|
target.combatLock.writeLock().unlock();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleCombat(boolean toggle, ClientConnection origin) {
|
public static void toggleCombat(boolean toggle, ClientConnection origin) {
|
||||||
@@ -604,6 +618,9 @@ public enum CombatManager {
|
|||||||
public static void setAutoAttackJob(AbstractCharacter attacker, mbEnums.EquipSlotType slot, long delay) {
|
public static void setAutoAttackJob(AbstractCharacter attacker, mbEnums.EquipSlotType slot, long delay) {
|
||||||
//calculate next allowed attack and update the timestamp
|
//calculate next allowed attack and update the timestamp
|
||||||
|
|
||||||
|
if(attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter) == false)
|
||||||
|
return; //mobs dont submit auto attack jobs
|
||||||
|
|
||||||
if(attacker.getTimestamps().containsKey("Attack" + slot.name()) && attacker.getTimestamps().get("Attack" + slot.name()) > System.currentTimeMillis())
|
if(attacker.getTimestamps().containsKey("Attack" + slot.name()) && attacker.getTimestamps().get("Attack" + slot.name()) > System.currentTimeMillis())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -613,7 +630,7 @@ public enum CombatManager {
|
|||||||
ConcurrentHashMap<String, JobContainer> timers = attacker.getTimers();
|
ConcurrentHashMap<String, JobContainer> timers = attacker.getTimers();
|
||||||
|
|
||||||
if (timers != null) {
|
if (timers != null) {
|
||||||
AttackJob aj = new AttackJob(attacker, slot.ordinal(), true);
|
AttackJob aj = new AttackJob(attacker, slot.ordinal(), true, attacker.getCombatTarget());
|
||||||
JobContainer job;
|
JobContainer job;
|
||||||
job = JobScheduler.getInstance().scheduleJob(aj, (System.currentTimeMillis() + delay)); // offset 1 millisecond so no overlap issue
|
job = JobScheduler.getInstance().scheduleJob(aj, (System.currentTimeMillis() + delay)); // offset 1 millisecond so no overlap issue
|
||||||
timers.put("Attack" + slot.name(), job);
|
timers.put("Attack" + slot.name(), job);
|
||||||
@@ -621,7 +638,22 @@ public enum CombatManager {
|
|||||||
Logger.error("Unable to find Timers for Character " + attacker.getObjectUUID());
|
Logger.error("Unable to find Timers for Character " + attacker.getObjectUUID());
|
||||||
|
|
||||||
}
|
}
|
||||||
public static int calculatePetDamage(AbstractCharacter agent) {
|
public static void cancelAutoAttackJob(AbstractCharacter attacker, mbEnums.EquipSlotType slot) {
|
||||||
|
|
||||||
|
if(attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter) == false)
|
||||||
|
return;
|
||||||
|
attacker.getTimestamps().put("Attack" + slot.name(), System.currentTimeMillis());
|
||||||
|
|
||||||
|
//handle auto attack job creation
|
||||||
|
ConcurrentHashMap<String, JobContainer> timers = attacker.getTimers();
|
||||||
|
|
||||||
|
if (timers != null) {
|
||||||
|
timers.get("Attack" + slot.name()).cancelJob();
|
||||||
|
} else
|
||||||
|
Logger.error("Unable to find Timers for Character " + attacker.getObjectUUID());
|
||||||
|
|
||||||
|
}
|
||||||
|
public static void calculatePetDamage(AbstractCharacter agent) {
|
||||||
//damage calc for pet
|
//damage calc for pet
|
||||||
float range;
|
float range;
|
||||||
float damage;
|
float damage;
|
||||||
@@ -633,7 +665,6 @@ public enum CombatManager {
|
|||||||
dmgMultiplier += agent.getLevel() * 0.1f;
|
dmgMultiplier += agent.getLevel() * 0.1f;
|
||||||
range = (float) (maxDmg - minDmg);
|
range = (float) (maxDmg - minDmg);
|
||||||
damage = min + ((ThreadLocalRandom.current().nextFloat() * range) + (ThreadLocalRandom.current().nextFloat() * range)) / 2;
|
damage = min + ((ThreadLocalRandom.current().nextFloat() * range) + (ThreadLocalRandom.current().nextFloat() * range)) / 2;
|
||||||
return (int) (damage * dmgMultiplier);
|
|
||||||
}
|
}
|
||||||
public static double getMinDmg(double min, AbstractCharacter agent) {
|
public static double getMinDmg(double min, AbstractCharacter agent) {
|
||||||
int primary = agent.getStatStrCurrent();
|
int primary = agent.getStatStrCurrent();
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ public enum PowersManager {
|
|||||||
public static void usePower(final PerformActionMsg msg, ClientConnection origin,
|
public static void usePower(final PerformActionMsg msg, ClientConnection origin,
|
||||||
boolean sendCastToSelf) {
|
boolean sendCastToSelf) {
|
||||||
|
|
||||||
if (ConfigManager.MB_RULESET.getValue().equals("LORE")) {
|
if (ConfigManager.MB_RULESET.getValue().equals("LORE") && getPowerByToken(msg.getPowerUsedID()).ignoreLore() == false) {
|
||||||
PowersBase pb = PowersManager.powersBaseByToken.get(msg.getPowerUsedID());
|
PowersBase pb = PowersManager.powersBaseByToken.get(msg.getPowerUsedID());
|
||||||
PlayerCharacter caster = origin.getPlayerCharacter();
|
PlayerCharacter caster = origin.getPlayerCharacter();
|
||||||
PlayerCharacter target = PlayerCharacter.getFromCache(msg.getTargetID());
|
PlayerCharacter target = PlayerCharacter.getFromCache(msg.getTargetID());
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ package engine.jobs;
|
|||||||
import engine.gameManager.CombatManager;
|
import engine.gameManager.CombatManager;
|
||||||
import engine.job.AbstractJob;
|
import engine.job.AbstractJob;
|
||||||
import engine.objects.AbstractCharacter;
|
import engine.objects.AbstractCharacter;
|
||||||
|
import engine.objects.AbstractWorldObject;
|
||||||
|
|
||||||
public class AttackJob extends AbstractJob {
|
public class AttackJob extends AbstractJob {
|
||||||
|
|
||||||
@@ -19,16 +20,20 @@ public class AttackJob extends AbstractJob {
|
|||||||
private final int slot;
|
private final int slot;
|
||||||
private final boolean success;
|
private final boolean success;
|
||||||
|
|
||||||
public AttackJob(AbstractCharacter source, int slot, boolean success) {
|
public final AbstractWorldObject target;
|
||||||
|
|
||||||
|
public AttackJob(AbstractCharacter source, int slot, boolean success, AbstractWorldObject target) {
|
||||||
super();
|
super();
|
||||||
this.source = source;
|
this.source = source;
|
||||||
this.slot = slot;
|
this.slot = slot;
|
||||||
this.success = success;
|
this.success = success;
|
||||||
|
this.target = target;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doJob() {
|
protected void doJob() {
|
||||||
CombatManager.combatCycle(this.source, this.source.combatTarget);
|
|
||||||
|
CombatManager.combatCycle(this.source,target,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean success() {
|
public boolean success() {
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ public class MobAI {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mob.behaviourType.callsForHelp)
|
if (mob.behaviourType != null && mob.behaviourType.callsForHelp)
|
||||||
mobCallForHelp(mob);
|
mobCallForHelp(mob);
|
||||||
|
|
||||||
if (!MovementUtilities.inRangeDropAggro(mob, target)) {
|
if (!MovementUtilities.inRangeDropAggro(mob, target)) {
|
||||||
@@ -125,7 +125,7 @@ public class MobAI {
|
|||||||
if (mob.isMoving() && mob.getRange() > 20)
|
if (mob.isMoving() && mob.getRange() > 20)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CombatManager.combatCycle(mob, target);
|
CombatManager.combatCycle(mob, target,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target.getPet() != null)
|
if (target.getPet() != null)
|
||||||
@@ -159,7 +159,7 @@ public class MobAI {
|
|||||||
MovementManager.sendRWSSMsg(mob);
|
MovementManager.sendRWSSMsg(mob);
|
||||||
|
|
||||||
|
|
||||||
CombatManager.combatCycle(mob, target);
|
CombatManager.combatCycle(mob, target,0);
|
||||||
|
|
||||||
if (mob.isSiege()) {
|
if (mob.isSiege()) {
|
||||||
PowerProjectileMsg ppm = new PowerProjectileMsg(mob, target);
|
PowerProjectileMsg ppm = new PowerProjectileMsg(mob, target);
|
||||||
@@ -183,7 +183,7 @@ public class MobAI {
|
|||||||
|
|
||||||
//no weapons, default mob attack speed 3 seconds.
|
//no weapons, default mob attack speed 3 seconds.
|
||||||
|
|
||||||
CombatManager.combatCycle(mob, target);
|
CombatManager.combatCycle(mob, target,0);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: AttackMob" + " " + e.getMessage());
|
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: AttackMob" + " " + e.getMessage());
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package engine.net.client.handlers;
|
|||||||
|
|
||||||
import engine.gameManager.BuildingManager;
|
import engine.gameManager.BuildingManager;
|
||||||
import engine.gameManager.CombatManager;
|
import engine.gameManager.CombatManager;
|
||||||
|
import engine.jobs.AttackJob;
|
||||||
import engine.mbEnums;
|
import engine.mbEnums;
|
||||||
import engine.net.client.ClientConnection;
|
import engine.net.client.ClientConnection;
|
||||||
import engine.net.client.msg.AttackCmdMsg;
|
import engine.net.client.msg.AttackCmdMsg;
|
||||||
@@ -82,7 +83,29 @@ public class AttackCmdMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (playerCharacter.isSit())
|
if (playerCharacter.isSit())
|
||||||
CombatManager.toggleSit(false, origin);
|
CombatManager.toggleSit(false, origin);
|
||||||
|
|
||||||
CombatManager.combatCycle(playerCharacter, target);
|
long addedDelay = 0;
|
||||||
|
//check if we are changing targets, cancel outstanding jobs if so
|
||||||
|
if (playerCharacter.getTimers().containsKey("Attack" + mbEnums.EquipSlotType.RHELD)) {
|
||||||
|
AttackJob ajR = ((AttackJob)playerCharacter.getTimers().get("Attack" + mbEnums.EquipSlotType.RHELD).getJob());
|
||||||
|
if(ajR.target != null && !ajR.target.equals(target)){
|
||||||
|
playerCharacter.getTimers().get("Attack" + mbEnums.EquipSlotType.RHELD).cancelJob();
|
||||||
|
addedDelay = ajR.getStopTime() - System.currentTimeMillis();
|
||||||
|
}else{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (playerCharacter.getTimers().containsKey("Attack" + mbEnums.EquipSlotType.LHELD)) {
|
||||||
|
AttackJob ajL = ((AttackJob)playerCharacter.getTimers().get("Attack" + mbEnums.EquipSlotType.LHELD).getJob());
|
||||||
|
if(ajL.target != null && !ajL.target.equals(target)){
|
||||||
|
playerCharacter.getTimers().get("Attack" + mbEnums.EquipSlotType.LHELD).cancelJob();
|
||||||
|
addedDelay = ajL.getStopTime() - System.currentTimeMillis();
|
||||||
|
}else{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CombatManager.combatCycle(playerCharacter, target, addedDelay);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1787,7 +1787,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
final boolean fromCost) {
|
final boolean fromCost) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
this.combatLock.writeLock().lock();
|
||||||
try {
|
try {
|
||||||
boolean ready = this.healthLock.writeLock().tryLock(1, TimeUnit.SECONDS);
|
boolean ready = this.healthLock.writeLock().tryLock(1, TimeUnit.SECONDS);
|
||||||
|
|
||||||
@@ -1852,6 +1852,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
return newHealth - oldHealth;
|
return newHealth - oldHealth;
|
||||||
} finally {
|
} finally {
|
||||||
this.healthLock.writeLock().unlock();
|
this.healthLock.writeLock().unlock();
|
||||||
|
this.combatLock.writeLock().unlock();
|
||||||
}
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ public abstract class AbstractWorldObject extends AbstractGameObject {
|
|||||||
private Vector3f rot = new Vector3f(0.0f, 0.0f, 0.0f);
|
private Vector3f rot = new Vector3f(0.0f, 0.0f, 0.0f);
|
||||||
private int objectTypeMask = 0;
|
private int objectTypeMask = 0;
|
||||||
private Bounds bounds;
|
private Bounds bounds;
|
||||||
|
public ReentrantReadWriteLock combatLock = new ReentrantReadWriteLock();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No Id Constructor
|
* No Id Constructor
|
||||||
|
|||||||
@@ -410,10 +410,9 @@ public class City extends AbstractWorldObject {
|
|||||||
if(city.cityName.equals("Perdition") || city.cityName.equals("Bastion"))
|
if(city.cityName.equals("Perdition") || city.cityName.equals("Bastion"))
|
||||||
continue; // cannot repledge to perdition or bastion
|
continue; // cannot repledge to perdition or bastion
|
||||||
if (city.isNpc == 1 && city.getGuild().charter.canJoin(playerCharacter)) {
|
if (city.isNpc == 1 && city.getGuild().charter.canJoin(playerCharacter)) {
|
||||||
cities.add(city); // anyone of the same charter can teleport to a safehold of that charter
|
if(city.isNoobIsle == 1 && playerCharacter.level >= 21)
|
||||||
continue;
|
continue;
|
||||||
} else if (city.isNoobIsle == 1 && playerCharacter.level <= 20) {
|
cities.add(city); // anyone of the same charter can teleport to a safehold of that charter
|
||||||
cities.add(city); // everyone can go to noob island if they are under level 20
|
|
||||||
continue;
|
continue;
|
||||||
} else if (city.isOpen() && city.getTOL().rank > 4 && city.getGuild().charter.canJoin(playerCharacter))
|
} else if (city.isOpen() && city.getTOL().rank > 4 && city.getGuild().charter.canJoin(playerCharacter))
|
||||||
if (!city.getTOL().reverseKOS) {
|
if (!city.getTOL().reverseKOS) {
|
||||||
@@ -640,17 +639,17 @@ public class City extends AbstractWorldObject {
|
|||||||
public Guild getGuild() {
|
public Guild getGuild() {
|
||||||
|
|
||||||
if (this.getTOL() == null)
|
if (this.getTOL() == null)
|
||||||
return null;
|
return Guild.getErrantGuild();
|
||||||
|
|
||||||
if (this.isNpc == 1) {
|
if (this.isNpc == 1) {
|
||||||
|
|
||||||
if (this.getTOL().getOwner() == null)
|
if (this.getTOL().getOwner() == null)
|
||||||
return null;
|
return Guild.getErrantGuild();
|
||||||
return this.getTOL().getOwner().getGuild();
|
return this.getTOL().getOwner().getGuild();
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (this.getTOL().getOwner() == null)
|
if (this.getTOL().getOwner() == null)
|
||||||
return null;
|
return Guild.getErrantGuild();
|
||||||
return this.getTOL().getOwner().getGuild();
|
return this.getTOL().getOwner().getGuild();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -633,4 +633,15 @@ public class PowersBase {
|
|||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean ignoreLore(){
|
||||||
|
switch(this.category){
|
||||||
|
case "HEAL":
|
||||||
|
case "BUFF":
|
||||||
|
case "DISPELL":
|
||||||
|
case "SUMMON":
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user