forked from MagicBane/Server
fix immunities
This commit is contained in:
@@ -49,13 +49,16 @@ public class PrintEffectsCmd extends AbstractDevCmd {
|
|||||||
String output = "Effects for Player:" + newline;
|
String output = "Effects for Player:" + newline;
|
||||||
|
|
||||||
AbstractCharacter absTar = (AbstractCharacter) target;
|
AbstractCharacter absTar = (AbstractCharacter) target;
|
||||||
for(Effect eff : absTar.effects.values()){
|
|
||||||
|
for(String key : absTar.effects.keySet()){
|
||||||
|
Effect eff = absTar.effects.get(key);
|
||||||
if(eff.getJobContainer() != null) {
|
if(eff.getJobContainer() != null) {
|
||||||
output += eff.getName() + " (" + eff.getTrains() + ") " + eff.getJobContainer().timeToExecutionLeft() + newline;
|
output += "[" + key + "] " + eff.getName() + " (" + eff.getTrains() + ") " + eff.getJobContainer().timeToExecutionLeft() * 0.001f + newline;
|
||||||
}else{
|
}else{
|
||||||
output += eff.getName() + " (" + eff.getTrains() + ") " + "PERMANENT" + newline;
|
output += eff.getName() + " (" + eff.getTrains() + ") " + "PERMANENT" + newline;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
throwbackInfo(pc, output);
|
throwbackInfo(pc, output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -846,10 +846,10 @@ public enum PowersManager {
|
|||||||
// called when a spell finishes casting. perform actions
|
// called when a spell finishes casting. perform actions
|
||||||
public static void finishUsePower(final PerformActionMsg msg, PlayerCharacter playerCharacter, int casterLiveCounter, int targetLiveCounter) {
|
public static void finishUsePower(final PerformActionMsg msg, PlayerCharacter playerCharacter, int casterLiveCounter, int targetLiveCounter) {
|
||||||
|
|
||||||
if(true) {
|
// if(true) {
|
||||||
newFinishCast(msg);
|
// newFinishCast(msg);
|
||||||
return;
|
// return;
|
||||||
}
|
//}
|
||||||
|
|
||||||
PerformActionMsg performActionMsg;
|
PerformActionMsg performActionMsg;
|
||||||
Dispatch dispatch;
|
Dispatch dispatch;
|
||||||
@@ -1986,26 +1986,6 @@ public enum PowersManager {
|
|||||||
+ ab.getEffectID());
|
+ ab.getEffectID());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(AbstractCharacter.IsAbstractCharacter(awo)) {
|
|
||||||
try {
|
|
||||||
boolean immune = false;
|
|
||||||
AbstractCharacter absChar = (AbstractCharacter) awo;
|
|
||||||
for (AbstractEffectModifier mod : ab.getPowerAction().getEffectsBase().getModifiers()) {
|
|
||||||
if (absChar.getBonuses() != null) {
|
|
||||||
if (absChar.getBonuses().getBool(ModType.ImmuneTo, mod.sourceType) || absChar.getBonuses().getBool(ModType.NoMod, mod.sourceType))
|
|
||||||
immune = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (immune)
|
|
||||||
return;
|
|
||||||
}catch(Exception e){
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
pa.startAction(source, awo, targetLoc, trains, ab, pb);
|
pa.startAction(source, awo, targetLoc, trains, ab, pb);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3112,65 +3092,6 @@ public enum PowersManager {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void newFinishCast(PerformActionMsg msg){
|
|
||||||
|
|
||||||
PlayerCharacter source = PlayerCharacter.getPlayerCharacter(msg.getSourceID());
|
|
||||||
|
|
||||||
if(source == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if(!source.isAlive())
|
|
||||||
return;
|
|
||||||
|
|
||||||
PowersBase powerBase = PowersManager.getPowerByToken(msg.getPowerUsedID());
|
|
||||||
|
|
||||||
if(powerBase == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
int trains = msg.getNumTrains();
|
|
||||||
if(source.getPowers().containsKey(msg.getPowerUsedID())){
|
|
||||||
trains = source.getPowers().get(msg.getPowerUsedID()).getTrains();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(powerBase.targetSelf) {
|
|
||||||
msg.setTargetID(source.getObjectUUID());
|
|
||||||
msg.setTargetType(GameObjectType.PlayerCharacter.ordinal());
|
|
||||||
}
|
|
||||||
AbstractWorldObject target = getTarget(msg);
|
|
||||||
|
|
||||||
|
|
||||||
if(target == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
for(ActionsBase action : powerBase.getActions()){
|
|
||||||
String stackType = action.stackType;
|
|
||||||
if(target.effects.containsKey(stackType)){
|
|
||||||
Effect eff = target.effects.get(stackType);
|
|
||||||
if(action.greaterThan && trains <= eff.getTrains())
|
|
||||||
continue;
|
|
||||||
if(action.greaterThanEqual && trains < eff.getTrains())
|
|
||||||
continue;
|
|
||||||
if(AbstractCharacter.IsAbstractCharacter(target)){
|
|
||||||
AbstractCharacter absTar = (AbstractCharacter) target;
|
|
||||||
if(absTar.getBonuses() != null){
|
|
||||||
SourceType sourceType = SourceType.GetSourceType(action.stackType);
|
|
||||||
if(sourceType != null && absTar.getBonuses().getBool(ModType.ImmuneTo,sourceType))
|
|
||||||
continue;
|
|
||||||
if(sourceType != null && absTar.getBonuses().getBool(ModType.NoMod,sourceType))
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
int duration = action.getDuration(trains);
|
|
||||||
runPowerAction(source,target,target.loc,action,trains,powerBase,duration);
|
|
||||||
//action.getPowerAction().startAction(source,target,target.loc,trains,action,powerBase);
|
|
||||||
}
|
|
||||||
source.setIsCasting(false);
|
|
||||||
PerformActionMsg castMsg = new PerformActionMsg(msg);
|
|
||||||
castMsg.setNumTrains(9999);
|
|
||||||
castMsg.setUnknown04(2);
|
|
||||||
DispatchMessage.dispatchMsgToInterestArea(source, castMsg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -244,25 +244,30 @@ public class ActionsBase {
|
|||||||
if (bonus == null)
|
if (bonus == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
//TODO make this more efficient then testing strings
|
SourceType sourceType = SourceType.GetSourceType(this.stackType);
|
||||||
if (this.stackType.equals("Stun") && bonus.getBool(ModType.ImmuneTo, SourceType.Stun))
|
|
||||||
return true; //Currently stun immune. Skip stun
|
if(sourceType != null && (bonus.getBool(ModType.ImmuneTo,sourceType) || bonus.getBool(ModType.NoMod,sourceType)))
|
||||||
else if (this.stackType.equals("Snare") && bonus.getBool(ModType.ImmuneTo, SourceType.Snare))
|
|
||||||
return true; //Currently snare immune. Skip snare
|
|
||||||
else if (this.stackType.equals("Blindness") && bonus.getBool(ModType.ImmuneTo, SourceType.Blind))
|
|
||||||
return true; //Currently blind immune. Skip blind
|
|
||||||
else if (this.stackType.equals("PowerInhibitor") && bonus.getBool(ModType.ImmuneTo, SourceType.Powerblock))
|
|
||||||
return true; //Currently power block immune. Skip power block
|
|
||||||
else if (this.stackType.equals("Root") && bonus.getBool(ModType.ImmuneTo, SourceType.Root))
|
|
||||||
return true;
|
return true;
|
||||||
// else if (pb.isHeal() && (bonus.getByte("immuneTo.Heal")) >= trains)
|
|
||||||
// return true; //Currently shadowmantled. Skip heals
|
if(pb.vampDrain() && bonus.getBool(ModType.BlockedPowerType, SourceType.VAMPDRAIN))
|
||||||
else if (this.stackType.equals("Flight") && bonus.getBool(ModType.NoMod, SourceType.Fly))
|
|
||||||
return true;
|
return true;
|
||||||
else if (this.stackType.equals("Track") && bonus.getBool(ModType.CannotTrack, SourceType.None))
|
|
||||||
|
if (this.stackType.equals("Track") && bonus.getBool(ModType.CannotTrack, SourceType.None))
|
||||||
return true;
|
return true;
|
||||||
else
|
|
||||||
return pb.vampDrain() && bonus.getBool(ModType.BlockedPowerType, SourceType.VAMPDRAIN);
|
if (this.stackType.equals("PowerInhibitor") && bonus.getBool(ModType.ImmuneTo, SourceType.Powerblock))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if(ac.effects.containsKey(this.stackType)) {
|
||||||
|
Effect eff = ac.effects.get(this.stackType);
|
||||||
|
if(eff != null) {
|
||||||
|
if (this.greaterThan && trains <= eff.getTrains())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (this.greaterThanEqual && trains < eff.getTrains())
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user