Compare commits

...

6 Commits

4 changed files with 54 additions and 19 deletions
+24 -16
View File
@@ -124,7 +124,7 @@ public enum CombatManager {
return; return;
//check if this slot is on attack timer, if timer has passed clear it, else early exit //check if this slot is on attack timer, if timer has passed clear it, else early exit
if(attacker.getTimers().containsKey("Attack"+slot.name())) if(attacker.getTimers() != null && attacker.getTimers().containsKey("Attack"+slot.name()))
if(attacker.getTimers().get("Attack"+slot.name()).timeToExecutionLeft() <= 0) if(attacker.getTimers().get("Attack"+slot.name()).timeToExecutionLeft() <= 0)
attacker.getTimers().remove("Attack"+slot.name()); attacker.getTimers().remove("Attack"+slot.name());
else else
@@ -264,6 +264,22 @@ public enum CombatManager {
atr = attacker.atrHandTwo; atr = attacker.atrHandTwo;
} }
//apply weapon powers before early exit for miss or passives
DeferredPowerJob dpj = null;
if (attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)) {
dpj = ((PlayerCharacter) attacker).getWeaponPower();
if (dpj != null) {
dpj.attack(target, attackRange);
if (dpj.getPower() != null && (dpj.getPowerToken() == -1851459567 || dpj.getPowerToken() == -1851489518))
((PlayerCharacter) attacker).setWeaponPower(dpj);
}
}
int def = 0; int def = 0;
if (AbstractCharacter.IsAbstractCharacter(target)) if (AbstractCharacter.IsAbstractCharacter(target))
@@ -332,6 +348,9 @@ public enum CombatManager {
if (target.getObjectType() == mbEnums.GameObjectType.PlayerCharacter) if (target.getObjectType() == mbEnums.GameObjectType.PlayerCharacter)
DispatchManager.dispatchMsgToInterestArea(target, msg, mbEnums.DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false); DispatchManager.dispatchMsgToInterestArea(target, msg, mbEnums.DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
//we need to send the animation even if the attacker misses
TargetedActionMsg cmm = new TargetedActionMsg(attacker, target, (float) 0, getSwingAnimation(weapon.template,null,slot));
DispatchManager.sendToAllInRange(target, cmm);
//set auto attack job //set auto attack job
setAutoAttackJob(attacker, slot, delay); setAutoAttackJob(attacker, slot, delay);
return; return;
@@ -414,6 +433,9 @@ public enum CombatManager {
if (resists.immuneTo(damageType)) { if (resists.immuneTo(damageType)) {
//set auto attack job //set auto attack job
//we need to send the animation even if the attacker misses
TargetedActionMsg cmm = new TargetedActionMsg(attacker, target, (float) 0, getSwingAnimation(weapon.template,null,slot));
DispatchManager.sendToAllInRange(target, cmm);
setAutoAttackJob(attacker, slot, delay); setAutoAttackJob(attacker, slot, delay);
return; return;
} }
@@ -446,20 +468,6 @@ public enum CombatManager {
} }
} }
DeferredPowerJob dpj = null;
if (attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)) {
dpj = ((PlayerCharacter) attacker).getWeaponPower();
if (dpj != null) {
dpj.attack(target, attackRange);
if (dpj.getPower() != null && (dpj.getPowerToken() == -1851459567 || dpj.getPowerToken() == -1851489518))
((PlayerCharacter) attacker).setWeaponPower(dpj);
}
}
//set auto attack job //set auto attack job
setAutoAttackJob(attacker, slot, delay); setAutoAttackJob(attacker, slot, delay);
@@ -537,7 +545,7 @@ public enum CombatManager {
} }
//Item has no equipment slots and should not try to return an animation, return default instead //Item has no equipment slots and should not try to return an animation, return default instead
if(wb.item_eq_slots_or == null || wb.item_eq_slots_or.size() == 0){ if(wb.item_eq_slots_or == null || wb.item_eq_slots_or.isEmpty()){
return 75; return 75;
} }
+2
View File
@@ -175,6 +175,8 @@ public class MobAI {
public static void attackMob(Mob mob, Mob target) { public static void attackMob(Mob mob, Mob target) {
try { try {
if(mob == null || target == null)
return;
if (mob.getRange() >= 30 && mob.isMoving()) if (mob.getRange() >= 30 && mob.isMoving())
return; return;
+27 -2
View File
@@ -31,6 +31,7 @@ import engine.net.client.msg.ApplyRuneMsg;
import engine.net.client.msg.UpdateStateMsg; import engine.net.client.msg.UpdateStateMsg;
import engine.powers.EffectsBase; import engine.powers.EffectsBase;
import engine.powers.PowersBase; import engine.powers.PowersBase;
import engine.powers.effectmodifiers.AbstractEffectModifier;
import engine.server.MBServerStatics; import engine.server.MBServerStatics;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
@@ -804,7 +805,25 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
if (weapon != null) if (weapon != null)
speed *= (1 + abstractCharacter.bonuses.getFloatPercentAll(ModType.WeaponSpeed, SourceType.None)); speed *= (1 + abstractCharacter.bonuses.getFloatPercentAll(ModType.WeaponSpeed, SourceType.None));
speed *= (1 + abstractCharacter.bonuses.getFloatPercentAll(ModType.AttackDelay, SourceType.None)); PlayerBonuses bonuses = abstractCharacter.bonuses;
if(bonuses != null){
ModType modType = ModType.AttackDelay;
for (AbstractEffectModifier mod : bonuses.bonusFloats.keySet()) {
if (mod.getPercentMod() == 0)
continue;
if (!mod.modType.equals(modType))
continue;
if (bonuses.bonusFloats.get(mod) == null)
continue;
speed *= (1 + bonuses.bonusFloats.get(mod));
}
}
//speed *= (1 + abstractCharacter.bonuses.getFloatPercentAll(ModType.AttackDelay, SourceType.None));
if (speed < 10) if (speed < 10)
speed = 10; speed = 10;
@@ -1809,7 +1828,13 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
//handle hate value addition //handle hate value addition
Mob target = (Mob) this; Mob target = (Mob) this;
if (attacker.getObjectType().equals(GameObjectType.PlayerCharacter)) { if (attacker.getObjectType().equals(GameObjectType.PlayerCharacter)) {
target.playerAgroMap.put(attacker.getObjectUUID(), target.playerAgroMap.get(attacker.getObjectUUID()) + value);
if(target.playerAgroMap.containsKey(attacker.getObjectUUID()))
target.playerAgroMap.put(attacker.getObjectUUID(), target.playerAgroMap.get(attacker.getObjectUUID()) + value);
else
target.playerAgroMap.put(attacker.getObjectUUID(), value);
if (target.isPlayerGuard()) { if (target.isPlayerGuard()) {
if (target.guardedCity != null && target.guardedCity.cityOutlaws.contains(attacker.getObjectUUID()) == false) if (target.guardedCity != null && target.guardedCity.cityOutlaws.contains(attacker.getObjectUUID()) == false)
target.guardedCity.cityOutlaws.add(attacker.getObjectUUID()); target.guardedCity.cityOutlaws.add(attacker.getObjectUUID());
+1 -1
View File
@@ -27,7 +27,7 @@ import java.util.concurrent.ConcurrentHashMap;
public class PlayerBonuses { public class PlayerBonuses {
//First bonus set //First bonus set
private ConcurrentHashMap<AbstractEffectModifier, Float> bonusFloats = new ConcurrentHashMap<>(); ConcurrentHashMap<AbstractEffectModifier, Float> bonusFloats = new ConcurrentHashMap<>();
private ConcurrentHashMap<AbstractEffectModifier, DamageShield> bonusDamageShields = new ConcurrentHashMap<>(); private ConcurrentHashMap<AbstractEffectModifier, DamageShield> bonusDamageShields = new ConcurrentHashMap<>();
private ConcurrentHashMap<AbstractEffectModifier, String> bonusStrings = new ConcurrentHashMap<>(); private ConcurrentHashMap<AbstractEffectModifier, String> bonusStrings = new ConcurrentHashMap<>();
private ConcurrentHashMap<ModType, HashSet<SourceType>> bonusLists = new ConcurrentHashMap<>(); private ConcurrentHashMap<ModType, HashSet<SourceType>> bonusLists = new ConcurrentHashMap<>();