Usage of EffectsParser

This commit is contained in:
2024-08-20 19:14:50 -05:00
parent 5957ff6f7b
commit c2633d0d9f
5 changed files with 67 additions and 18 deletions
+34 -5
View File
@@ -30,6 +30,8 @@ import engine.objects.Effect;
import engine.objects.PlayerCharacter;
import engine.powers.effectmodifiers.AbstractEffectModifier;
import engine.server.MBServerStatics;
import engine.util.Hasher;
import engine.wpak.data.EffectEntry;
import org.pmw.tinylog.Logger;
import java.sql.Connection;
@@ -62,7 +64,7 @@ public class EffectsBase {
// flags
private boolean isItemEffect;
private boolean isSpireEffect;
private boolean ignoreMod;
private boolean ignoreNoMod;
private boolean dontSave;
private boolean cancelOnAttack = false;
private boolean cancelOnAttackSwing = false;
@@ -91,6 +93,33 @@ public class EffectsBase {
}
//EffectEntry constructor
public EffectsBase(EffectEntry entry) {
this.IDString = entry.effect_id;
this.name = entry.effect_name;
this.token = Hasher.SBStringHash(entry.effect_name);
//override tokens for some effects like Safemode that use the Action Token instead of the effect Token,
switch (this.IDString) {
case "INVIS-D":
this.token = -1661751254;
break;
case "SafeMode":
this.token = -1661750486;
break;
}
this.isItemEffect = entry.isItemEffect;
this.isSpireEffect = entry.isSpireEffect;
this.ignoreNoMod = entry.ignoreNoMod;
this.dontSave = entry.dontSave;
if (this.IDString.startsWith("PRE-"))
this.isPrefix = true;
else if (this.IDString.startsWith("SUF-"))
this.isSuffix = true;
}
public EffectsBase(EffectsBase copyEffect, int newToken, String IDString) {
UUID = NewID++;
@@ -102,7 +131,7 @@ public class EffectsBase {
int flags = 0;
this.isItemEffect = ((flags & 1) != 0) ? true : false;
this.isSpireEffect = ((flags & 2) != 0) ? true : false;
this.ignoreMod = ((flags & 4) != 0) ? true : false;
this.ignoreNoMod = ((flags & 4) != 0) ? true : false;
this.dontSave = ((flags & 8) != 0) ? true : false;
if (this.IDString.startsWith("PRE-"))
@@ -117,7 +146,7 @@ public class EffectsBase {
this.amountRamp = copyEffect.amountRamp;
this.isItemEffect = copyEffect.isItemEffect;
this.isSpireEffect = copyEffect.isSpireEffect;
this.ignoreMod = copyEffect.ignoreMod;
this.ignoreNoMod = copyEffect.ignoreNoMod;
this.dontSave = copyEffect.dontSave;
this.cancelOnAttack = copyEffect.cancelOnAttack;
this.cancelOnAttackSwing = copyEffect.cancelOnAttackSwing;
@@ -163,7 +192,7 @@ public class EffectsBase {
int flags = rs.getInt("flags");
this.isItemEffect = ((flags & 1) != 0) ? true : false;
this.isSpireEffect = ((flags & 2) != 0) ? true : false;
this.ignoreMod = ((flags & 4) != 0) ? true : false;
this.ignoreNoMod = ((flags & 4) != 0) ? true : false;
this.dontSave = ((flags & 8) != 0) ? true : false;
if (this.IDString.startsWith("PRE-"))
@@ -351,7 +380,7 @@ public class EffectsBase {
}
public boolean ignoreMod() {
return this.ignoreMod;
return this.ignoreNoMod;
}
public boolean dontSave() {