|
|
@ -27,7 +27,6 @@ import engine.net.client.msg.RecyclePowerMsg; |
|
|
|
import engine.net.client.msg.UpdateStateMsg; |
|
|
|
import engine.net.client.msg.UpdateStateMsg; |
|
|
|
import engine.objects.*; |
|
|
|
import engine.objects.*; |
|
|
|
import engine.server.MBServerStatics; |
|
|
|
import engine.server.MBServerStatics; |
|
|
|
import engine.util.Hasher; |
|
|
|
|
|
|
|
import engine.wpak.EffectsParser; |
|
|
|
import engine.wpak.EffectsParser; |
|
|
|
import engine.wpak.PowerActionParser; |
|
|
|
import engine.wpak.PowerActionParser; |
|
|
|
import engine.wpak.PowersParser; |
|
|
|
import engine.wpak.PowersParser; |
|
|
@ -37,7 +36,6 @@ import org.pmw.tinylog.Logger; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.HashSet; |
|
|
|
import java.util.HashSet; |
|
|
|
import java.util.concurrent.ConcurrentHashMap; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import static engine.math.FastMath.sqr; |
|
|
|
import static engine.math.FastMath.sqr; |
|
|
|
|
|
|
|
|
|
|
@ -64,8 +62,7 @@ public class WpakPowerManager { |
|
|
|
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY); |
|
|
|
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY); |
|
|
|
|
|
|
|
|
|
|
|
// Send Fail to cast message
|
|
|
|
// Send Fail to cast message
|
|
|
|
PlayerCharacter pc = SessionManager |
|
|
|
PlayerCharacter pc = SessionManager.getPlayerCharacter(origin); |
|
|
|
.getPlayerCharacter(origin); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (pc != null) { |
|
|
|
if (pc != null) { |
|
|
|
sendPowerMsg(pc, 2, msg); |
|
|
|
sendPowerMsg(pc, 2, msg); |
|
|
@ -212,9 +209,7 @@ public class WpakPowerManager { |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
else { |
|
|
|
else { |
|
|
|
playerCharacter.modifyHealth(-cost, playerCharacter, true); |
|
|
|
playerCharacter.modifyHealth(-cost, playerCharacter, true); |
|
|
|
ModifyHealthMsg mhm = new ModifyHealthMsg(playerCharacter, playerCharacter, -cost, |
|
|
|
ModifyHealthMsg mhm = new ModifyHealthMsg(playerCharacter, playerCharacter, -cost, 0f, 0f, 0, null, 9999, 0); |
|
|
|
0f, 0f, 0, null, |
|
|
|
|
|
|
|
9999, 0); |
|
|
|
|
|
|
|
mhm.setOmitFromChat(1); |
|
|
|
mhm.setOmitFromChat(1); |
|
|
|
DispatchManager.dispatchMsgToInterestArea(playerCharacter, mhm, mbEnums.DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false); |
|
|
|
DispatchManager.dispatchMsgToInterestArea(playerCharacter, mhm, mbEnums.DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false); |
|
|
|
} |
|
|
|
} |
|
|
@ -341,23 +336,29 @@ public class WpakPowerManager { |
|
|
|
|
|
|
|
|
|
|
|
for (ActionEntry powerAction : power.actionEntries) { |
|
|
|
for (ActionEntry powerAction : power.actionEntries) { |
|
|
|
|
|
|
|
|
|
|
|
int effectTokem = Hasher.SBStringHash(powerAction.effect_id); |
|
|
|
Effect effect = effect_data.get(powerAction.effect_id); |
|
|
|
Effect effect = effect_data.get(effectTokem); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (effect == null) |
|
|
|
if (effect == null) { |
|
|
|
|
|
|
|
Logger.error("Null effect for " + powerAction.effect_id); |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// New entry for this power effect?
|
|
|
|
// Create pojo to hold effect/modifiers stored in AWO
|
|
|
|
|
|
|
|
|
|
|
|
if (target._effects.containsKey(effectTokem) == false) |
|
|
|
AppliedEffect appliedEffect = new AppliedEffect(); |
|
|
|
target._effects.put(effectTokem, new ConcurrentHashMap<>()); |
|
|
|
appliedEffect.effect = effect; |
|
|
|
|
|
|
|
appliedEffect.rank = rank; |
|
|
|
|
|
|
|
|
|
|
|
// Write modifier values
|
|
|
|
// Add calculated modifiers to pojo
|
|
|
|
|
|
|
|
|
|
|
|
for (ModifierEntry modifierEntry : effect.mods) { |
|
|
|
for (ModifierEntry modifierEntry : effect.mods) { |
|
|
|
modifierEntry.type.behaviorType.apply(caster, target, power, powerAction, effect, modifierEntry, rank); |
|
|
|
Object modifier = modifierEntry.type.behaviorType.apply(caster, target, power, powerAction, effect, modifierEntry, rank); |
|
|
|
target._effects.get(effectTokem).put(modifierEntry.type, rank); |
|
|
|
appliedEffect.modifiers.put(modifierEntry.type, modifier); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Add this power effect to the target
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
target._effects.put(effect, appliedEffect); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|