|
|
@ -1,10 +1,12 @@ |
|
|
|
package engine.wpak; |
|
|
|
package engine.wpak; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import engine.InterestManagement.WorldGrid; |
|
|
|
import engine.gameManager.*; |
|
|
|
import engine.gameManager.*; |
|
|
|
import engine.job.JobContainer; |
|
|
|
import engine.job.JobContainer; |
|
|
|
import engine.job.JobScheduler; |
|
|
|
import engine.job.JobScheduler; |
|
|
|
import engine.jobs.FinishRecycleTimeJob; |
|
|
|
import engine.jobs.FinishRecycleTimeJob; |
|
|
|
import engine.jobs.UsePowerJob; |
|
|
|
import engine.jobs.UsePowerJob; |
|
|
|
|
|
|
|
import engine.jobs.WpakUsePowerJob; |
|
|
|
import engine.math.Vector3fImmutable; |
|
|
|
import engine.math.Vector3fImmutable; |
|
|
|
import engine.mbEnums; |
|
|
|
import engine.mbEnums; |
|
|
|
import engine.net.Dispatch; |
|
|
|
import engine.net.Dispatch; |
|
|
@ -16,14 +18,14 @@ import engine.net.client.msg.UpdateStateMsg; |
|
|
|
import engine.objects.*; |
|
|
|
import engine.objects.*; |
|
|
|
import engine.powers.PowersBase; |
|
|
|
import engine.powers.PowersBase; |
|
|
|
import engine.server.MBServerStatics; |
|
|
|
import engine.server.MBServerStatics; |
|
|
|
|
|
|
|
import engine.util.Hasher; |
|
|
|
|
|
|
|
import engine.wpak.data.*; |
|
|
|
import engine.wpak.data.Effect; |
|
|
|
import engine.wpak.data.Effect; |
|
|
|
import engine.wpak.data.EquipmentPreReq; |
|
|
|
|
|
|
|
import engine.wpak.data.Power; |
|
|
|
|
|
|
|
import engine.wpak.data.PowerAction; |
|
|
|
|
|
|
|
import org.pmw.tinylog.Logger; |
|
|
|
import org.pmw.tinylog.Logger; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.HashMap; |
|
|
|
|
|
|
|
import java.util.HashSet; |
|
|
|
|
|
|
|
|
|
|
|
import static engine.math.FastMath.sqr; |
|
|
|
import static engine.math.FastMath.sqr; |
|
|
|
|
|
|
|
|
|
|
@ -34,8 +36,7 @@ public class WpakPowerManager { |
|
|
|
|
|
|
|
|
|
|
|
private static JobScheduler js; |
|
|
|
private static JobScheduler js; |
|
|
|
|
|
|
|
|
|
|
|
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")) { |
|
|
|
PowersBase pb = PowersManager.powersBaseByToken.get(msg.getPowerUsedID()); |
|
|
|
PowersBase pb = PowersManager.powersBaseByToken.get(msg.getPowerUsedID()); |
|
|
@ -90,7 +91,7 @@ public class WpakPowerManager { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static boolean castPower(final PerformActionMsg msg, ClientConnection origin, boolean sendCastToSelf) { |
|
|
|
private static boolean castPower(final PerformActionMsg msg, ClientConnection origin, boolean sendCastToSelf) { |
|
|
|
|
|
|
|
|
|
|
|
//check to see if the caster is valid
|
|
|
|
//check to see if the caster is valid
|
|
|
|
PlayerCharacter playerCharacter = SessionManager.getPlayerCharacter(origin); |
|
|
|
PlayerCharacter playerCharacter = SessionManager.getPlayerCharacter(origin); |
|
|
@ -293,9 +294,9 @@ public class WpakPowerManager { |
|
|
|
|
|
|
|
|
|
|
|
// run timer job to end cast
|
|
|
|
// run timer job to end cast
|
|
|
|
if (time < 1) // run immediately
|
|
|
|
if (time < 1) // run immediately
|
|
|
|
finishUsePower(copyMsg, playerCharacter, casterLiveCounter, targetLiveCounter); |
|
|
|
finishUsePower(copyMsg, playerCharacter, target); |
|
|
|
else { |
|
|
|
else { |
|
|
|
UsePowerJob upj = new UsePowerJob(playerCharacter, copyMsg, copyMsg.getPowerUsedID(), powerCast, casterLiveCounter, targetLiveCounter); |
|
|
|
WpakUsePowerJob upj = new WpakUsePowerJob(playerCharacter, copyMsg, target); |
|
|
|
JobContainer jc = js.scheduleJob(upj, time); |
|
|
|
JobContainer jc = js.scheduleJob(upj, time); |
|
|
|
|
|
|
|
|
|
|
|
// make lastPower
|
|
|
|
// make lastPower
|
|
|
@ -306,8 +307,51 @@ public class WpakPowerManager { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void finishUsePower(PerformActionMsg msg, int castCount, int targetCount){ |
|
|
|
public static void finishUsePower(PerformActionMsg msg, PlayerCharacter caster, AbstractWorldObject target){ |
|
|
|
|
|
|
|
Power powerUsed = powers.get(msg.getPowerUsedID()); |
|
|
|
|
|
|
|
if(powerUsed == null) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
if(powerUsed.maxMobTargets > 1 || powerUsed.maxPlayerTargets > 1){ |
|
|
|
|
|
|
|
AoeHandler(caster, target, powerUsed); |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
applyAllPowerEffects(powerUsed, target); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void AoeHandler(PlayerCharacter caster, AbstractWorldObject target, Power powerUsed){ |
|
|
|
|
|
|
|
HashSet<AbstractWorldObject> mobTargets = new HashSet<>(); |
|
|
|
|
|
|
|
HashSet<AbstractWorldObject> pcTargets = new HashSet<>(); |
|
|
|
|
|
|
|
if(powerUsed.maxMobTargets > 0) |
|
|
|
|
|
|
|
mobTargets = WorldGrid.getObjectsInRangePartial(target.loc,powerUsed.areaRange, MBServerStatics.MASK_MOB); |
|
|
|
|
|
|
|
if(powerUsed.maxPlayerTargets > 0) |
|
|
|
|
|
|
|
pcTargets = WorldGrid.getObjectsInRangePartial(target.loc,powerUsed.areaRange, MBServerStatics.MASK_PLAYER); |
|
|
|
|
|
|
|
int count = 1; |
|
|
|
|
|
|
|
for(AbstractWorldObject mob : mobTargets){ |
|
|
|
|
|
|
|
if(count < powerUsed.maxMobTargets + 1){ |
|
|
|
|
|
|
|
applyAllPowerEffects(powerUsed,mob); |
|
|
|
|
|
|
|
count ++; |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
count = 1; |
|
|
|
|
|
|
|
for(AbstractWorldObject pc : pcTargets){ |
|
|
|
|
|
|
|
if(count < powerUsed.maxPlayerTargets + 1){ |
|
|
|
|
|
|
|
applyAllPowerEffects(powerUsed,pc); |
|
|
|
|
|
|
|
count ++; |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void applyAllPowerEffects(Power power, AbstractWorldObject target){ |
|
|
|
|
|
|
|
for(ActionEntry powerAction: power.actionEntries){ |
|
|
|
|
|
|
|
Effect eff = effect_data.get(Hasher.SBStringHash(powerAction.effect_id)); |
|
|
|
|
|
|
|
if(eff == null) |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
//TODO add in effect application
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void sendPowerMsg(PlayerCharacter playerCharacter, int type, PerformActionMsg msg) { |
|
|
|
public static void sendPowerMsg(PlayerCharacter playerCharacter, int type, PerformActionMsg msg) { |
|
|
|