Project cleanup pre merge.

This commit is contained in:
2023-07-15 09:23:48 -04:00
parent 134b651df8
commit 9bbdef224d
747 changed files with 99704 additions and 101200 deletions
+217 -214
View File
@@ -24,243 +24,246 @@ import java.util.HashMap;
public class ActionsBase {
public int UUID;
public String IDString;
public String effectID;
public int minTrains;
public int maxTrains;
public float duration;
public float ramp;
public boolean addFormula;
public String stackType;
public StackType stackTypeType;
public int stackOrder;
public int UUID;
public String IDString;
public String effectID;
public int minTrains;
public int maxTrains;
public float duration;
public float ramp;
public boolean addFormula;
public String stackType;
public StackType stackTypeType;
public int stackOrder;
public boolean greaterThanEqual = false;
public boolean always = false;
public boolean greaterThan = false;
public String stackPriority;
public boolean greaterThanEqual = false;
public boolean always = false;
public boolean greaterThan = false;
public String stackPriority;
private AbstractPowerAction powerAction;
private AbstractPowerAction powerAction;
/**
* No Table ID Constructor
*/
public ActionsBase() {
/**
* No Table ID Constructor
*/
public ActionsBase() {
}
}
/**
* ResultSet Constructor
*/
public ActionsBase(ResultSet rs, HashMap<String, AbstractPowerAction> apa) throws SQLException {
/**
* ResultSet Constructor
*/
public ActionsBase(ResultSet rs, HashMap<String, AbstractPowerAction> apa) throws SQLException {
this.UUID = rs.getInt("ID");
this.IDString = rs.getString("powerID");
this.effectID = rs.getString("effectID");
this.minTrains = rs.getInt("minTrains");
this.maxTrains = rs.getInt("maxTrains");
this.duration = rs.getFloat("duration");
this.ramp = rs.getFloat("ramp");
this.addFormula = (rs.getInt("useAddFormula") == 1) ? true : false;
this.stackType = rs.getString("stackType");
this.stackTypeType = StackType.GetStackType(this.stackType);
this.stackOrder = rs.getInt("stackOrder");
this.stackPriority = rs.getString("stackPriority");
this.UUID = rs.getInt("ID");
this.IDString = rs.getString("powerID");
this.effectID = rs.getString("effectID");
this.minTrains = rs.getInt("minTrains");
this.maxTrains = rs.getInt("maxTrains");
this.duration = rs.getFloat("duration");
this.ramp = rs.getFloat("ramp");
this.addFormula = (rs.getInt("useAddFormula") == 1) ? true : false;
this.stackType = rs.getString("stackType");
this.stackTypeType = StackType.GetStackType(this.stackType);
this.stackOrder = rs.getInt("stackOrder");
this.stackPriority = rs.getString("stackPriority");
switch (stackPriority) {
case "GreaterThanOrEqualTo":
this.greaterThanEqual = true;
break;
case "Always":
this.always = true;
break;
case "GreaterThan":
this.greaterThan = true;
break;
}
this.powerAction = apa.get(this.effectID);
}
switch (stackPriority) {
case "GreaterThanOrEqualTo":
this.greaterThanEqual = true;
break;
case "Always":
this.always = true;
break;
case "GreaterThan":
this.greaterThan = true;
break;
}
this.powerAction = apa.get(this.effectID);
}
protected ActionsBase(int uUID, String effectID, int minTrains, int maxTrains, float duration, float ramp,
boolean addFormula, String stackType, int stackOrder, boolean greaterThanEqual, boolean always,
boolean greaterThan, AbstractPowerAction powerAction) {
super();
UUID = uUID;
this.effectID = effectID;
this.minTrains = minTrains;
this.maxTrains = maxTrains;
this.duration = duration;
this.ramp = ramp;
this.addFormula = addFormula;
this.stackType = stackType;
this.stackTypeType = StackType.GetStackType(this.stackType);
if (this.stackTypeType == null)
Logger.info("Invalid Stack Type " + this.stackTypeType + " for " + this.effectID);
this.stackOrder = stackOrder;
this.greaterThanEqual = greaterThanEqual;
this.always = always;
this.greaterThan = greaterThan;
this.powerAction = powerAction;
if (this.greaterThanEqual)
this.stackPriority = "GreaterThanOrEqualTo";
else if(this.always)
this.stackPriority = "Always";
else if (this.greaterThan)
this.stackPriority = "GreaterThan";
}
protected ActionsBase(int uUID, String effectID, int minTrains, int maxTrains, float duration, float ramp,
boolean addFormula, String stackType, int stackOrder, boolean greaterThanEqual, boolean always,
boolean greaterThan, AbstractPowerAction powerAction) {
super();
UUID = uUID;
this.effectID = effectID;
this.minTrains = minTrains;
this.maxTrains = maxTrains;
this.duration = duration;
this.ramp = ramp;
this.addFormula = addFormula;
this.stackType = stackType;
this.stackTypeType = StackType.GetStackType(this.stackType);
if (this.stackTypeType == null)
Logger.info("Invalid Stack Type " + this.stackTypeType + " for " + this.effectID);
this.stackOrder = stackOrder;
this.greaterThanEqual = greaterThanEqual;
this.always = always;
this.greaterThan = greaterThan;
this.powerAction = powerAction;
// public static ArrayList<ActionsBase> getActionsBase(String ID) {
// PreparedStatementShared ps = null;
// ArrayList<ActionsBase> out = new ArrayList<ActionsBase>();
// try {
// ps = new PreparedStatementShared("SELECT * FROM actions where powerID = ?");
// ps.setString(1, ID);
// ResultSet rs = ps.executeQuery();
// while (rs.next()) {
// ActionsBase toAdd = new ActionsBase(rs);
// out.add(toAdd);
// }
// rs.close();
// } catch (Exception e) {
// Logger.error("ActionsBase", e);
// } finally {
// ps.release();
// }
// return out;
// }
if (this.greaterThanEqual)
this.stackPriority = "GreaterThanOrEqualTo";
else if (this.always)
this.stackPriority = "Always";
else if (this.greaterThan)
this.stackPriority = "GreaterThan";
public static void getActionsBase(HashMap<String, PowersBase> powers, HashMap<String, AbstractPowerAction> apa) {
PreparedStatementShared ps = null;
try {
ps = new PreparedStatementShared("SELECT * FROM static_power_action");
ResultSet rs = ps.executeQuery();
String IDString; ActionsBase toAdd; PowersBase pb;
while (rs.next()) {
IDString = rs.getString("powerID");
pb = powers.get(IDString);
if (pb != null) {
toAdd = new ActionsBase(rs, apa);
pb.getActions().add(toAdd);
}
}
rs.close();
} catch (Exception e) {
Logger.error( e.toString());
} finally {
ps.release();
}
int gateID = 5000;
for (String IDString : Runegate.GetAllOpenGateIDStrings()){
gateID++;
ActionsBase openGateActionBase = new ActionsBase(gateID, "OPENGATE", 5, 9999, 0, 0, true, "IgnoreStack", 0, true, false, false, PowersManager.getPowerActionByIDString("OPENGATE"));
PowersBase openGatePower = powers.get(IDString);
if (openGatePower == null){
Logger.error( "no powerbase for action " + IDString);
break;
}
openGatePower.getActions().add(openGateActionBase);
}
}
}
public int getUUID() {
return this.UUID;
}
// public static ArrayList<ActionsBase> getActionsBase(String ID) {
// PreparedStatementShared ps = null;
// ArrayList<ActionsBase> out = new ArrayList<ActionsBase>();
// try {
// ps = new PreparedStatementShared("SELECT * FROM actions where powerID = ?");
// ps.setString(1, ID);
// ResultSet rs = ps.executeQuery();
// while (rs.next()) {
// ActionsBase toAdd = new ActionsBase(rs);
// out.add(toAdd);
// }
// rs.close();
// } catch (Exception e) {
// Logger.error("ActionsBase", e);
// } finally {
// ps.release();
// }
// return out;
// }
public String getEffectID() {
return this.effectID;
}
public static void getActionsBase(HashMap<String, PowersBase> powers, HashMap<String, AbstractPowerAction> apa) {
PreparedStatementShared ps = null;
try {
ps = new PreparedStatementShared("SELECT * FROM static_power_action");
ResultSet rs = ps.executeQuery();
String IDString;
ActionsBase toAdd;
PowersBase pb;
while (rs.next()) {
IDString = rs.getString("powerID");
pb = powers.get(IDString);
if (pb != null) {
toAdd = new ActionsBase(rs, apa);
pb.getActions().add(toAdd);
}
}
rs.close();
} catch (Exception e) {
Logger.error(e.toString());
} finally {
ps.release();
}
public int getMinTrains() {
return this.minTrains;
}
int gateID = 5000;
for (String IDString : Runegate.GetAllOpenGateIDStrings()) {
gateID++;
ActionsBase openGateActionBase = new ActionsBase(gateID, "OPENGATE", 5, 9999, 0, 0, true, "IgnoreStack", 0, true, false, false, PowersManager.getPowerActionByIDString("OPENGATE"));
public int getMaxTrains() {
return this.maxTrains;
}
PowersBase openGatePower = powers.get(IDString);
public float getDuration() {
return this.duration;
}
if (openGatePower == null) {
Logger.error("no powerbase for action " + IDString);
break;
}
openGatePower.getActions().add(openGateActionBase);
}
}
public AbstractPowerAction getPowerAction() {
return this.powerAction;
}
public int getDuration(int trains) {
if (this.addFormula)
return (int)((this.duration + (this.ramp * trains)) * 1000);
else
return (int)((this.duration * (1 + (this.ramp * trains))) * 1000);
}
public int getUUID() {
return this.UUID;
}
public float getDurationAsFloat(int trains) {
if (this.addFormula)
return ((this.duration + (this.ramp * trains)) * 1000);
else
return ((this.duration * (1 + (this.ramp * trains))) * 1000);
}
public String getEffectID() {
return this.effectID;
}
public int getDurationInSeconds(int trains) {
if (this.addFormula)
return (int)(this.duration + (this.ramp * trains));
else
return (int)(this.duration * (1 + (this.ramp * trains)));
}
public int getMinTrains() {
return this.minTrains;
}
public String getStackType() {
return this.stackType;
}
public int getMaxTrains() {
return this.maxTrains;
}
public int getStackOrder() {
return this.stackOrder;
}
public float getDuration() {
return this.duration;
}
public boolean greaterThanEqual() {
return this.greaterThanEqual;
}
public AbstractPowerAction getPowerAction() {
return this.powerAction;
}
public boolean greaterThan() {
return this.greaterThan;
}
public int getDuration(int trains) {
if (this.addFormula)
return (int) ((this.duration + (this.ramp * trains)) * 1000);
else
return (int) ((this.duration * (1 + (this.ramp * trains))) * 1000);
}
public boolean always() {
return this.always;
}
public float getDurationAsFloat(int trains) {
if (this.addFormula)
return ((this.duration + (this.ramp * trains)) * 1000);
else
return ((this.duration * (1 + (this.ramp * trains))) * 1000);
}
//Add blocked types here
public boolean blocked(AbstractWorldObject awo, PowersBase pb, int trains) {
if (AbstractWorldObject.IsAbstractCharacter(awo)) {
AbstractCharacter ac = (AbstractCharacter) awo;
PlayerBonuses bonus = ac.getBonuses();
if (bonus == null)
return false;
//TODO make this more efficient then testing strings
if (this.stackType.equals("Stun") && bonus.getBool(ModType.ImmuneTo, SourceType.Stun))
return true; //Currently stun immune. Skip stun
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;
// else if (pb.isHeal() && (bonus.getByte("immuneTo.Heal")) >= trains)
// return true; //Currently shadowmantled. Skip heals
else if (this.stackType.equals("Flight") && bonus.getBool(ModType.NoMod, SourceType.Fly))
return true;
else if (this.stackType.equals("Track") && bonus.getBool(ModType.CannotTrack, SourceType.None))
return true;
else return pb.vampDrain() && bonus.getBool(ModType.BlockedPowerType, SourceType.VAMPDRAIN);
}
return false;
}
public int getDurationInSeconds(int trains) {
if (this.addFormula)
return (int) (this.duration + (this.ramp * trains));
else
return (int) (this.duration * (1 + (this.ramp * trains)));
}
public String getStackType() {
return this.stackType;
}
public int getStackOrder() {
return this.stackOrder;
}
public boolean greaterThanEqual() {
return this.greaterThanEqual;
}
public boolean greaterThan() {
return this.greaterThan;
}
public boolean always() {
return this.always;
}
//Add blocked types here
public boolean blocked(AbstractWorldObject awo, PowersBase pb, int trains) {
if (AbstractWorldObject.IsAbstractCharacter(awo)) {
AbstractCharacter ac = (AbstractCharacter) awo;
PlayerBonuses bonus = ac.getBonuses();
if (bonus == null)
return false;
//TODO make this more efficient then testing strings
if (this.stackType.equals("Stun") && bonus.getBool(ModType.ImmuneTo, SourceType.Stun))
return true; //Currently stun immune. Skip stun
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;
// else if (pb.isHeal() && (bonus.getByte("immuneTo.Heal")) >= trains)
// return true; //Currently shadowmantled. Skip heals
else if (this.stackType.equals("Flight") && bonus.getBool(ModType.NoMod, SourceType.Fly))
return true;
else if (this.stackType.equals("Track") && bonus.getBool(ModType.CannotTrack, SourceType.None))
return true;
else
return pb.vampDrain() && bonus.getBool(ModType.BlockedPowerType, SourceType.VAMPDRAIN);
}
return false;
}
}
+23 -23
View File
@@ -7,37 +7,37 @@
// www.magicbane.com
package engine.powers;
package engine.powers;
import engine.Enum.DamageType;
public class DamageShield {
private final DamageType damageType;
private final float amount;
private final boolean usePercent;
private final DamageType damageType;
private final float amount;
private final boolean usePercent;
public DamageShield(DamageType damageType, float amount, boolean usePercent) {
super();
this.damageType = damageType;
this.amount = amount;
this.usePercent = usePercent;
}
public DamageShield(DamageType damageType, float amount, boolean usePercent) {
super();
this.damageType = damageType;
this.amount = amount;
this.usePercent = usePercent;
}
public DamageType getDamageType() {
return this.damageType;
}
public DamageType getDamageType() {
return this.damageType;
}
public float getAmount() {
return this.amount;
}
public float getAmount() {
return this.amount;
}
public boolean usePercent() {
return this.usePercent;
}
public boolean usePercent() {
return this.usePercent;
}
@Override
public String toString() {
return "ds.DamageType: " + this.damageType.name() + ", Amount: " + this.amount + ", UsePercent: " + this.usePercent;
}
@Override
public String toString() {
return "ds.DamageType: " + this.damageType.name() + ", Amount: " + this.amount + ", UsePercent: " + this.usePercent;
}
}
File diff suppressed because it is too large Load Diff
+79 -79
View File
@@ -19,100 +19,100 @@ import java.util.ArrayList;
public class FailCondition {
private String IDString;
private Boolean forPower;
private String type;
private float amount;
private float ramp;
private boolean rampAdd;
private String IDString;
private Boolean forPower;
private String type;
private float amount;
private float ramp;
private boolean rampAdd;
// private String damageType1;
// private String damageType2;
// private String damageType3;
// private String damageType1;
// private String damageType2;
// private String damageType3;
/**
* No Table ID Constructor
*/
public FailCondition() {
/**
* No Table ID Constructor
*/
public FailCondition() {
}
}
/**
* ResultSet Constructor
*/
public FailCondition(ResultSet rs) throws SQLException {
/**
* ResultSet Constructor
*/
public FailCondition(ResultSet rs) throws SQLException {
this.IDString = rs.getString("IDString");
this.forPower = (rs.getString("powerOrEffect").equals("Power")) ? true : false;
this.type = rs.getString("type");
this.amount = rs.getFloat("amount");
this.ramp = rs.getFloat("ramp");
this.rampAdd = (rs.getInt("useAddFormula") == 1) ? true : false;
// this.damageType1 = rs.getString("damageType1");
// this.damageType2 = rs.getString("damageType2");
// this.damageType3 = rs.getString("damageType3");
}
this.IDString = rs.getString("IDString");
this.forPower = (rs.getString("powerOrEffect").equals("Power")) ? true : false;
this.type = rs.getString("type");
this.amount = rs.getFloat("amount");
this.ramp = rs.getFloat("ramp");
this.rampAdd = (rs.getInt("useAddFormula") == 1) ? true : false;
// this.damageType1 = rs.getString("damageType1");
// this.damageType2 = rs.getString("damageType2");
// this.damageType3 = rs.getString("damageType3");
}
public static ArrayList<FailCondition> getAllFailConditions() {
PreparedStatementShared ps = null;
ArrayList<FailCondition> out = new ArrayList<>();
try {
ps = new PreparedStatementShared("SELECT * FROM failconditions");
ResultSet rs = ps.executeQuery();
while (rs.next()) {
FailCondition toAdd = new FailCondition(rs);
out.add(toAdd);
}
rs.close();
} catch (Exception e) {
Logger.error( e);
public static ArrayList<FailCondition> getAllFailConditions() {
PreparedStatementShared ps = null;
ArrayList<FailCondition> out = new ArrayList<>();
try {
ps = new PreparedStatementShared("SELECT * FROM failconditions");
ResultSet rs = ps.executeQuery();
while (rs.next()) {
FailCondition toAdd = new FailCondition(rs);
out.add(toAdd);
}
rs.close();
} catch (Exception e) {
Logger.error(e);
} finally {
ps.release();
}
return out;
}
} finally {
ps.release();
}
return out;
}
public String getIDString() {
return this.IDString;
}
public String getIDString() {
return this.IDString;
}
public String getType() {
return this.type;
}
public String getType() {
return this.type;
}
public boolean forPower() {
return this.forPower;
}
public boolean forPower() {
return this.forPower;
}
public float getAmount() {
return this.amount;
}
public float getAmount() {
return this.amount;
}
public float getRamp() {
return this.ramp;
}
public float getRamp() {
return this.ramp;
}
public float getAmountForTrains(float trains) {
if (this.rampAdd)
return this.amount + (this.ramp * trains);
else
return this.amount * (1 + (this.ramp * trains));
}
public float getAmountForTrains(float trains) {
if (this.rampAdd)
return this.amount + (this.ramp * trains);
else
return this.amount * (1 + (this.ramp * trains));
}
public boolean useRampAdd() {
return this.rampAdd;
}
public boolean useRampAdd() {
return this.rampAdd;
}
// public String getDamageType1() {
// return this.damageType1;
// }
// public String getDamageType1() {
// return this.damageType1;
// }
// public String getDamageType2() {
// return this.damageType2;
// }
// public String getDamageType2() {
// return this.damageType2;
// }
// public String getDamageType3() {
// return this.damageType3;
// }
// public String getDamageType3() {
// return this.damageType3;
// }
}
+77 -74
View File
@@ -19,87 +19,90 @@ import java.util.HashMap;
public class PowerPrereq {
private String effect;
private String message;
private boolean mainHand;
private boolean required;
private String effect;
private String message;
private boolean mainHand;
private boolean required;
/**
* No Table ID Constructor
*/
public PowerPrereq() {
/**
* No Table ID Constructor
*/
public PowerPrereq() {
}
}
/**
* ResultSet Constructor
*/
public PowerPrereq(ResultSet rs, int type) throws SQLException {
/**
* ResultSet Constructor
*/
public PowerPrereq(ResultSet rs, int type) throws SQLException {
// this.IDString = rs.getString("IDString");
if (type == 1) {
this.effect = rs.getString("messageone");
this.message = rs.getString("messagetwo");
this.mainHand = false;
this.required = false;
} else if (type == 2) {
String sl = rs.getString("messageone");
if (sl.equals("RHELD"))
this.mainHand = true;
else if (sl.equals("LHELD"))
this.mainHand = false;
this.effect = "";
this.message = rs.getString("messagetwo");
this.required = (rs.getInt("required") == 1) ? true : false;
} else { //targetEffectPrereq
this.effect = rs.getString("messageone");
this.message = "";
this.mainHand = false;
this.required = (rs.getInt("required") == 1) ? true : false;
}
}
// this.IDString = rs.getString("IDString");
if (type == 1) {
this.effect = rs.getString("messageone");
this.message = rs.getString("messagetwo");
this.mainHand = false;
this.required = false;
} else if (type == 2) {
String sl = rs.getString("messageone");
if (sl.equals("RHELD"))
this.mainHand = true;
else if (sl.equals("LHELD"))
this.mainHand = false;
this.effect = "";
this.message = rs.getString("messagetwo");
this.required = (rs.getInt("required") == 1) ? true : false;
} else { //targetEffectPrereq
this.effect = rs.getString("messageone");
this.message = "";
this.mainHand = false;
this.required = (rs.getInt("required") == 1) ? true : false;
}
}
public static void getAllPowerPrereqs(HashMap<String, PowersBase> powers) {
PreparedStatementShared ps = null;
try {
ps = new PreparedStatementShared("SELECT * FROM static_power_powercastprereq");
ResultSet rs = ps.executeQuery();
int type; String IDString; PowerPrereq toAdd; PowersBase pb;
while (rs.next()) {
IDString = rs.getString("IDString");
pb = powers.get(IDString);
if (pb != null) {
type = rs.getInt("Type");
toAdd = new PowerPrereq(rs, type);
if (type == 1)
pb.getEffectPrereqs().add(toAdd);
else if (type == 2)
pb.getEquipPrereqs().add(toAdd);
else
pb.getTargetEffectPrereqs().add(toAdd);
}
}
rs.close();
} catch (Exception e) {
Logger.error( e.toString());
} finally {
ps.release();
}
}
public static void getAllPowerPrereqs(HashMap<String, PowersBase> powers) {
PreparedStatementShared ps = null;
try {
ps = new PreparedStatementShared("SELECT * FROM static_power_powercastprereq");
ResultSet rs = ps.executeQuery();
int type;
String IDString;
PowerPrereq toAdd;
PowersBase pb;
while (rs.next()) {
IDString = rs.getString("IDString");
pb = powers.get(IDString);
if (pb != null) {
type = rs.getInt("Type");
toAdd = new PowerPrereq(rs, type);
if (type == 1)
pb.getEffectPrereqs().add(toAdd);
else if (type == 2)
pb.getEquipPrereqs().add(toAdd);
else
pb.getTargetEffectPrereqs().add(toAdd);
}
}
rs.close();
} catch (Exception e) {
Logger.error(e.toString());
} finally {
ps.release();
}
}
public String getEffect() {
return this.effect;
}
public String getEffect() {
return this.effect;
}
public String getMessage() {
return this.message;
}
public String getMessage() {
return this.message;
}
public boolean mainHand() {
return this.mainHand;
}
public boolean mainHand() {
return this.mainHand;
}
public boolean isRequired() {
return this.required;
}
public boolean isRequired() {
return this.required;
}
}
File diff suppressed because it is too large Load Diff
+70 -70
View File
@@ -23,82 +23,82 @@ import java.util.HashSet;
//sorted by range from a specified point.
public class RangeBasedAwo implements Comparable<RangeBasedAwo> {
private float range;
private AbstractWorldObject awo;
private float range;
private AbstractWorldObject awo;
public RangeBasedAwo(Float range, AbstractWorldObject awo) {
super();
this.range = range;
this.awo = awo;
}
public RangeBasedAwo(Float range, AbstractWorldObject awo) {
super();
this.range = range;
this.awo = awo;
}
public static HashSet<RangeBasedAwo> createList(HashSet<AbstractWorldObject> awolist, Vector3fImmutable searchLoc) {
HashSet<RangeBasedAwo> rbal = new HashSet<>();
for (AbstractWorldObject awo: awolist) {
RangeBasedAwo rba = new RangeBasedAwo(searchLoc.distance(awo.getLoc()), awo);
rbal.add(rba);
}
return rbal;
}
public static HashSet<RangeBasedAwo> createList(HashSet<AbstractWorldObject> awolist, Vector3fImmutable searchLoc) {
HashSet<RangeBasedAwo> rbal = new HashSet<>();
for (AbstractWorldObject awo : awolist) {
RangeBasedAwo rba = new RangeBasedAwo(searchLoc.distance(awo.getLoc()), awo);
rbal.add(rba);
}
return rbal;
}
@Override
public int compareTo(RangeBasedAwo obj) throws ClassCastException {
return (int)(this.range - obj.range);
}
public static HashSet<AbstractWorldObject> getSortedList(HashSet<AbstractWorldObject> awolist, Vector3fImmutable searchLoc, int maxPlayers, int maxMobs) {
int playerCnt = 0;
int mobCnt = 0;
int maxCnt = (maxPlayers > maxMobs) ? maxPlayers : maxMobs;
HashSet<RangeBasedAwo> rbal = RangeBasedAwo.createList(awolist, searchLoc);
awolist = new HashSet<>();
for (RangeBasedAwo rba : rbal) {
if (awolist.size() >= maxCnt)
return awolist;
AbstractWorldObject awo = rba.awo;
public static HashSet<AbstractWorldObject> getSortedList(HashSet<AbstractWorldObject> awolist, Vector3fImmutable searchLoc, int maxPlayers, int maxMobs) {
int playerCnt = 0;
int mobCnt = 0;
int maxCnt = (maxPlayers > maxMobs) ? maxPlayers : maxMobs;
HashSet<RangeBasedAwo> rbal = RangeBasedAwo.createList(awolist, searchLoc);
awolist = new HashSet<>();
for (RangeBasedAwo rba : rbal) {
if (awolist.size() >= maxCnt)
return awolist;
AbstractWorldObject awo = rba.awo;
if (awo.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
if (playerCnt < maxPlayers) {
awolist.add(awo);
playerCnt++;
}
} else if (awo.getObjectType().equals(Enum.GameObjectType.Mob)) {
if (mobCnt < maxMobs) {
awolist.add(awo);
mobCnt++;
}
}
}
return awolist;
}
if (awo.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
if (playerCnt < maxPlayers) {
awolist.add(awo);
playerCnt++;
}
} else if (awo.getObjectType().equals(Enum.GameObjectType.Mob)) {
if (mobCnt < maxMobs) {
awolist.add(awo);
mobCnt++;
}
}
}
return awolist;
}
public static HashSet<AbstractCharacter> getTrackList(HashSet<AbstractWorldObject> awolist, PlayerCharacter pc, int max) {
Vector3fImmutable searchLoc = pc.getLoc();
int cnt = 0;
HashSet<RangeBasedAwo> rbal = RangeBasedAwo.createList(awolist, searchLoc);
HashSet<AbstractCharacter> aclist = new HashSet<>();
for (RangeBasedAwo rba : rbal) {
if (aclist.size() >= max)
return aclist;
AbstractWorldObject awo = rba.awo;
public static HashSet<AbstractCharacter> getTrackList(HashSet<AbstractWorldObject> awolist, PlayerCharacter pc, int max) {
Vector3fImmutable searchLoc = pc.getLoc();
int cnt = 0;
HashSet<RangeBasedAwo> rbal = RangeBasedAwo.createList(awolist, searchLoc);
HashSet<AbstractCharacter> aclist = new HashSet<>();
for (RangeBasedAwo rba : rbal) {
if (aclist.size() >= max)
return aclist;
AbstractWorldObject awo = rba.awo;
if (awo.getObjectType().equals(GameObjectType.PlayerCharacter))
if (((PlayerCharacter)awo).isCSR())
continue;
if (AbstractWorldObject.IsAbstractCharacter(awo) && !(pc.equals(awo))) {
aclist.add((AbstractCharacter)awo);
cnt++;
}
}
return aclist;
}
if (awo.getObjectType().equals(GameObjectType.PlayerCharacter))
if (((PlayerCharacter) awo).isCSR())
continue;
public float getRange() {
return this.range;
}
if (AbstractWorldObject.IsAbstractCharacter(awo) && !(pc.equals(awo))) {
aclist.add((AbstractCharacter) awo);
cnt++;
}
}
return aclist;
}
public AbstractWorldObject getAwo() {
return this.awo;
}
@Override
public int compareTo(RangeBasedAwo obj) throws ClassCastException {
return (int) (this.range - obj.range);
}
public float getRange() {
return this.range;
}
public AbstractWorldObject getAwo() {
return this.awo;
}
}
@@ -24,97 +24,98 @@ import java.sql.SQLException;
public abstract class AbstractEffectModifier {
protected EffectsBase parent;
protected int UUID;
protected String IDString;
protected String effectType;
public float minMod;
protected float maxMod;
protected float percentMod;
protected float ramp;
protected boolean useRampAdd;
protected String type;
public SourceType sourceType;
protected String string1;
protected String string2;
public ModType modType;
public float minMod;
public SourceType sourceType;
public ModType modType;
protected EffectsBase parent;
protected int UUID;
protected String IDString;
protected String effectType;
protected float maxMod;
protected float percentMod;
protected float ramp;
protected boolean useRampAdd;
protected String type;
protected String string1;
protected String string2;
public AbstractEffectModifier(ResultSet rs) throws SQLException {
public AbstractEffectModifier(ResultSet rs) throws SQLException {
this.UUID = rs.getInt("ID");
this.IDString = rs.getString("IDString");
this.effectType = rs.getString("modType");
this.modType = ModType.GetModType(this.effectType);
this.type = rs.getString("type").replace("\"", "");
this.sourceType = SourceType.GetSourceType(this.type.replace(" ", "").replace("-", ""));
this.minMod = rs.getFloat("minMod");
this.maxMod = rs.getFloat("maxMod");
this.percentMod = rs.getFloat("percentMod");
this.ramp = rs.getFloat("ramp");
this.useRampAdd = (rs.getInt("useRampAdd") == 1) ? true : false;
this.string1 = rs.getString("string1");
this.string2 = rs.getString("string2");
}
this.UUID = rs.getInt("ID");
this.IDString = rs.getString("IDString");
this.effectType = rs.getString("modType");
this.modType = ModType.GetModType(this.effectType);
this.type = rs.getString("type").replace("\"", "");
this.sourceType = SourceType.GetSourceType(this.type.replace(" ", "").replace("-", ""));
this.minMod = rs.getFloat("minMod");
this.maxMod = rs.getFloat("maxMod");
this.percentMod = rs.getFloat("percentMod");
this.ramp = rs.getFloat("ramp");
this.useRampAdd = (rs.getInt("useRampAdd") == 1) ? true : false;
this.string1 = rs.getString("string1");
this.string2 = rs.getString("string2");
}
public int getUUID() {
return this.UUID;
}
public int getUUID() {
return this.UUID;
}
// public String getIDString() {
// return this.IDString;
// }
// public String getIDString() {
// return this.IDString;
// }
public String getmodType() {
return this.effectType;
}
public String getmodType() {
return this.effectType;
}
public float getMinMod() {
return this.minMod;
}
public float getMinMod() {
return this.minMod;
}
public float getMaxMod() {
return this.maxMod;
}
public float getMaxMod() {
return this.maxMod;
}
public float getPercentMod() {
return this.percentMod;
}
public float getPercentMod() {
return this.percentMod;
}
public float getRamp() {
return this.ramp;
}
public float getRamp() {
return this.ramp;
}
public String getType() {
return this.type;
}
public String getType() {
return this.type;
}
public String getString1() {
return this.string1;
}
public String getString1() {
return this.string1;
}
public String getString2() {
return this.string2;
}
public String getString2() {
return this.string2;
}
public EffectsBase getParent() {
return this.parent;
}
public EffectsBase getParent() {
return this.parent;
}
public void setParent(EffectsBase value) {
this.parent = value;
}
public void setParent(EffectsBase value) {
this.parent = value;
}
public void applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
public void applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
_applyEffectModifier(source, awo, trains, effect);
}
_applyEffectModifier(source, awo, trains, effect);
}
protected abstract void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect);
protected abstract void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect);
public abstract void applyBonus(AbstractCharacter ac, int trains);
public abstract void applyBonus(Item item, int trains);
public abstract void applyBonus(Building building, int trains);
public abstract void applyBonus(AbstractCharacter ac, int trains);
public abstract void applyBonus(Item item, int trains);
public abstract void applyBonus(Building building, int trains);
}
@@ -18,32 +18,35 @@ import java.sql.SQLException;
public class AdjustAboveDmgCapEffectModifier extends AbstractEffectModifier {
public AdjustAboveDmgCapEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public AdjustAboveDmgCapEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
Float amount = 0f;
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
amount = amount / 100;
PlayerBonuses bonus = ac.getBonuses();
bonus.setFloat(this, amount);
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
Float amount = 0f;
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
amount = amount / 100;
PlayerBonuses bonus = ac.getBonuses();
bonus.setFloat(this, amount);
}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -20,23 +20,26 @@ import java.sql.SQLException;
public class AmbidexterityEffectModifier extends AbstractEffectModifier {
public AmbidexterityEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public AmbidexterityEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
PlayerBonuses bonus = ac.getBonuses();
bonus.setBool(ModType.Ambidexterity, SourceType.None, true);
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
PlayerBonuses bonus = ac.getBonuses();
bonus.setBool(ModType.Ambidexterity, SourceType.None, true);
}
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -18,25 +18,28 @@ import java.sql.SQLException;
public class ArmorPiercingEffectModifier extends AbstractEffectModifier {
public ArmorPiercingEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public ArmorPiercingEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
Float amount = 0f;
PlayerBonuses bonus = ac.getBonuses();
amount = this.percentMod;
bonus.addFloat(this, amount * 0.01f);
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
Float amount = 0f;
PlayerBonuses bonus = ac.getBonuses();
amount = this.percentMod;
bonus.addFloat(this, amount * 0.01f);
}
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -18,29 +18,32 @@ import java.sql.SQLException;
public class AttackDelayEffectModifier extends AbstractEffectModifier {
public AttackDelayEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public AttackDelayEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
Float amount = 0f;
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
amount = amount/100;
PlayerBonuses bonus = ac.getBonuses();
bonus.addFloat(this, amount);
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
Float amount = 0f;
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
amount = amount / 100;
PlayerBonuses bonus = ac.getBonuses();
bonus.addFloat(this, amount);
}
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -18,39 +18,42 @@ import java.sql.SQLException;
public class AttributeEffectModifier extends AbstractEffectModifier {
public AttributeEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public AttributeEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
ac.update();
Float amount = 0f;
PlayerBonuses bonus = ac.getBonuses();
if (this.percentMod != 0f) { //Stat Percent Modifiers
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
amount = amount/100;
bonus.addFloat(this, amount);
} else { //Stat Modifiers
if (this.useRampAdd)
amount = this.minMod + (this.ramp * trains);
else
amount = this.minMod * (1 + (this.ramp * trains));
bonus.addFloat(this, amount);
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
ac.update();
Float amount = 0f;
PlayerBonuses bonus = ac.getBonuses();
if (this.percentMod != 0f) { //Stat Percent Modifiers
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
amount = amount / 100;
bonus.addFloat(this, amount);
} else { //Stat Modifiers
if (this.useRampAdd)
amount = this.minMod + (this.ramp * trains);
else
amount = this.minMod * (1 + (this.ramp * trains));
bonus.addFloat(this, amount);
}
}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -21,33 +21,36 @@ import java.sql.SQLException;
public class BlackMantleEffectModifier extends AbstractEffectModifier {
public BlackMantleEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public BlackMantleEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
PlayerBonuses bonus = ac.getBonuses();
SourceType sourceType = SourceType.valueOf(this.type);
if (sourceType == null){
Logger.error("Bad Source Type for " + this.type);
return;
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
PlayerBonuses bonus = ac.getBonuses();
SourceType sourceType = SourceType.valueOf(this.type);
if (this.type.equals("Heal"))
bonus.setFloat(this, trains);
else
bonus.setBool(ModType.ImmuneTo, this.sourceType, true);
}
if (sourceType == null) {
Logger.error("Bad Source Type for " + this.type);
return;
}
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
if (this.type.equals("Heal"))
bonus.setFloat(this, trains);
else
bonus.setBool(ModType.ImmuneTo, this.sourceType, true);
}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -20,22 +20,25 @@ import java.sql.SQLException;
public class BladeTrailsEffectModifier extends AbstractEffectModifier {
public BladeTrailsEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public BladeTrailsEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
}
}
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -18,29 +18,32 @@ import java.sql.SQLException;
public class BlockEffectModifier extends AbstractEffectModifier {
public BlockEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public BlockEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
Float amount = 0f;
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
amount = amount/100;
PlayerBonuses bonus = ac.getBonuses();
bonus.setFloat(this, amount);
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
Float amount = 0f;
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
amount = amount / 100;
PlayerBonuses bonus = ac.getBonuses();
bonus.setFloat(this, amount);
}
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -20,43 +20,46 @@ import java.util.HashSet;
public class BlockedPowerTypeEffectModifier extends AbstractEffectModifier {
public BlockedPowerTypeEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public BlockedPowerTypeEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
PlayerBonuses bonus = ac.getBonuses();
bonus.setBool(this.modType,this.sourceType, true);
for (String effect : ac.getEffects().keySet()){
Effect eff = ac.getEffects().get(effect);
ModType toBlock = ModType.None;
switch (this.sourceType){
case Invisible:
toBlock = ModType.Invisible;
break;
}
HashSet<AbstractEffectModifier> aemList = eff.getEffectModifiers();
for (AbstractEffectModifier aem : aemList ){
if (aem.modType.equals(toBlock)){
ac.endEffect(effect);
}
}
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
PlayerBonuses bonus = ac.getBonuses();
bonus.setBool(this.modType, this.sourceType, true);
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
for (String effect : ac.getEffects().keySet()) {
Effect eff = ac.getEffects().get(effect);
ModType toBlock = ModType.None;
switch (this.sourceType) {
case Invisible:
toBlock = ModType.Invisible;
break;
}
HashSet<AbstractEffectModifier> aemList = eff.getEffectModifiers();
for (AbstractEffectModifier aem : aemList) {
if (aem.modType.equals(toBlock)) {
ac.endEffect(effect);
}
}
}
}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -18,24 +18,27 @@ import java.sql.SQLException;
public class CannotAttackEffectModifier extends AbstractEffectModifier {
public CannotAttackEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public CannotAttackEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
PlayerBonuses bonus = ac.getBonuses();
bonus.setBool(this.modType,this.sourceType, true);
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
PlayerBonuses bonus = ac.getBonuses();
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
bonus.setBool(this.modType, this.sourceType, true);
}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -19,28 +19,31 @@ import java.sql.SQLException;
public class CannotCastEffectModifier extends AbstractEffectModifier {
public CannotCastEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public CannotCastEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
if (ac.getObjectType().equals(Enum.GameObjectType.Mob)) {
Mob mob = (Mob) ac;
}
if (ac.getObjectType().equals(Enum.GameObjectType.Mob)) {
Mob mob = (Mob) ac;
}
PlayerBonuses bonus = ac.getBonuses();
bonus.setBool(this.modType,this.sourceType, true);
}
PlayerBonuses bonus = ac.getBonuses();
bonus.setBool(this.modType, this.sourceType, true);
}
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -18,24 +18,27 @@ import java.sql.SQLException;
public class CannotMoveEffectModifier extends AbstractEffectModifier {
public CannotMoveEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public CannotMoveEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
PlayerBonuses bonus = ac.getBonuses();
bonus.setBool(this.modType,this.sourceType,true);
ac.stopMovement(ac.getMovementLoc());
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
PlayerBonuses bonus = ac.getBonuses();
bonus.setBool(this.modType, this.sourceType, true);
ac.stopMovement(ac.getMovementLoc());
}
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -18,23 +18,26 @@ import java.sql.SQLException;
public class CannotTrackEffectModifier extends AbstractEffectModifier {
public CannotTrackEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public CannotTrackEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
PlayerBonuses bonus = ac.getBonuses();
bonus.setBool(this.modType,this.sourceType,true);
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
PlayerBonuses bonus = ac.getBonuses();
bonus.setBool(this.modType, this.sourceType, true);
}
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -20,22 +20,25 @@ import java.sql.SQLException;
public class CharmedEffectModifier extends AbstractEffectModifier {
public CharmedEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public CharmedEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
}
}
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -18,23 +18,26 @@ import java.sql.SQLException;
public class ConstrainedAmbidexterityEffectModifier extends AbstractEffectModifier {
public ConstrainedAmbidexterityEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public ConstrainedAmbidexterityEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
PlayerBonuses bonus = ac.getBonuses();
bonus.setString(this,this.type);
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
PlayerBonuses bonus = ac.getBonuses();
bonus.setString(this, this.type);
}
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -18,37 +18,40 @@ import java.sql.SQLException;
public class DCVEffectModifier extends AbstractEffectModifier {
public DCVEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public DCVEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
Float amount = 0f;
PlayerBonuses bonus = ac.getBonuses();
if (this.percentMod != 0f) { //Stat Percent Modifiers
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
amount = (amount) / 100;
bonus.addFloat(this, amount);
} else { //Stat Modifiers
if (this.useRampAdd)
amount = this.minMod + (this.ramp * trains);
else
amount = this.minMod * (1 + (this.ramp * trains));
bonus.addFloat(this,amount);
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
Float amount = 0f;
PlayerBonuses bonus = ac.getBonuses();
if (this.percentMod != 0f) { //Stat Percent Modifiers
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
amount = (amount) / 100;
bonus.addFloat(this, amount);
} else { //Stat Modifiers
if (this.useRampAdd)
amount = this.minMod + (this.ramp * trains);
else
amount = this.minMod * (1 + (this.ramp * trains));
bonus.addFloat(this, amount);
}
}
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -20,42 +20,44 @@ import java.sql.SQLException;
public class DREffectModifier extends AbstractEffectModifier {
public DREffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public DREffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
//Defense Rating (defense bonus for armor)
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
//Defense Rating (defense bonus for armor)
}
@Override
public void applyBonus(Item item, int trains) {
if (item == null)
return;
String key; float amount = 0f;
if (this.percentMod != 0f) {
if (this.useRampAdd)
amount = (this.percentMod + (this.ramp * trains)) / 100f;
else
amount = (this.percentMod * (1 + (this.ramp * trains))) / 100f;
amount = amount/100;
key = "DR.percent";
} else {
if (this.useRampAdd)
amount = this.minMod + (this.ramp * trains);
else
amount = this.minMod * (1 + (this.ramp * trains));
key = "DR";
}
item.addBonus(this, amount);
}
@Override
public void applyBonus(Item item, int trains) {
if (item == null)
return;
String key;
float amount = 0f;
if (this.percentMod != 0f) {
if (this.useRampAdd)
amount = (this.percentMod + (this.ramp * trains)) / 100f;
else
amount = (this.percentMod * (1 + (this.ramp * trains))) / 100f;
amount = amount / 100;
key = "DR.percent";
} else {
if (this.useRampAdd)
amount = this.minMod + (this.ramp * trains);
else
amount = this.minMod * (1 + (this.ramp * trains));
key = "DR";
}
item.addBonus(this, amount);
}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -18,29 +18,32 @@ import java.sql.SQLException;
public class DamageCapEffectModifier extends AbstractEffectModifier {
public DamageCapEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public DamageCapEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
Float amount = 0f;
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
amount = amount/100;
PlayerBonuses bonus = ac.getBonuses();
bonus.setFloat(this, amount);
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
Float amount = 0f;
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
amount = amount / 100;
PlayerBonuses bonus = ac.getBonuses();
bonus.setFloat(this, amount);
}
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -20,45 +20,49 @@ import java.sql.SQLException;
public class DamageShieldEffectModifier extends AbstractEffectModifier {
public DamageShieldEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public DamageShieldEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
float amount; boolean usePercent;
if (this.percentMod != 0) {
amount = this.percentMod;
usePercent = true;
} else {
amount = this.minMod;
usePercent = false;
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
float amount;
boolean usePercent;
if (this.percentMod != 0) {
amount = this.percentMod;
usePercent = true;
} else {
amount = this.minMod;
usePercent = false;
}
if (this.ramp > 0f) {
float mod = this.ramp * trains;
if (this.useRampAdd)
amount += mod;
else
amount *= (1 + mod);
}
if (this.ramp > 0f) {
float mod = this.ramp * trains;
if (this.useRampAdd)
amount += mod;
else
amount *= (1 + mod);
}
DamageType dt = DamageType.valueOf(this.type);
if (dt != null) {
DamageShield ds = new DamageShield(dt, amount, usePercent);
PlayerBonuses bonus = ac.getBonuses();
if (bonus != null)
bonus.addDamageShield(this, ds);
}
}
DamageType dt = DamageType.valueOf(this.type);
if (dt != null) {
DamageShield ds = new DamageShield(dt, amount, usePercent);
PlayerBonuses bonus = ac.getBonuses();
if (bonus != null)
bonus.addDamageShield(this, ds);
}
}
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -18,37 +18,40 @@ import java.sql.SQLException;
public class DodgeEffectModifier extends AbstractEffectModifier {
public DodgeEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public DodgeEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
Float amount = 0f;
PlayerBonuses bonus = ac.getBonuses();
if (this.percentMod != 0f) { //Stat Percent Modifiers
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
amount = amount/100;
bonus.addFloat(this, amount);
} else { //Stat Modifiers
if (this.useRampAdd)
amount = this.minMod + (this.ramp * trains);
else
amount = this.minMod * (1 + (this.ramp * trains));
bonus.addFloat(this, amount);
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
Float amount = 0f;
PlayerBonuses bonus = ac.getBonuses();
if (this.percentMod != 0f) { //Stat Percent Modifiers
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
amount = amount / 100;
bonus.addFloat(this, amount);
} else { //Stat Modifiers
if (this.useRampAdd)
amount = this.minMod + (this.ramp * trains);
else
amount = this.minMod * (1 + (this.ramp * trains));
bonus.addFloat(this, amount);
}
}
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -20,32 +20,33 @@ import java.sql.SQLException;
public class DurabilityEffectModifier extends AbstractEffectModifier {
public DurabilityEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public DurabilityEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
}
}
@Override
public void applyBonus(Item item, int trains)
{
if(item == null){
return;
}
float amount = 0;
amount = this.percentMod;
item.addBonus(this,amount);
@Override
public void applyBonus(Item item, int trains) {
if (item == null) {
return;
}
float amount = 0;
amount = this.percentMod;
item.addBonus(this, amount);
}
@Override
public void applyBonus(Building building, int trains) {}
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -18,28 +18,31 @@ import java.util.HashSet;
public class ExclusiveDamageCapEffectModifier extends AbstractEffectModifier {
public ExclusiveDamageCapEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public ExclusiveDamageCapEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
PlayerBonuses bonus = ac.getBonuses();
if (bonus == null)
return;
if (bonus.getList(this.modType) == null)
bonus.setList(this.modType, new HashSet<>());
bonus.getList(this.modType).add(this.sourceType);
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
PlayerBonuses bonus = ac.getBonuses();
if (bonus == null)
return;
if (bonus.getList(this.modType) == null)
bonus.setList(this.modType, new HashSet<>());
bonus.getList(this.modType).add(this.sourceType);
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -20,22 +20,25 @@ import java.sql.SQLException;
public class FadeEffectModifier extends AbstractEffectModifier {
public FadeEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public FadeEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
}
}
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -17,23 +17,26 @@ import java.sql.SQLException;
public class FlyEffectModifier extends AbstractEffectModifier {
public FlyEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public FlyEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
PlayerBonuses bonus = ac.getBonuses();
bonus.setBool(this.modType,this.sourceType,true);
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
PlayerBonuses bonus = ac.getBonuses();
bonus.setBool(this.modType, this.sourceType, true);
}
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -29,162 +29,172 @@ import java.util.concurrent.ThreadLocalRandom;
public class HealthEffectModifier extends AbstractEffectModifier {
private DamageType damageType;
private DamageType damageType;
public HealthEffectModifier(ResultSet rs) throws SQLException {
super(rs);
String damageTypeDB = rs.getString("type");
try {
this.damageType = DamageType.valueOf(damageTypeDB);
} catch (IllegalArgumentException e) {
Logger.error("DamageType could not be loaded from database. " + "UUID = " + this.UUID
+ " value received = '" + damageTypeDB + '\'', e);
}
}
public HealthEffectModifier(ResultSet rs) throws SQLException {
super(rs);
String damageTypeDB = rs.getString("type");
try {
this.damageType = DamageType.valueOf(damageTypeDB);
} catch (IllegalArgumentException e) {
Logger.error("DamageType could not be loaded from database. " + "UUID = " + this.UUID
+ " value received = '" + damageTypeDB + '\'', e);
}
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
if (awo == null) {
Logger.error("_applyEffectModifier(): NULL AWO passed in.");
return;
}
public static float getMinDamage(float baseMin, float intelligence, float spirit, float focus) {
float min = baseMin * (((float) Math.pow(intelligence, 0.75f) * 0.0311f) + (0.02f * (int) focus) + ((float) Math.pow(spirit, 0.75f) * 0.0416f));
return (float) ((int) (min + 0.5f)); //round to nearest whole number
}
if (effect == null) {
Logger.error( "_applyEffectModifier(): NULL AbstractEffectJob passed in.");
return;
}
public static float getMaxDamage(float baseMax, float intelligence, float spirit, float focus) {
float max = baseMax * (((float) Math.pow(intelligence, 0.75f) * 0.0785f) + (0.015f * (int) focus) + ((float) Math.pow(spirit, 0.75f) * 0.0157f));
return (float) ((int) (max + 0.5f)); //round to nearest whole number
}
float modAmount = 0f;
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
if (awo == null) {
Logger.error("_applyEffectModifier(): NULL AWO passed in.");
return;
}
// Modify health by percent
if (this.percentMod != 0f) {
if (effect == null) {
Logger.error("_applyEffectModifier(): NULL AbstractEffectJob passed in.");
return;
}
//high level mobs/players should not be %damaged/healed.
if (awo.getHealthMax() > 25000f && (this.percentMod < 0f || this.percentMod > 5f))
return;
float modAmount = 0f;
float mod = 1f;
if (this.useRampAdd)
mod = (this.percentMod + (this.ramp * trains)) / 100;
else
mod = (this.percentMod * (1 + (this.ramp * trains))) / 100;
modAmount = mod * awo.getHealthMax();
if (AbstractWorldObject.IsAbstractCharacter(awo)) {
if (((AbstractCharacter)awo).isSit())
modAmount *= 2.5f;
}
// Modify health by percent
if (this.percentMod != 0f) {
//debug for spell damage and atr
if (source.getDebug(16) && source.getObjectType().equals(GameObjectType.PlayerCharacter)) {
PlayerCharacter pc = (PlayerCharacter) source;
String smsg = "Percent Damage: " + mod * 100 + '%';
ChatManager.chatSystemInfo(pc, smsg);
}
}
//high level mobs/players should not be %damaged/healed.
if (awo.getHealthMax() > 25000f && (this.percentMod < 0f || this.percentMod > 5f))
return;
// Modify health by min/max amount
else if (this.minMod != 0f || this.maxMod != 0f) {
float min = this.minMod;
float max = this.maxMod;
if (this.ramp > 0f) {
float mod = this.ramp * trains;
if (this.useRampAdd) {
min += mod;
max += mod;
} else {
min *= (1 + mod);
max *= (1 + mod);
}
}
if (source.getObjectType().equals(GameObjectType.PlayerCharacter)) {
PlayerCharacter pc = (PlayerCharacter) source;
float mod = 1f;
if (this.useRampAdd)
mod = (this.percentMod + (this.ramp * trains)) / 100;
else
mod = (this.percentMod * (1 + (this.ramp * trains))) / 100;
modAmount = mod * awo.getHealthMax();
if (AbstractWorldObject.IsAbstractCharacter(awo)) {
if (((AbstractCharacter) awo).isSit())
modAmount *= 2.5f;
}
float focus;
CharacterSkill skill = pc.getSkills().get(effect.getPower().getSkillName());
if (skill == null)
focus = CharacterSkill.getQuickMastery(pc, effect.getPower().getSkillName());
else
focus = skill.getModifiedAmount();
//TODO clean up old formulas once new one is verified
// min *= (0.5 + 0.0075 * pc.getStatIntCurrent() + 0.011 * pc.getStatSpiCurrent() + 0.0196 * focus);
// max *= (0.62 + 0.0192 * pc.getStatIntCurrent() + 0.00415 * pc.getStatSpiCurrent() + 0.015 * focus);
float intt = (pc.getStatIntCurrent() >= 1) ? (float)pc.getStatIntCurrent() : 1f;
float spi = (pc.getStatSpiCurrent() >= 1) ? (float)pc.getStatSpiCurrent() : 1f;
// min *= (intt * 0.0045 + 0.055 * (float)Math.sqrt(intt - 0.5) + spi * 0.006 + 0.07 * (float)Math.sqrt(spi - 0.5) + 0.02 * (int)focus);
// max *= (intt * 0.0117 + 0.13 * (float)Math.sqrt(intt - 0.5) + spi * 0.0024 + (float)Math.sqrt(spi - 0.5) * 0.021 + 0.015 * (int)focus);
min = HealthEffectModifier.getMinDamage(min, intt, spi, focus);
max = HealthEffectModifier.getMaxDamage(max, intt, spi, focus);
//debug for spell damage and atr
if (source.getDebug(16) && source.getObjectType().equals(GameObjectType.PlayerCharacter)) {
PlayerCharacter pc = (PlayerCharacter) source;
String smsg = "Percent Damage: " + mod * 100 + '%';
ChatManager.chatSystemInfo(pc, smsg);
}
}
//debug for spell damage and atr
if (pc.getDebug(16)) {
String smsg = "Damage: " + (int)Math.abs(min) + " - " + (int)Math.abs(max);
ChatManager.chatSystemInfo(pc, smsg);
}
}else if (source.getObjectType() == GameObjectType.Mob){
Mob pc = (Mob) source;
// Modify health by min/max amount
else if (this.minMod != 0f || this.maxMod != 0f) {
float min = this.minMod;
float max = this.maxMod;
if (this.ramp > 0f) {
float mod = this.ramp * trains;
if (this.useRampAdd) {
min += mod;
max += mod;
} else {
min *= (1 + mod);
max *= (1 + mod);
}
}
if (source.getObjectType().equals(GameObjectType.PlayerCharacter)) {
PlayerCharacter pc = (PlayerCharacter) source;
float focus;
CharacterSkill skill = pc.getSkills().get(effect.getPower().getSkillName());
if (skill == null)
focus = CharacterSkill.getQuickMastery(pc, effect.getPower().getSkillName());
else
focus = skill.getModifiedAmount();
//TODO clean up old formulas once new one is verified
// min *= (0.5 + 0.0075 * pc.getStatIntCurrent() + 0.011 * pc.getStatSpiCurrent() + 0.0196 * focus);
// max *= (0.62 + 0.0192 * pc.getStatIntCurrent() + 0.00415 * pc.getStatSpiCurrent() + 0.015 * focus);
float intt = (pc.getStatIntCurrent() >= 1) ? (float)pc.getStatIntCurrent() : 1f;
float focus;
CharacterSkill skill = pc.getSkills().get(effect.getPower().getSkillName());
if (skill == null)
focus = CharacterSkill.getQuickMastery(pc, effect.getPower().getSkillName());
else
focus = skill.getModifiedAmount();
//TODO clean up old formulas once new one is verified
// min *= (0.5 + 0.0075 * pc.getStatIntCurrent() + 0.011 * pc.getStatSpiCurrent() + 0.0196 * focus);
// max *= (0.62 + 0.0192 * pc.getStatIntCurrent() + 0.00415 * pc.getStatSpiCurrent() + 0.015 * focus);
float intt = (pc.getStatIntCurrent() >= 1) ? (float) pc.getStatIntCurrent() : 1f;
float spi = (pc.getStatSpiCurrent() >= 1) ? (float) pc.getStatSpiCurrent() : 1f;
// min *= (intt * 0.0045 + 0.055 * (float)Math.sqrt(intt - 0.5) + spi * 0.006 + 0.07 * (float)Math.sqrt(spi - 0.5) + 0.02 * (int)focus);
// max *= (intt * 0.0117 + 0.13 * (float)Math.sqrt(intt - 0.5) + spi * 0.0024 + (float)Math.sqrt(spi - 0.5) * 0.021 + 0.015 * (int)focus);
min = HealthEffectModifier.getMinDamage(min, intt, spi, focus);
max = HealthEffectModifier.getMaxDamage(max, intt, spi, focus);
if (pc.isPlayerGuard())
intt = 200;
float spi = (pc.getStatSpiCurrent() >= 1) ? (float)pc.getStatSpiCurrent() : 1f;
//debug for spell damage and atr
if (pc.getDebug(16)) {
String smsg = "Damage: " + (int) Math.abs(min) + " - " + (int) Math.abs(max);
ChatManager.chatSystemInfo(pc, smsg);
}
} else if (source.getObjectType() == GameObjectType.Mob) {
Mob pc = (Mob) source;
if (pc.isPlayerGuard())
spi = 200;
// min *= (intt * 0.0045 + 0.055 * (float)Math.sqrt(intt - 0.5) + spi * 0.006 + 0.07 * (float)Math.sqrt(spi - 0.5) + 0.02 * (int)focus);
// max *= (intt * 0.0117 + 0.13 * (float)Math.sqrt(intt - 0.5) + spi * 0.0024 + (float)Math.sqrt(spi - 0.5) * 0.021 + 0.015 * (int)focus);
min = HealthEffectModifier.getMinDamage(min, intt, spi, focus);
max = HealthEffectModifier.getMaxDamage(max, intt, spi, focus);
float focus;
CharacterSkill skill = pc.getSkills().get(effect.getPower().getSkillName());
if (skill == null)
focus = CharacterSkill.getQuickMastery(pc, effect.getPower().getSkillName());
else
focus = skill.getModifiedAmount();
//TODO clean up old formulas once new one is verified
// min *= (0.5 + 0.0075 * pc.getStatIntCurrent() + 0.011 * pc.getStatSpiCurrent() + 0.0196 * focus);
// max *= (0.62 + 0.0192 * pc.getStatIntCurrent() + 0.00415 * pc.getStatSpiCurrent() + 0.015 * focus);
float intt = (pc.getStatIntCurrent() >= 1) ? (float) pc.getStatIntCurrent() : 1f;
//debug for spell damage and atr
// if (pc.getDebug(16)) {
// String smsg = "Damage: " + (int)Math.abs(min) + " - " + (int)Math.abs(max);
// ChatManager.chatSystemInfo(pc, smsg);
// }
}
modAmount = calculateDamage(source, min, max, awo, trains);
PlayerBonuses bonus = source.getBonuses();
if (pc.isPlayerGuard())
intt = 200;
float spi = (pc.getStatSpiCurrent() >= 1) ? (float) pc.getStatSpiCurrent() : 1f;
// Apply any power effect modifiers (such as stances)
if (bonus != null)
modAmount *= (1 + (bonus.getFloatPercentAll(ModType.PowerDamageModifier, SourceType.None)));
}
if (modAmount == 0f)
return;
if (AbstractWorldObject.IsAbstractCharacter(awo)) {
AbstractCharacter ac = (AbstractCharacter) awo;
if (pc.isPlayerGuard())
spi = 200;
// min *= (intt * 0.0045 + 0.055 * (float)Math.sqrt(intt - 0.5) + spi * 0.006 + 0.07 * (float)Math.sqrt(spi - 0.5) + 0.02 * (int)focus);
// max *= (intt * 0.0117 + 0.13 * (float)Math.sqrt(intt - 0.5) + spi * 0.0024 + (float)Math.sqrt(spi - 0.5) * 0.021 + 0.015 * (int)focus);
min = HealthEffectModifier.getMinDamage(min, intt, spi, focus);
max = HealthEffectModifier.getMaxDamage(max, intt, spi, focus);
if (!ac.isAlive())
return;
//debug for spell damage and atr
// if (pc.getDebug(16)) {
// String smsg = "Damage: " + (int)Math.abs(min) + " - " + (int)Math.abs(max);
// ChatManager.chatSystemInfo(pc, smsg);
// }
}
modAmount = calculateDamage(source, min, max, awo, trains);
PlayerBonuses bonus = source.getBonuses();
int powerID = 0, effectID = 0;
String powerName = "";
if (effect.getPower() != null) {
powerID = effect.getPower().getToken();
powerName = effect.getPower().getName();
} else {
Logger.error("Power has returned null! Damage will fail to register! (" + (ac.getCurrentHitpoints()>0?"Alive)":"Dead)"));
}
// Apply any power effect modifiers (such as stances)
if (bonus != null)
modAmount *= (1 + (bonus.getFloatPercentAll(ModType.PowerDamageModifier, SourceType.None)));
}
if (modAmount == 0f)
return;
if (AbstractWorldObject.IsAbstractCharacter(awo)) {
AbstractCharacter ac = (AbstractCharacter) awo;
if (effect.getEffect() != null) {
effectID = effect.getEffect().getToken();
} else {
Logger.error("Effect has returned null! Damage will fail to register! (" + (ac.getCurrentHitpoints()>0?"Alive)":"Dead)"));
}
if (!ac.isAlive())
return;
//see if target is immune to heals
if (modAmount > 0f) {
boolean skipImmune = false;
// first tick of HoT going thru SM was removed in a later patch
int powerID = 0, effectID = 0;
String powerName = "";
if (effect.getPower() != null) {
powerID = effect.getPower().getToken();
powerName = effect.getPower().getName();
} else {
Logger.error("Power has returned null! Damage will fail to register! (" + (ac.getCurrentHitpoints() > 0 ? "Alive)" : "Dead)"));
}
if (effect.getEffect() != null) {
effectID = effect.getEffect().getToken();
} else {
Logger.error("Effect has returned null! Damage will fail to register! (" + (ac.getCurrentHitpoints() > 0 ? "Alive)" : "Dead)"));
}
//see if target is immune to heals
if (modAmount > 0f) {
boolean skipImmune = false;
// first tick of HoT going thru SM was removed in a later patch
/*if (effect.getAction().getPowerAction() instanceof DirectDamagePowerAction) {
ArrayList<ActionsBase> actions = effect.getPower().getActions();
for (ActionsBase ab : actions) {
@@ -194,138 +204,131 @@ public class HealthEffectModifier extends AbstractEffectModifier {
}
}*/
PlayerBonuses bonus = ac.getBonuses();
if (!skipImmune && bonus.getFloat(ModType.BlackMantle, SourceType.Heal) >= trains) {
ModifyHealthMsg mhm = new ModifyHealthMsg(source, ac, 0f, 0f, 0f, powerID, powerName, trains, effectID);
mhm.setUnknown03(5); //set target is immune
DispatchMessage.sendToAllInRange(ac, mhm);
return;
}
}
float mod = 0;
PlayerBonuses bonus = ac.getBonuses();
if (!skipImmune && bonus.getFloat(ModType.BlackMantle, SourceType.Heal) >= trains) {
ModifyHealthMsg mhm = new ModifyHealthMsg(source, ac, 0f, 0f, 0f, powerID, powerName, trains, effectID);
mhm.setUnknown03(5); //set target is immune
DispatchMessage.sendToAllInRange(ac, mhm);
return;
}
}
float mod = 0;
//Modify health
//Modify health
mod = ac.modifyHealth(modAmount, source, false);
mod = ac.modifyHealth(modAmount, source, false);
float cur = awo.getCurrentHitpoints();
float maxAmount = awo.getHealthMax() - cur;
float cur = awo.getCurrentHitpoints();
float maxAmount = awo.getHealthMax() - cur;
AbstractNetMsg mhm = null;
if (modAmount < 0 && cur < 0 && mod != 0)
mhm = new ModifyHealthKillMsg(source, ac, modAmount, 0f, 0f, powerID, powerName, trains, effectID);
else
mhm = new ModifyHealthMsg(source, ac, modAmount, 0f, 0f, powerID, powerName, trains, effectID);
AbstractNetMsg mhm = null;
if (modAmount < 0 && cur < 0 && mod != 0)
mhm = new ModifyHealthKillMsg(source, ac, modAmount, 0f, 0f, powerID, powerName, trains, effectID);
else
mhm = new ModifyHealthMsg(source, ac, modAmount, 0f, 0f, powerID, powerName, trains, effectID);
if (effect instanceof DamageOverTimeJob) {
if (mhm instanceof ModifyHealthMsg)
((ModifyHealthMsg)mhm).setOmitFromChat(1);
else if (mhm instanceof ModifyHealthKillMsg)
((ModifyHealthKillMsg)mhm).setUnknown02(1);
}
if (effect instanceof DamageOverTimeJob) {
if (mhm instanceof ModifyHealthMsg)
((ModifyHealthMsg) mhm).setOmitFromChat(1);
else if (mhm instanceof ModifyHealthKillMsg)
((ModifyHealthKillMsg) mhm).setUnknown02(1);
}
//send the damage
//send the damage
DispatchMessage.sendToAllInRange(ac, mhm);
DispatchMessage.sendToAllInRange(ac, mhm);
// //send corpse if this kills a mob
// //TODO fix the someone misses blurb.
// if(awo instanceof Mob && awo.getHealth() <= 0) {
// CombatMessageMsg cmm = new CombatMessageMsg(null, 0, awo, 15);
// try {
// DispatchMessage.sendToAllInRange(ac, cmm);
// } catch (MsgSendException e) {
// Logger.error("MobCorpseSendError", e);
// }
// }
} else if (awo.getObjectType().equals(GameObjectType.Building)) {
// //send corpse if this kills a mob
// //TODO fix the someone misses blurb.
// if(awo instanceof Mob && awo.getHealth() <= 0) {
// CombatMessageMsg cmm = new CombatMessageMsg(null, 0, awo, 15);
// try {
// DispatchMessage.sendToAllInRange(ac, cmm);
// } catch (MsgSendException e) {
// Logger.error("MobCorpseSendError", e);
// }
// }
} else if (awo.getObjectType().equals(GameObjectType.Building)) {
Building b = (Building) awo;
Building b = (Building) awo;
if (modAmount < 0 && (!b.isVulnerable()))
return; //can't damage invul building
if (modAmount < 0 && (!b.isVulnerable()))
return; //can't damage invul building
int powerID = 0, effectID = 0;
String powerName = "";
if (effect.getPower() != null) {
powerID = effect.getPower().getToken();
powerName = effect.getPower().getName();
} else
Logger.error("Power has returned null! Damage will fail to register! (" + (b.getRank() == -1 ? "Standing)" : "Destroyed)"));
int powerID = 0, effectID = 0;
String powerName = "";
if (effect.getPower() != null) {
powerID = effect.getPower().getToken();
powerName = effect.getPower().getName();
} else
Logger.error("Power has returned null! Damage will fail to register! (" + (b.getRank() == -1 ? "Standing)" : "Destroyed)"));
if (effect.getEffect() != null) {
effectID = effect.getEffect().getToken();
} else
Logger.error("Effect has returned null! Damage will fail to register! (" + (b.getRank() == -1 ? "Standing)" : "Destroyed)"));
if (effect.getEffect() != null) {
effectID = effect.getEffect().getToken();
} else
Logger.error("Effect has returned null! Damage will fail to register! (" + (b.getRank() == -1 ? "Standing)" : "Destroyed)"));
float mod = b.modifyHealth(modAmount, source);
ModifyHealthMsg mhm = new ModifyHealthMsg(source, b, modAmount, 0f, 0f, powerID, powerName, trains, effectID);
float mod = b.modifyHealth(modAmount, source);
ModifyHealthMsg mhm = new ModifyHealthMsg(source, b, modAmount, 0f, 0f, powerID, powerName, trains, effectID);
if (effect instanceof DamageOverTimeJob)
mhm.setOmitFromChat(1);
if (effect instanceof DamageOverTimeJob)
mhm.setOmitFromChat(1);
//send the damage
//send the damage
DispatchMessage.sendToAllInRange(b, mhm);
DispatchMessage.sendToAllInRange(b, mhm);
}
}
}
}
private float calculateDamage(AbstractCharacter source, float minDamage, float maxDamage, AbstractWorldObject awo, int trains) {
private float calculateDamage(AbstractCharacter source, float minDamage, float maxDamage, AbstractWorldObject awo, int trains) {
// get range between min and max
float range = maxDamage - minDamage;
// get range between min and max
float range = maxDamage - minDamage;
// Damage is calculated twice to average a more central point
float damage = ThreadLocalRandom.current().nextFloat() * range;
damage = (damage + (ThreadLocalRandom.current().nextFloat() * range)) / 2;
// Damage is calculated twice to average a more central point
float damage = ThreadLocalRandom.current().nextFloat() * range;
damage = (damage + (ThreadLocalRandom.current().nextFloat() * range)) / 2;
// put it back between min and max
damage += minDamage;
// put it back between min and max
damage += minDamage;
Resists resists = null;
// get resists
if (AbstractWorldObject.IsAbstractCharacter(awo)) {
AbstractCharacter ac = (AbstractCharacter) awo;
resists = ac.getResists();
} else if (awo.getObjectType().equals(GameObjectType.Building))
resists = ((Building) awo).getResists();
Resists resists = null;
// get resists
if (AbstractWorldObject.IsAbstractCharacter(awo)) {
AbstractCharacter ac = (AbstractCharacter) awo;
resists = ac.getResists();
} else if (awo.getObjectType().equals(GameObjectType.Building))
resists = ((Building) awo).getResists();
// calculate resists in if any
if (resists != null) {
if (AbstractWorldObject.IsAbstractCharacter(awo))
damage = resists.getResistedDamage(source, (AbstractCharacter) awo, damageType, damage * -1, trains) * -1;
else
damage = resists.getResistedDamage(source, null, damageType, damage * -1, trains) * -1;
}
// calculate resists in if any
if (resists != null) {
if (AbstractWorldObject.IsAbstractCharacter(awo))
damage = resists.getResistedDamage(source, (AbstractCharacter) awo, damageType, damage * -1, trains) * -1;
else
damage = resists.getResistedDamage(source, null, damageType, damage * -1, trains) * -1;
}
if (AbstractWorldObject.IsAbstractCharacter(awo)) {
AbstractCharacter ac = (AbstractCharacter) awo;
if (ac.isSit())
damage *= 2.5f; // increase damage if sitting
}
if (AbstractWorldObject.IsAbstractCharacter(awo)) {
AbstractCharacter ac = (AbstractCharacter) awo;
if (ac.isSit())
damage *= 2.5f; // increase damage if sitting
}
return damage;
}
return damage;
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
}
}
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Item item, int trains) {
}
public static float getMinDamage(float baseMin, float intelligence, float spirit, float focus) {
float min = baseMin * (((float)Math.pow(intelligence, 0.75f) * 0.0311f) + (0.02f * (int)focus) + ((float)Math.pow(spirit, 0.75f) * 0.0416f));
return (float)((int)(min + 0.5f)); //round to nearest whole number
}
public static float getMaxDamage(float baseMax, float intelligence, float spirit, float focus) {
float max = baseMax * (((float)Math.pow(intelligence, 0.75f) * 0.0785f) + (0.015f * (int)focus) + ((float)Math.pow(spirit, 0.75f) * 0.0157f));
return (float)((int)(max + 0.5f)); //round to nearest whole number
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -17,37 +17,40 @@ import java.sql.SQLException;
public class HealthFullEffectModifier extends AbstractEffectModifier {
public HealthFullEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public HealthFullEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
Float amount = 0f;
PlayerBonuses bonus = ac.getBonuses();
if (this.percentMod != 0f) { //Stat Percent Modifiers
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
amount = amount/100;
bonus.addFloat(this, amount);
} else { //Stat Modifiers
if (this.useRampAdd)
amount = this.minMod + (this.ramp * trains);
else
amount = this.minMod * (1 + (this.ramp * trains));
bonus.addFloat(this, amount);
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
Float amount = 0f;
PlayerBonuses bonus = ac.getBonuses();
if (this.percentMod != 0f) { //Stat Percent Modifiers
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
amount = amount / 100;
bonus.addFloat(this, amount);
} else { //Stat Modifiers
if (this.useRampAdd)
amount = this.minMod + (this.ramp * trains);
else
amount = this.minMod * (1 + (this.ramp * trains));
bonus.addFloat(this, amount);
}
}
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -17,31 +17,34 @@ import java.sql.SQLException;
public class HealthRecoverRateEffectModifier extends AbstractEffectModifier {
public HealthRecoverRateEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public HealthRecoverRateEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
ac.update();
Float amount = 0f;
PlayerBonuses bonus = ac.getBonuses();
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
amount = amount/100;
bonus.multRegen(this.modType, amount); //positive regen modifiers
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
ac.update();
Float amount = 0f;
PlayerBonuses bonus = ac.getBonuses();
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
amount = amount / 100;
bonus.multRegen(this.modType, amount); //positive regen modifiers
}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -18,29 +18,32 @@ import java.util.HashSet;
public class IgnoreDamageCapEffectModifier extends AbstractEffectModifier {
public IgnoreDamageCapEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public IgnoreDamageCapEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
PlayerBonuses bonus = ac.getBonuses();
if (bonus == null)
return;
if (bonus.getList(this.modType) == null)
bonus.setList(this.modType, new HashSet<>());
bonus.getList(this.modType).add(this.sourceType);
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
PlayerBonuses bonus = ac.getBonuses();
if (bonus == null)
return;
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
if (bonus.getList(this.modType) == null)
bonus.setList(this.modType, new HashSet<>());
bonus.getList(this.modType).add(this.sourceType);
}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -17,23 +17,26 @@ import java.sql.SQLException;
public class IgnorePassiveDefenseEffectModifier extends AbstractEffectModifier {
public IgnorePassiveDefenseEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public IgnorePassiveDefenseEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
PlayerBonuses bonus = ac.getBonuses();
bonus.setBool(this.modType,this.sourceType,true);
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
PlayerBonuses bonus = ac.getBonuses();
bonus.setBool(this.modType, this.sourceType, true);
}
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -17,24 +17,27 @@ import java.sql.SQLException;
public class ImmuneToAttackEffectModifier extends AbstractEffectModifier {
public ImmuneToAttackEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public ImmuneToAttackEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
PlayerBonuses bonus = ac.getBonuses();
bonus.setBool(this.modType,this.sourceType,true);
}
PlayerBonuses bonus = ac.getBonuses();
bonus.setBool(this.modType, this.sourceType, true);
}
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -17,23 +17,26 @@ import java.sql.SQLException;
public class ImmuneToEffectModifier extends AbstractEffectModifier {
public ImmuneToEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public ImmuneToEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
PlayerBonuses bonus = ac.getBonuses();
bonus.setBool(this.modType,this.sourceType,true);
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
PlayerBonuses bonus = ac.getBonuses();
bonus.setBool(this.modType, this.sourceType, true);
}
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -17,24 +17,27 @@ import java.sql.SQLException;
public class ImmuneToPowersEffectModifier extends AbstractEffectModifier {
public ImmuneToPowersEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public ImmuneToPowersEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
PlayerBonuses bonus = ac.getBonuses();
bonus.setBool(this.modType,this.sourceType,true);
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
PlayerBonuses bonus = ac.getBonuses();
bonus.setBool(this.modType, this.sourceType, true);
}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -23,60 +23,62 @@ import java.sql.SQLException;
public class InvisibleEffectModifier extends AbstractEffectModifier {
public InvisibleEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public InvisibleEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
if (awo.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
PlayerCharacter pc = (PlayerCharacter) awo;
if (awo.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
PlayerCharacter pc = (PlayerCharacter) awo;
if (effect == null)
return;
if (effect == null)
return;
PowersBase pb = effect.getPower();
if (pb == null)
return;
PowersBase pb = effect.getPower();
if (pb == null)
return;
ActionsBase ab = effect.getAction();
ActionsBase ab = effect.getAction();
if (ab == null)
return;
if (ab == null)
return;
//send invis message to everyone around.
ClientConnection origin = SessionManager.getClientConnection(pc);
if (origin == null)
return;
//send invis message to everyone around.
ClientConnection origin = SessionManager.getClientConnection(pc);
if (origin == null)
return;
ab.getDurationInSeconds(trains);
ab.getDurationInSeconds(trains);
pc.setHidden(trains);
pc.setHidden(trains);
pc.setTimeStampNow("Invis");
pc.setTimeStampNow("Invis");
}
else {
Logger.error( "Cannot go invis on a non player.");
}
}
} else {
Logger.error("Cannot go invis on a non player.");
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
if (ac == null)
return;
PlayerBonuses bonus = ac.getBonuses();
if (bonus != null)
bonus.updateIfHigher(this, (float)trains);
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
if (ac == null)
return;
PlayerBonuses bonus = ac.getBonuses();
if (bonus != null)
bonus.updateIfHigher(this, (float) trains);
//remove pets
if (ac.getObjectType().equals(Enum.GameObjectType.PlayerCharacter))
((PlayerCharacter)ac).dismissPet();
}
//remove pets
if (ac.getObjectType().equals(Enum.GameObjectType.PlayerCharacter))
((PlayerCharacter) ac).dismissPet();
}
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -21,83 +21,126 @@ import java.sql.SQLException;
public class ItemNameEffectModifier extends AbstractEffectModifier {
public String name = "";
public String name = "";
public ItemNameEffectModifier(ResultSet rs) throws SQLException {
super(rs);
public ItemNameEffectModifier(ResultSet rs) throws SQLException {
super(rs);
//We're going to add effect names to a lookup map for ./makeitem
int ID = rs.getInt("ID");
switch (ID) { //don't add these ID's to the name list. They're duplicates
case 4259: return;
case 4210: return;
case 4: return;
case 97: return;
case 610: return;
case 4442: return;
case 5106: return;
case 4637: return;
case 2271: return;
case 587: return;
case 600: return;
case 3191: return;
case 3589: return;
case 3950: return;
case 3499: return;
case 4925: return;
case 15: return;
case 5101: return;
case 2418: return;
case 183: return;
case 373: return;
case 1893: return;
case 3127: return;
case 1232: return;
case 4522: return;
case 4817: return;
case 2833: return;
case 4469: return;
case 2122: return;
case 3057: return;
case 3070: return;
case 191: return;
case 3117: return;
case 3702: return;
case 1619: return;
case 2584: return;
case 414: return;
case 2078: return;
case 4844: return;
case 2275: return;
}
//We're going to add effect names to a lookup map for ./makeitem
int ID = rs.getInt("ID");
switch (ID) { //don't add these ID's to the name list. They're duplicates
case 4259:
return;
case 4210:
return;
case 4:
return;
case 97:
return;
case 610:
return;
case 4442:
return;
case 5106:
return;
case 4637:
return;
case 2271:
return;
case 587:
return;
case 600:
return;
case 3191:
return;
case 3589:
return;
case 3950:
return;
case 3499:
return;
case 4925:
return;
case 15:
return;
case 5101:
return;
case 2418:
return;
case 183:
return;
case 373:
return;
case 1893:
return;
case 3127:
return;
case 1232:
return;
case 4522:
return;
case 4817:
return;
case 2833:
return;
case 4469:
return;
case 2122:
return;
case 3057:
return;
case 3070:
return;
case 191:
return;
case 3117:
return;
case 3702:
return;
case 1619:
return;
case 2584:
return;
case 414:
return;
case 2078:
return;
case 4844:
return;
case 2275:
return;
}
String namePre = rs.getString("string1");
String nameSuf = rs.getString("string2");
String n = (namePre.isEmpty()) ? nameSuf : namePre;
this.name = n;
n = n.toLowerCase();
n = n.replace(" ", "_");
String IDString = rs.getString("IDString");
IDString = IDString.substring(0, IDString.length() - 1);
EffectsBase.addItemEffectsByName(n, IDString);
}
String namePre = rs.getString("string1");
String nameSuf = rs.getString("string2");
String n = (namePre.isEmpty()) ? nameSuf : namePre;
this.name = n;
n = n.toLowerCase();
n = n.replace(" ", "_");
String IDString = rs.getString("IDString");
IDString = IDString.substring(0, IDString.length() - 1);
EffectsBase.addItemEffectsByName(n, IDString);
}
public String getName() {
return this.name;
}
public String getName() {
return this.name;
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
}
}
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -7,9 +7,6 @@
// www.magicbane.com
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
@@ -44,189 +41,192 @@ import java.util.concurrent.ThreadLocalRandom;
public class ManaEffectModifier extends AbstractEffectModifier {
private DamageType damageType;
private DamageType damageType;
public ManaEffectModifier(ResultSet rs) throws SQLException {
super(rs);
String damageTypeDB = rs.getString("type");
try {
this.damageType = DamageType.valueOf(damageTypeDB);
} catch (IllegalArgumentException e) {
Logger.error("DamageType could not be loaded from database. " + "UUID = " + this.UUID
+ " value received = '" + damageTypeDB + '\'', e);
}
}
public ManaEffectModifier(ResultSet rs) throws SQLException {
super(rs);
String damageTypeDB = rs.getString("type");
try {
this.damageType = DamageType.valueOf(damageTypeDB);
} catch (IllegalArgumentException e) {
Logger.error("DamageType could not be loaded from database. " + "UUID = " + this.UUID
+ " value received = '" + damageTypeDB + '\'', e);
}
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
if (awo == null) {
Logger.error( "_applyEffectModifier(): NULL AWO passed in.");
return;
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
if (awo == null) {
Logger.error("_applyEffectModifier(): NULL AWO passed in.");
return;
}
if (effect == null) {
Logger.error( "_applyEffectModifier(): NULL AbstractEffectJob passed in.");
return;
}
if (effect == null) {
Logger.error("_applyEffectModifier(): NULL AbstractEffectJob passed in.");
return;
}
if (!AbstractWorldObject.IsAbstractCharacter(awo))
return;
AbstractCharacter awoac = (AbstractCharacter) awo;
if (!AbstractWorldObject.IsAbstractCharacter(awo))
return;
AbstractCharacter awoac = (AbstractCharacter) awo;
float modAmount = 0f;
float modAmount = 0f;
// Modify Mana by percent
if (this.percentMod != 0f) {
// Modify Mana by percent
if (this.percentMod != 0f) {
float mod = 1f;
if (this.useRampAdd)
mod = (this.percentMod + (this.ramp * trains)) / 100;
else
mod = (this.percentMod * (1 + (this.ramp * trains))) / 100;
modAmount = mod * awoac.getManaMax();
float mod = 1f;
if (this.useRampAdd)
mod = (this.percentMod + (this.ramp * trains)) / 100;
else
mod = (this.percentMod * (1 + (this.ramp * trains))) / 100;
modAmount = mod * awoac.getManaMax();
if (awoac.isSit())
modAmount *= 2.5f;
if (awoac.isSit())
modAmount *= 2.5f;
//debug for spell damage and atr
if (source.getDebug(16) && source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
//debug for spell damage and atr
if (source.getDebug(16) && source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
PlayerCharacter pc = (PlayerCharacter) source;
String smsg = "Percent Damage: " + mod * 100 + '%';
PlayerCharacter pc = (PlayerCharacter) source;
String smsg = "Percent Damage: " + mod * 100 + '%';
ChatManager.chatSystemInfo(pc, smsg);
}
}
ChatManager.chatSystemInfo(pc, smsg);
}
}
// Modify health by min/max amount
else if (this.minMod != 0f || this.maxMod != 0f) {
float min = this.minMod;
float max = this.maxMod;
if (this.ramp > 0f) {
float mod = this.ramp * trains;
if (this.useRampAdd) {
min += mod;
max += mod;
} else {
min *= (1 + mod);
max *= (1 + mod);
}
}
if (source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
PlayerCharacter pc = (PlayerCharacter) source;
// Modify health by min/max amount
else if (this.minMod != 0f || this.maxMod != 0f) {
float min = this.minMod;
float max = this.maxMod;
if (this.ramp > 0f) {
float mod = this.ramp * trains;
if (this.useRampAdd) {
min += mod;
max += mod;
} else {
min *= (1 + mod);
max *= (1 + mod);
}
}
if (source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
PlayerCharacter pc = (PlayerCharacter) source;
float focus;
CharacterSkill skill = pc.getSkills().get(effect.getPower().getSkillName());
if (skill == null)
focus = CharacterSkill.getQuickMastery(pc, effect.getPower().getSkillName());
else
focus = skill.getModifiedAmount();
//TODO clean up old formulas once new one is verified
// min *= (0.5 + 0.0075 * pc.getStatIntCurrent() + 0.011 * pc.getStatSpiCurrent() + 0.0196 * focus);
// max *= (0.62 + 0.0192 * pc.getStatIntCurrent() + 0.00415 * pc.getStatSpiCurrent() + 0.015 * focus);
float intt = (pc.getStatIntCurrent() >= 1) ? (float)pc.getStatIntCurrent() : 1f;
float spi = (pc.getStatSpiCurrent() >= 1) ? (float)pc.getStatSpiCurrent() : 1f;
// min *= (intt * 0.0045 + 0.055 * (float)Math.sqrt(intt - 0.5) + spi * 0.006 + 0.07 * (float)Math.sqrt(spi - 0.5) + 0.02 * (int)focus);
// max *= (intt * 0.0117 + 0.13 * (float)Math.sqrt(intt - 0.5) + spi * 0.0024 + (float)Math.sqrt(spi - 0.5) * 0.021 + 0.015 * (int)focus);
min = HealthEffectModifier.getMinDamage(min, intt, spi, focus);
max = HealthEffectModifier.getMaxDamage(max, intt, spi, focus);
float focus;
CharacterSkill skill = pc.getSkills().get(effect.getPower().getSkillName());
if (skill == null)
focus = CharacterSkill.getQuickMastery(pc, effect.getPower().getSkillName());
else
focus = skill.getModifiedAmount();
//TODO clean up old formulas once new one is verified
// min *= (0.5 + 0.0075 * pc.getStatIntCurrent() + 0.011 * pc.getStatSpiCurrent() + 0.0196 * focus);
// max *= (0.62 + 0.0192 * pc.getStatIntCurrent() + 0.00415 * pc.getStatSpiCurrent() + 0.015 * focus);
float intt = (pc.getStatIntCurrent() >= 1) ? (float) pc.getStatIntCurrent() : 1f;
float spi = (pc.getStatSpiCurrent() >= 1) ? (float) pc.getStatSpiCurrent() : 1f;
// min *= (intt * 0.0045 + 0.055 * (float)Math.sqrt(intt - 0.5) + spi * 0.006 + 0.07 * (float)Math.sqrt(spi - 0.5) + 0.02 * (int)focus);
// max *= (intt * 0.0117 + 0.13 * (float)Math.sqrt(intt - 0.5) + spi * 0.0024 + (float)Math.sqrt(spi - 0.5) * 0.021 + 0.015 * (int)focus);
min = HealthEffectModifier.getMinDamage(min, intt, spi, focus);
max = HealthEffectModifier.getMaxDamage(max, intt, spi, focus);
//debug for spell damage and atr
if (pc.getDebug(16)) {
String smsg = "Damage: " + (int)Math.abs(min) + " - " + (int)Math.abs(max);
ChatManager.chatSystemInfo(pc, smsg);
}
}
modAmount = calculateDamage(source, awoac, min, max, awo, trains);
PlayerBonuses bonus = source.getBonuses();
//debug for spell damage and atr
if (pc.getDebug(16)) {
String smsg = "Damage: " + (int) Math.abs(min) + " - " + (int) Math.abs(max);
ChatManager.chatSystemInfo(pc, smsg);
}
}
modAmount = calculateDamage(source, awoac, min, max, awo, trains);
PlayerBonuses bonus = source.getBonuses();
// Apply any power effect modifiers (such as stances)
if (bonus != null)
modAmount *= (1 + bonus.getFloatPercentAll(ModType.PowerDamageModifier, SourceType.None));
}
if (modAmount == 0f)
return;
if (AbstractWorldObject.IsAbstractCharacter(awo)) {
AbstractCharacter ac = (AbstractCharacter) awo;
int powerID = 0, effectID = 0;
String powerName = "";
if (effect.getPower() != null) {
powerID = effect.getPower().getToken();
powerName = effect.getPower().getName();
}
if (effect.getEffect() != null) {
effectID = effect.getEffect().getToken();
}
// Apply any power effect modifiers (such as stances)
if (bonus != null)
modAmount *= (1 + bonus.getFloatPercentAll(ModType.PowerDamageModifier, SourceType.None));
}
if (modAmount == 0f)
return;
if (AbstractWorldObject.IsAbstractCharacter(awo)) {
AbstractCharacter ac = (AbstractCharacter) awo;
int powerID = 0, effectID = 0;
String powerName = "";
if (effect.getPower() != null) {
powerID = effect.getPower().getToken();
powerName = effect.getPower().getName();
}
if (effect.getEffect() != null) {
effectID = effect.getEffect().getToken();
}
//see if target is immune to heals
if (modAmount > 0f) {
boolean skipImmune = false;
if (effect.getAction().getPowerAction() instanceof DirectDamagePowerAction) {
ArrayList<ActionsBase> actions = effect.getPower().getActions();
for (ActionsBase ab : actions) {
AbstractPowerAction apa = ab.getPowerAction();
if (apa instanceof DamageOverTimePowerAction)
skipImmune = true;
}
}
PlayerBonuses bonus = ac.getBonuses();
if (!skipImmune && bonus.getFloat(ModType.BlackMantle, SourceType.Heal) >= trains) {
ModifyHealthMsg mhm = new ModifyHealthMsg(source, ac, 0f, 0f, 0f, powerID, powerName, trains, effectID);
mhm.setUnknown03(5); //set target is immune
DispatchMessage.sendToAllInRange(ac, mhm);
return;
}
}
//see if target is immune to heals
if (modAmount > 0f) {
boolean skipImmune = false;
if (effect.getAction().getPowerAction() instanceof DirectDamagePowerAction) {
ArrayList<ActionsBase> actions = effect.getPower().getActions();
for (ActionsBase ab : actions) {
AbstractPowerAction apa = ab.getPowerAction();
if (apa instanceof DamageOverTimePowerAction)
skipImmune = true;
}
}
PlayerBonuses bonus = ac.getBonuses();
if (!skipImmune && bonus.getFloat(ModType.BlackMantle, SourceType.Heal) >= trains) {
ModifyHealthMsg mhm = new ModifyHealthMsg(source, ac, 0f, 0f, 0f, powerID, powerName, trains, effectID);
mhm.setUnknown03(5); //set target is immune
DispatchMessage.sendToAllInRange(ac, mhm);
return;
}
}
ac.modifyMana(modAmount, source);
ac.modifyMana(modAmount, source);
ModifyHealthMsg mhm = new ModifyHealthMsg(source, ac, 0f, modAmount, 0f, powerID, powerName, trains,
effectID);
if (effect instanceof DamageOverTimeJob)
mhm.setOmitFromChat(1);
DispatchMessage.sendToAllInRange(ac, mhm);
}
}
ModifyHealthMsg mhm = new ModifyHealthMsg(source, ac, 0f, modAmount, 0f, powerID, powerName, trains,
effectID);
if (effect instanceof DamageOverTimeJob)
mhm.setOmitFromChat(1);
DispatchMessage.sendToAllInRange(ac, mhm);
}
}
private float calculateDamage(AbstractCharacter source, AbstractCharacter target, float minDamage, float maxDamage, AbstractWorldObject awo, int trains) {
// get range between min and max
float range = maxDamage - minDamage;
private float calculateDamage(AbstractCharacter source, AbstractCharacter target, float minDamage, float maxDamage, AbstractWorldObject awo, int trains) {
// get range between min and max
float range = maxDamage - minDamage;
// Damage is calculated twice to average a more central point
float damage = ThreadLocalRandom.current().nextFloat() * range;
damage = (damage + (ThreadLocalRandom.current().nextFloat() * range)) / 2;
// Damage is calculated twice to average a more central point
float damage = ThreadLocalRandom.current().nextFloat() * range;
damage = (damage + (ThreadLocalRandom.current().nextFloat() * range)) / 2;
// put it back between min and max
damage += minDamage;
// put it back between min and max
damage += minDamage;
Resists resists = null;
// get resists
if (AbstractWorldObject.IsAbstractCharacter(awo)) {
AbstractCharacter ac = (AbstractCharacter) awo;
resists = ac.getResists();
} else if (awo.getObjectType().equals(Enum.GameObjectType.Building))
resists = ((Building) awo).getResists();
Resists resists = null;
// get resists
if (AbstractWorldObject.IsAbstractCharacter(awo)) {
AbstractCharacter ac = (AbstractCharacter) awo;
resists = ac.getResists();
} else if (awo.getObjectType().equals(Enum.GameObjectType.Building))
resists = ((Building) awo).getResists();
// calculate resists in if any
if (resists != null)
damage = resists.getResistedDamage(source, target, damageType, damage * -1, trains) * -1;
// calculate resists in if any
if (resists != null)
damage = resists.getResistedDamage(source, target, damageType, damage * -1, trains) * -1;
if (AbstractWorldObject.IsAbstractCharacter(awo)) {
AbstractCharacter ac = (AbstractCharacter) awo;
if (ac.isSit())
damage *= 2.5f; // increase damage if sitting
}
if (AbstractWorldObject.IsAbstractCharacter(awo)) {
AbstractCharacter ac = (AbstractCharacter) awo;
if (ac.isSit())
damage *= 2.5f; // increase damage if sitting
}
return damage;
}
return damage;
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
}
}
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -17,37 +17,40 @@ import java.sql.SQLException;
public class ManaFullEffectModifier extends AbstractEffectModifier {
public ManaFullEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public ManaFullEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
Float amount = 0f;
PlayerBonuses bonus = ac.getBonuses();
if (this.percentMod != 0f) { //Stat Percent Modifiers
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
amount = amount/100;
bonus.addFloat(this, amount);
} else { //Stat Modifiers
if (this.useRampAdd)
amount = this.minMod + (this.ramp * trains);
else
amount = this.minMod * (1 + (this.ramp * trains));
bonus.addFloat(this, amount);
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
Float amount = 0f;
PlayerBonuses bonus = ac.getBonuses();
if (this.percentMod != 0f) { //Stat Percent Modifiers
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
amount = amount / 100;
bonus.addFloat(this, amount);
} else { //Stat Modifiers
if (this.useRampAdd)
amount = this.minMod + (this.ramp * trains);
else
amount = this.minMod * (1 + (this.ramp * trains));
bonus.addFloat(this, amount);
}
}
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -17,29 +17,32 @@ import java.sql.SQLException;
public class ManaRecoverRateEffectModifier extends AbstractEffectModifier {
public ManaRecoverRateEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public ManaRecoverRateEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
Float amount = 0f;
PlayerBonuses bonus = ac.getBonuses();
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
amount = amount/100;
bonus.multRegen(this.modType, amount); //positive regen modifiers
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
Float amount = 0f;
PlayerBonuses bonus = ac.getBonuses();
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
amount = amount / 100;
bonus.multRegen(this.modType, amount); //positive regen modifiers
}
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -20,42 +20,44 @@ import java.sql.SQLException;
public class MaxDamageEffectModifier extends AbstractEffectModifier {
public MaxDamageEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public MaxDamageEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
}
}
@Override
public void applyBonus(Item item, int trains) {
if (item == null)
return;
String key; float amount = 0f;
if (this.percentMod != 0f) {
if (this.useRampAdd)
amount = (this.percentMod + (this.ramp * trains)) / 100f;
else
amount = (this.percentMod * (1 + (this.ramp * trains))) / 100f;
amount = amount/100;
key = "max.percent";
} else {
if (this.useRampAdd)
amount = this.minMod + (this.ramp * trains);
else
amount = this.minMod * (1 + (this.ramp * trains));
key = "max";
}
item.addBonus(this, amount);
}
@Override
public void applyBonus(Item item, int trains) {
if (item == null)
return;
String key;
float amount = 0f;
if (this.percentMod != 0f) {
if (this.useRampAdd)
amount = (this.percentMod + (this.ramp * trains)) / 100f;
else
amount = (this.percentMod * (1 + (this.ramp * trains))) / 100f;
amount = amount / 100;
key = "max.percent";
} else {
if (this.useRampAdd)
amount = this.minMod + (this.ramp * trains);
else
amount = this.minMod * (1 + (this.ramp * trains));
key = "max";
}
item.addBonus(this, amount);
}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -17,37 +17,40 @@ import java.sql.SQLException;
public class MeleeDamageEffectModifier extends AbstractEffectModifier {
public MeleeDamageEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public MeleeDamageEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
Float amount = 0f;
PlayerBonuses bonus = ac.getBonuses();
if (this.percentMod != 0f) { //Stat Percent Modifiers
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
amount = amount/100;
bonus.addFloat(this, amount);
} else { //Stat Modifiers
if (this.useRampAdd)
amount = this.minMod + (this.ramp * trains);
else
amount = this.minMod * (1 + (this.ramp * trains));
bonus.addFloat(this, amount);
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
Float amount = 0f;
PlayerBonuses bonus = ac.getBonuses();
if (this.percentMod != 0f) { //Stat Percent Modifiers
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
amount = amount / 100;
bonus.addFloat(this, amount);
} else { //Stat Modifiers
if (this.useRampAdd)
amount = this.minMod + (this.ramp * trains);
else
amount = this.minMod * (1 + (this.ramp * trains));
bonus.addFloat(this, amount);
}
}
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -20,42 +20,44 @@ import java.sql.SQLException;
public class MinDamageEffectModifier extends AbstractEffectModifier {
public MinDamageEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public MinDamageEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
}
}
@Override
public void applyBonus(Item item, int trains) {
if (item == null)
return;
String key; float amount = 0f;
if (this.percentMod != 0f) {
if (this.useRampAdd)
amount = (this.percentMod + (this.ramp * trains)) / 100f;
else
amount = (this.percentMod * (1 + (this.ramp * trains))) / 100f;
amount = amount/100;
key = "min.percent";
} else {
if (this.useRampAdd)
amount = this.minMod + (this.ramp * trains);
else
amount = this.minMod * (1 + (this.ramp * trains));
key = "min";
}
item.addBonus(this, amount);
}
@Override
public void applyBonus(Item item, int trains) {
if (item == null)
return;
String key;
float amount = 0f;
if (this.percentMod != 0f) {
if (this.useRampAdd)
amount = (this.percentMod + (this.ramp * trains)) / 100f;
else
amount = (this.percentMod * (1 + (this.ramp * trains))) / 100f;
amount = amount / 100;
key = "min.percent";
} else {
if (this.useRampAdd)
amount = this.minMod + (this.ramp * trains);
else
amount = this.minMod * (1 + (this.ramp * trains));
key = "min";
}
item.addBonus(this, amount);
}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -18,36 +18,39 @@ import java.sql.SQLException;
public class NoModEffectModifier extends AbstractEffectModifier {
public NoModEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public NoModEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
//TODO check if anything needs removed.
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
//TODO check if anything needs removed.
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
PlayerBonuses bonus = ac.getBonuses();
bonus.setBool(this.modType,this.sourceType,true);
switch (this.sourceType){
case Fly:
if (!ac.getObjectType().equals(GameObjectType.PlayerCharacter))
return;
PlayerCharacter flyer = (PlayerCharacter)ac;
if (flyer.getAltitude() > 0)
flyer.update();
PlayerCharacter.GroundPlayer(flyer);
break;
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
PlayerBonuses bonus = ac.getBonuses();
bonus.setBool(this.modType, this.sourceType, true);
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
switch (this.sourceType) {
case Fly:
if (!ac.getObjectType().equals(GameObjectType.PlayerCharacter))
return;
PlayerCharacter flyer = (PlayerCharacter) ac;
if (flyer.getAltitude() > 0)
flyer.update();
PlayerCharacter.GroundPlayer(flyer);
break;
}
}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -17,37 +17,40 @@ import java.sql.SQLException;
public class OCVEffectModifier extends AbstractEffectModifier {
public OCVEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public OCVEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
Float amount = 0f;
PlayerBonuses bonus = ac.getBonuses();
if (this.percentMod != 0f) { //Stat Percent Modifiers
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
amount = amount/100;
bonus.addFloat(this, amount);
} else { //Stat Modifiers
if (this.useRampAdd)
amount = this.minMod + (this.ramp * trains);
else
amount = this.minMod * (1 + (this.ramp * trains));
bonus.addFloat(this, amount);
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
Float amount = 0f;
PlayerBonuses bonus = ac.getBonuses();
if (this.percentMod != 0f) { //Stat Percent Modifiers
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
amount = amount / 100;
bonus.addFloat(this, amount);
} else { //Stat Modifiers
if (this.useRampAdd)
amount = this.minMod + (this.ramp * trains);
else
amount = this.minMod * (1 + (this.ramp * trains));
bonus.addFloat(this, amount);
}
}
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -17,37 +17,40 @@ import java.sql.SQLException;
public class ParryEffectModifier extends AbstractEffectModifier {
public ParryEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public ParryEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
Float amount = 0f;
PlayerBonuses bonus = ac.getBonuses();
if (this.percentMod != 0f) { //Stat Percent Modifiers
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
amount = amount/100;
bonus.addFloat(this, amount);
} else { //Stat Modifiers
if (this.useRampAdd)
amount = this.minMod + (this.ramp * trains);
else
amount = this.minMod * (1 + (this.ramp * trains));
bonus.addFloat(this, amount);
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
Float amount = 0f;
PlayerBonuses bonus = ac.getBonuses();
if (this.percentMod != 0f) { //Stat Percent Modifiers
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
amount = amount / 100;
bonus.addFloat(this, amount);
} else { //Stat Modifiers
if (this.useRampAdd)
amount = this.minMod + (this.ramp * trains);
else
amount = this.minMod * (1 + (this.ramp * trains));
bonus.addFloat(this, amount);
}
}
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -17,37 +17,40 @@ import java.sql.SQLException;
public class PassiveDefenseEffectModifier extends AbstractEffectModifier {
public PassiveDefenseEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public PassiveDefenseEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
Float amount = 0f;
PlayerBonuses bonus = ac.getBonuses();
if (this.percentMod != 0f) { //Stat Percent Modifiers
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
amount = amount/100;
bonus.addFloat(this, amount);
} else { //Stat Modifiers
if (this.useRampAdd)
amount = this.minMod + (this.ramp * trains);
else
amount = this.minMod * (1 + (this.ramp * trains));
bonus.addFloat(this, amount);
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
Float amount = 0f;
PlayerBonuses bonus = ac.getBonuses();
if (this.percentMod != 0f) { //Stat Percent Modifiers
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
amount = amount / 100;
bonus.addFloat(this, amount);
} else { //Stat Modifiers
if (this.useRampAdd)
amount = this.minMod + (this.ramp * trains);
else
amount = this.minMod * (1 + (this.ramp * trains));
bonus.addFloat(this, amount);
}
}
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -17,37 +17,40 @@ import java.sql.SQLException;
public class PowerCostEffectModifier extends AbstractEffectModifier {
public PowerCostEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public PowerCostEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
Float amount = 0f;
PlayerBonuses bonus = ac.getBonuses();
if (this.percentMod != 0f) { //Stat Percent Modifiers
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
amount = amount/100;
bonus.addFloat(this, amount);
} else { //Stat Modifiers
if (this.useRampAdd)
amount = this.minMod + (this.ramp * trains);
else
amount = this.minMod * (1 + (this.ramp * trains));
bonus.addFloat(this, amount);
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
Float amount = 0f;
PlayerBonuses bonus = ac.getBonuses();
if (this.percentMod != 0f) { //Stat Percent Modifiers
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
amount = amount / 100;
bonus.addFloat(this, amount);
} else { //Stat Modifiers
if (this.useRampAdd)
amount = this.minMod + (this.ramp * trains);
else
amount = this.minMod * (1 + (this.ramp * trains));
bonus.addFloat(this, amount);
}
}
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -20,22 +20,25 @@ import java.sql.SQLException;
public class PowerCostHealthEffectModifier extends AbstractEffectModifier {
public PowerCostHealthEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public PowerCostHealthEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
}
}
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -17,37 +17,40 @@ import java.sql.SQLException;
public class PowerDamageEffectModifier extends AbstractEffectModifier {
public PowerDamageEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public PowerDamageEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
Float amount = 0f;
PlayerBonuses bonus = ac.getBonuses();
if (this.percentMod != 0f) { //Stat Percent Modifiers
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
amount = amount/100;
bonus.addFloat(this, amount);
} else { //Stat Modifiers
if (this.useRampAdd)
amount = this.minMod + (this.ramp * trains);
else
amount = this.minMod * (1 + (this.ramp * trains));
bonus.addFloat(this, amount);
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
Float amount = 0f;
PlayerBonuses bonus = ac.getBonuses();
if (this.percentMod != 0f) { //Stat Percent Modifiers
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
amount = amount / 100;
bonus.addFloat(this, amount);
} else { //Stat Modifiers
if (this.useRampAdd)
amount = this.minMod + (this.ramp * trains);
else
amount = this.minMod * (1 + (this.ramp * trains));
bonus.addFloat(this, amount);
}
}
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -17,26 +17,29 @@ import java.sql.SQLException;
public class ProtectionFromEffectModifier extends AbstractEffectModifier {
public ProtectionFromEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public ProtectionFromEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
PlayerBonuses bonus = ac.getBonuses();
if (bonus == null)
return;
bonus.setFloat(this, trains);
// bonus.setBool(this, true);
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
PlayerBonuses bonus = ac.getBonuses();
if (bonus == null)
return;
bonus.setFloat(this, trains);
// bonus.setBool(this, true);
}
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -17,37 +17,40 @@ import java.sql.SQLException;
public class ResistanceEffectModifier extends AbstractEffectModifier {
public ResistanceEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public ResistanceEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
Float amount = 0f;
PlayerBonuses bonus = ac.getBonuses();
if (this.percentMod != 0f) { //Stat Percent Modifiers
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
amount = amount/100;
bonus.addFloat(this, amount);
} else { //Stat Modifiers
if (this.useRampAdd)
amount = this.minMod + (this.ramp * trains);
else
amount = this.minMod * (1 + (this.ramp * trains));
bonus.addFloat(this, amount);
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
Float amount = 0f;
PlayerBonuses bonus = ac.getBonuses();
if (this.percentMod != 0f) { //Stat Percent Modifiers
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
amount = amount / 100;
bonus.addFloat(this, amount);
} else { //Stat Modifiers
if (this.useRampAdd)
amount = this.minMod + (this.ramp * trains);
else
amount = this.minMod * (1 + (this.ramp * trains));
bonus.addFloat(this, amount);
}
}
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -20,22 +20,25 @@ import java.sql.SQLException;
public class ScaleHeightEffectModifier extends AbstractEffectModifier {
public ScaleHeightEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public ScaleHeightEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
}
}
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -20,22 +20,25 @@ import java.sql.SQLException;
public class ScaleWidthEffectModifier extends AbstractEffectModifier {
public ScaleWidthEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public ScaleWidthEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
}
}
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -17,37 +17,40 @@ import java.sql.SQLException;
public class ScanRangeEffectModifier extends AbstractEffectModifier {
public ScanRangeEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public ScanRangeEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
Float amount = 0f;
PlayerBonuses bonus = ac.getBonuses();
if (this.percentMod != 0f) { //Stat Percent Modifiers
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
amount = amount/100;
bonus.addFloat(this, amount);
} else { //Stat Modifiers
if (this.useRampAdd)
amount = this.minMod + (this.ramp * trains);
else
amount = this.minMod * (1 + (this.ramp * trains));
bonus.addFloat(this, amount);
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
Float amount = 0f;
PlayerBonuses bonus = ac.getBonuses();
if (this.percentMod != 0f) { //Stat Percent Modifiers
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
amount = amount / 100;
bonus.addFloat(this, amount);
} else { //Stat Modifiers
if (this.useRampAdd)
amount = this.minMod + (this.ramp * trains);
else
amount = this.minMod * (1 + (this.ramp * trains));
bonus.addFloat(this, amount);
}
}
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -17,26 +17,29 @@ import java.sql.SQLException;
public class SeeInvisibleEffectModifier extends AbstractEffectModifier {
public SeeInvisibleEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public SeeInvisibleEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
if (ac == null)
return;
PlayerBonuses bonus = ac.getBonuses();
if (bonus != null)
bonus.updateIfHigher(this, (float)trains);
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
if (ac == null)
return;
PlayerBonuses bonus = ac.getBonuses();
if (bonus != null)
bonus.updateIfHigher(this, (float) trains);
}
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -17,24 +17,27 @@ import java.sql.SQLException;
public class SilencedEffectModifier extends AbstractEffectModifier {
public SilencedEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public SilencedEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
PlayerBonuses bonus = ac.getBonuses();
bonus.setBool(this.modType,this.sourceType, true);
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
PlayerBonuses bonus = ac.getBonuses();
bonus.setBool(this.modType, this.sourceType, true);
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -17,37 +17,40 @@ import java.sql.SQLException;
public class SkillEffectModifier extends AbstractEffectModifier {
public SkillEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public SkillEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
Float amount = 0f;
PlayerBonuses bonus = ac.getBonuses();
if (this.percentMod != 0f) { //Stat Percent Modifiers
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
amount = amount/100;
bonus.addFloat(this, amount);
} else { //Stat Modifiers
if (this.useRampAdd)
amount = this.minMod + (this.ramp * trains);
else
amount = this.minMod * (1 + (this.ramp * trains));
bonus.addFloat(this, amount);
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
Float amount = 0f;
PlayerBonuses bonus = ac.getBonuses();
if (this.percentMod != 0f) { //Stat Percent Modifiers
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
amount = amount / 100;
bonus.addFloat(this, amount);
} else { //Stat Modifiers
if (this.useRampAdd)
amount = this.minMod + (this.ramp * trains);
else
amount = this.minMod * (1 + (this.ramp * trains));
bonus.addFloat(this, amount);
}
}
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -17,37 +17,40 @@ import java.sql.SQLException;
public class SlayEffectModifier extends AbstractEffectModifier {
public SlayEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public SlayEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
Float amount = 0f;
PlayerBonuses bonus = ac.getBonuses();
if (this.percentMod != 0f) { //Stat Percent Modifiers
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
amount = amount/100;
bonus.addFloat(this, amount);
} else { //Stat Modifiers
if (this.useRampAdd)
amount = this.minMod + (this.ramp * trains);
else
amount = this.minMod * (1 + (this.ramp * trains));
bonus.addFloat(this, amount);
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
Float amount = 0f;
PlayerBonuses bonus = ac.getBonuses();
if (this.percentMod != 0f) { //Stat Percent Modifiers
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
amount = amount / 100;
bonus.addFloat(this, amount);
} else { //Stat Modifiers
if (this.useRampAdd)
amount = this.minMod + (this.ramp * trains);
else
amount = this.minMod * (1 + (this.ramp * trains));
bonus.addFloat(this, amount);
}
}
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -17,37 +17,40 @@ import java.sql.SQLException;
public class SpeedEffectModifier extends AbstractEffectModifier {
public SpeedEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public SpeedEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
//Logger.error(this.getSimpleClassName(), "Speed applied with " + trains + " trains");
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
//Logger.error(this.getSimpleClassName(), "Speed applied with " + trains + " trains");
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
Float amount = 0f;
PlayerBonuses bonus = ac.getBonuses();
if (this.percentMod != 0f) { //Stat Percent Modifiers
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
amount = amount/100;
bonus.addFloat(this, amount);
} else { //Stat Modifiers
if (this.useRampAdd)
amount = this.minMod + (this.ramp * trains);
else
amount = this.minMod * (1 + (this.ramp * trains));
bonus.addFloat(this, amount);
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
Float amount = 0f;
PlayerBonuses bonus = ac.getBonuses();
if (this.percentMod != 0f) { //Stat Percent Modifiers
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
amount = amount / 100;
bonus.addFloat(this, amount);
} else { //Stat Modifiers
if (this.useRampAdd)
amount = this.minMod + (this.ramp * trains);
else
amount = this.minMod * (1 + (this.ramp * trains));
bonus.addFloat(this, amount);
}
}
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -17,23 +17,26 @@ import java.sql.SQLException;
public class SpireBlockEffectModifier extends AbstractEffectModifier {
public SpireBlockEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public SpireBlockEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
PlayerBonuses bonus = ac.getBonuses();
bonus.setBool(this.modType,this.sourceType, true);
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
PlayerBonuses bonus = ac.getBonuses();
bonus.setBool(this.modType, this.sourceType, true);
}
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -7,9 +7,6 @@
// www.magicbane.com
// ·. · · · · .
// · ·
// · ·
@@ -44,187 +41,190 @@ import java.util.concurrent.ThreadLocalRandom;
public class StaminaEffectModifier extends AbstractEffectModifier {
private DamageType damageType;
private DamageType damageType;
public StaminaEffectModifier(ResultSet rs) throws SQLException {
super(rs);
String damageTypeDB = rs.getString("type");
try {
this.damageType = DamageType.valueOf(damageTypeDB);
} catch (IllegalArgumentException e) {
Logger.error("DamageType could not be loaded from database. " + "UUID = " + this.UUID
+ " value received = '" + damageTypeDB + '\'', e);
}
}
public StaminaEffectModifier(ResultSet rs) throws SQLException {
super(rs);
String damageTypeDB = rs.getString("type");
try {
this.damageType = DamageType.valueOf(damageTypeDB);
} catch (IllegalArgumentException e) {
Logger.error("DamageType could not be loaded from database. " + "UUID = " + this.UUID
+ " value received = '" + damageTypeDB + '\'', e);
}
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
if (awo == null) {
Logger.error( "_applyEffectModifier(): NULL AWO passed in.");
return;
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
if (awo == null) {
Logger.error("_applyEffectModifier(): NULL AWO passed in.");
return;
}
if (effect == null) {
Logger.error( "_applyEffectModifier(): NULL AbstractEffectJob passed in.");
return;
}
if (effect == null) {
Logger.error("_applyEffectModifier(): NULL AbstractEffectJob passed in.");
return;
}
if (!AbstractWorldObject.IsAbstractCharacter(awo))
return;
AbstractCharacter awoac = (AbstractCharacter) awo;
if (!AbstractWorldObject.IsAbstractCharacter(awo))
return;
AbstractCharacter awoac = (AbstractCharacter) awo;
float modAmount = 0f;
float modAmount = 0f;
// Modify Stamina by percent
if (this.percentMod != 0f) {
float mod = 1f;
if (this.useRampAdd)
mod = (this.percentMod + (this.ramp * trains)) / 100;
else
mod = (this.percentMod * (1 + (this.ramp * trains))) / 100;
modAmount = mod * awoac.getStaminaMax();
if (awoac.isSit())
modAmount *= 2.5f;
// Modify Stamina by percent
if (this.percentMod != 0f) {
float mod = 1f;
if (this.useRampAdd)
mod = (this.percentMod + (this.ramp * trains)) / 100;
else
mod = (this.percentMod * (1 + (this.ramp * trains))) / 100;
modAmount = mod * awoac.getStaminaMax();
if (awoac.isSit())
modAmount *= 2.5f;
//debug for spell damage and atr
if (source.getDebug(16) && source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
PlayerCharacter pc = (PlayerCharacter) source;
String smsg = "Percent Damage: " + mod * 100 + '%';
ChatManager.chatSystemInfo(pc, smsg);
}
}
//debug for spell damage and atr
if (source.getDebug(16) && source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
PlayerCharacter pc = (PlayerCharacter) source;
String smsg = "Percent Damage: " + mod * 100 + '%';
ChatManager.chatSystemInfo(pc, smsg);
}
}
// Modify Stamina by min/max amount
else if (this.minMod != 0f || this.maxMod != 0f) {
float min = this.minMod;
float max = this.maxMod;
if (this.ramp > 0f) {
float mod = this.ramp * trains;
if (this.useRampAdd) {
min += mod;
max += mod;
} else {
min *= (1 + mod);
max *= (1 + mod);
}
}
if (source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
PlayerCharacter pc = (PlayerCharacter) source;
// Modify Stamina by min/max amount
else if (this.minMod != 0f || this.maxMod != 0f) {
float min = this.minMod;
float max = this.maxMod;
if (this.ramp > 0f) {
float mod = this.ramp * trains;
if (this.useRampAdd) {
min += mod;
max += mod;
} else {
min *= (1 + mod);
max *= (1 + mod);
}
}
if (source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
PlayerCharacter pc = (PlayerCharacter) source;
float focus;
CharacterSkill skill = pc.getSkills().get(effect.getPower().getSkillName());
if (skill == null)
focus = CharacterSkill.getQuickMastery(pc, effect.getPower().getSkillName());
else
focus = skill.getModifiedAmount();
//TODO clean up old formulas once new one is verified
// min *= (0.5 + 0.0075 * pc.getStatIntCurrent() + 0.011 * pc.getStatSpiCurrent() + 0.0196 * focus);
// max *= (0.62 + 0.0192 * pc.getStatIntCurrent() + 0.00415 * pc.getStatSpiCurrent() + 0.015 * focus);
float intt = (pc.getStatIntCurrent() >= 1) ? (float)pc.getStatIntCurrent() : 1f;
float spi = (pc.getStatSpiCurrent() >= 1) ? (float)pc.getStatSpiCurrent() : 1f;
// min *= (intt * 0.0045 + 0.055 * (float)Math.sqrt(intt - 0.5) + spi * 0.006 + 0.07 * (float)Math.sqrt(spi - 0.5) + 0.02 * (int)focus);
// max *= (intt * 0.0117 + 0.13 * (float)Math.sqrt(intt - 0.5) + spi * 0.0024 + (float)Math.sqrt(spi - 0.5) * 0.021 + 0.015 * (int)focus);
min = HealthEffectModifier.getMinDamage(min, intt, spi, focus);
max = HealthEffectModifier.getMaxDamage(max, intt, spi, focus);
float focus;
CharacterSkill skill = pc.getSkills().get(effect.getPower().getSkillName());
if (skill == null)
focus = CharacterSkill.getQuickMastery(pc, effect.getPower().getSkillName());
else
focus = skill.getModifiedAmount();
//TODO clean up old formulas once new one is verified
// min *= (0.5 + 0.0075 * pc.getStatIntCurrent() + 0.011 * pc.getStatSpiCurrent() + 0.0196 * focus);
// max *= (0.62 + 0.0192 * pc.getStatIntCurrent() + 0.00415 * pc.getStatSpiCurrent() + 0.015 * focus);
float intt = (pc.getStatIntCurrent() >= 1) ? (float) pc.getStatIntCurrent() : 1f;
float spi = (pc.getStatSpiCurrent() >= 1) ? (float) pc.getStatSpiCurrent() : 1f;
// min *= (intt * 0.0045 + 0.055 * (float)Math.sqrt(intt - 0.5) + spi * 0.006 + 0.07 * (float)Math.sqrt(spi - 0.5) + 0.02 * (int)focus);
// max *= (intt * 0.0117 + 0.13 * (float)Math.sqrt(intt - 0.5) + spi * 0.0024 + (float)Math.sqrt(spi - 0.5) * 0.021 + 0.015 * (int)focus);
min = HealthEffectModifier.getMinDamage(min, intt, spi, focus);
max = HealthEffectModifier.getMaxDamage(max, intt, spi, focus);
//debug for spell damage and atr
if (pc.getDebug(16)) {
String smsg = "Damage: " + (int)Math.abs(min) + " - " + (int)Math.abs(max);
ChatManager.chatSystemInfo(pc, smsg);
}
}
modAmount = calculateDamage(source, awoac, min, max, awo, trains);
PlayerBonuses bonus = source.getBonuses();
//debug for spell damage and atr
if (pc.getDebug(16)) {
String smsg = "Damage: " + (int) Math.abs(min) + " - " + (int) Math.abs(max);
ChatManager.chatSystemInfo(pc, smsg);
}
}
modAmount = calculateDamage(source, awoac, min, max, awo, trains);
PlayerBonuses bonus = source.getBonuses();
// Apply any power effect modifiers (such as stances)
if (bonus != null)
modAmount *= (1 + (bonus.getFloatPercentAll(ModType.PowerDamageModifier, SourceType.None)));
}
if (modAmount == 0f)
return;
if (AbstractWorldObject.IsAbstractCharacter(awo)) {
AbstractCharacter ac = (AbstractCharacter) awo;
int powerID = 0, effectID = 0;
String powerName = "";
if (effect.getPower() != null) {
powerID = effect.getPower().getToken();
powerName = effect.getPower().getName();
}
if (effect.getEffect() != null) {
effectID = effect.getEffect().getToken();
}
// Apply any power effect modifiers (such as stances)
if (bonus != null)
modAmount *= (1 + (bonus.getFloatPercentAll(ModType.PowerDamageModifier, SourceType.None)));
}
if (modAmount == 0f)
return;
if (AbstractWorldObject.IsAbstractCharacter(awo)) {
AbstractCharacter ac = (AbstractCharacter) awo;
int powerID = 0, effectID = 0;
String powerName = "";
if (effect.getPower() != null) {
powerID = effect.getPower().getToken();
powerName = effect.getPower().getName();
}
if (effect.getEffect() != null) {
effectID = effect.getEffect().getToken();
}
//see if target is immune to heals
if (modAmount > 0f) {
boolean skipImmune = false;
if (effect.getAction().getPowerAction() instanceof DirectDamagePowerAction) {
ArrayList<ActionsBase> actions = effect.getPower().getActions();
for (ActionsBase ab : actions) {
AbstractPowerAction apa = ab.getPowerAction();
if (apa instanceof DamageOverTimePowerAction)
skipImmune = true;
}
}
PlayerBonuses bonus = ac.getBonuses();
if (!skipImmune && bonus.getFloat(ModType.BlackMantle, SourceType.Heal) >= trains) {
ModifyHealthMsg mhm = new ModifyHealthMsg(source, ac, 0f, 0f, 0f, powerID, powerName, trains, effectID);
mhm.setUnknown03(5); //set target is immune
DispatchMessage.sendToAllInRange(ac, mhm);
//see if target is immune to heals
if (modAmount > 0f) {
boolean skipImmune = false;
if (effect.getAction().getPowerAction() instanceof DirectDamagePowerAction) {
ArrayList<ActionsBase> actions = effect.getPower().getActions();
for (ActionsBase ab : actions) {
AbstractPowerAction apa = ab.getPowerAction();
if (apa instanceof DamageOverTimePowerAction)
skipImmune = true;
}
}
PlayerBonuses bonus = ac.getBonuses();
if (!skipImmune && bonus.getFloat(ModType.BlackMantle, SourceType.Heal) >= trains) {
ModifyHealthMsg mhm = new ModifyHealthMsg(source, ac, 0f, 0f, 0f, powerID, powerName, trains, effectID);
mhm.setUnknown03(5); //set target is immune
DispatchMessage.sendToAllInRange(ac, mhm);
return;
}
}
return;
}
}
ac.modifyStamina(modAmount, source);
ac.modifyStamina(modAmount, source);
ModifyHealthMsg mhm = new ModifyHealthMsg(source, ac, 0f, 0f, modAmount, powerID, powerName, trains,
effectID);
if (effect instanceof DamageOverTimeJob)
mhm.setOmitFromChat(1);
DispatchMessage.sendToAllInRange(ac, mhm);
}
}
ModifyHealthMsg mhm = new ModifyHealthMsg(source, ac, 0f, 0f, modAmount, powerID, powerName, trains,
effectID);
if (effect instanceof DamageOverTimeJob)
mhm.setOmitFromChat(1);
DispatchMessage.sendToAllInRange(ac, mhm);
}
}
private float calculateDamage(AbstractCharacter source, AbstractCharacter target, float minDamage, float maxDamage, AbstractWorldObject awo, int trains) {
private float calculateDamage(AbstractCharacter source, AbstractCharacter target, float minDamage, float maxDamage, AbstractWorldObject awo, int trains) {
// get range between min and max
float range = maxDamage - minDamage;
// get range between min and max
float range = maxDamage - minDamage;
// Damage is calculated twice to average a more central point
float damage = ThreadLocalRandom.current().nextFloat() * range;
damage = (damage + (ThreadLocalRandom.current().nextFloat() * range)) / 2;
// Damage is calculated twice to average a more central point
float damage = ThreadLocalRandom.current().nextFloat() * range;
damage = (damage + (ThreadLocalRandom.current().nextFloat() * range)) / 2;
// put it back between min and max
damage += minDamage;
// put it back between min and max
damage += minDamage;
Resists resists = null;
// get resists
if (AbstractWorldObject.IsAbstractCharacter(awo)) {
AbstractCharacter ac = (AbstractCharacter) awo;
resists = ac.getResists();
} else if (awo.getObjectType().equals(Enum.GameObjectType.Building))
resists = ((Building) awo).getResists();
Resists resists = null;
// get resists
if (AbstractWorldObject.IsAbstractCharacter(awo)) {
AbstractCharacter ac = (AbstractCharacter) awo;
resists = ac.getResists();
} else if (awo.getObjectType().equals(Enum.GameObjectType.Building))
resists = ((Building) awo).getResists();
// calculate resists in if any
if (resists != null)
damage = resists.getResistedDamage(source, target, damageType, damage * -1, trains) * -1;
// calculate resists in if any
if (resists != null)
damage = resists.getResistedDamage(source, target, damageType, damage * -1, trains) * -1;
if (AbstractWorldObject.IsAbstractCharacter(awo)) {
AbstractCharacter ac = (AbstractCharacter) awo;
if (ac.isSit())
damage *= 2.5f; // increase damage if sitting
}
if (AbstractWorldObject.IsAbstractCharacter(awo)) {
AbstractCharacter ac = (AbstractCharacter) awo;
if (ac.isSit())
damage *= 2.5f; // increase damage if sitting
}
return damage;
}
return damage;
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
}
}
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -17,37 +17,40 @@ import java.sql.SQLException;
public class StaminaFullEffectModifier extends AbstractEffectModifier {
public StaminaFullEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public StaminaFullEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
Float amount = 0f;
PlayerBonuses bonus = ac.getBonuses();
if (this.percentMod != 0f) { //Stat Percent Modifiers
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
amount = amount/100;
bonus.addFloat(this, amount);
} else { //Stat Modifiers
if (this.useRampAdd)
amount = this.minMod + (this.ramp * trains);
else
amount = this.minMod * (1 + (this.ramp * trains));
bonus.addFloat(this, amount);
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
Float amount = 0f;
PlayerBonuses bonus = ac.getBonuses();
if (this.percentMod != 0f) { //Stat Percent Modifiers
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
amount = amount / 100;
bonus.addFloat(this, amount);
} else { //Stat Modifiers
if (this.useRampAdd)
amount = this.minMod + (this.ramp * trains);
else
amount = this.minMod * (1 + (this.ramp * trains));
bonus.addFloat(this, amount);
}
}
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -17,31 +17,34 @@ import java.sql.SQLException;
public class StaminaRecoverRateEffectModifier extends AbstractEffectModifier {
public StaminaRecoverRateEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public StaminaRecoverRateEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
Float amount = 0f;
PlayerBonuses bonus = ac.getBonuses();
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
//Erection is this right?
amount = amount/100;
bonus.multRegen(this.modType, amount); //positive regen modifiers
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
Float amount = 0f;
PlayerBonuses bonus = ac.getBonuses();
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
//Erection is this right?
amount = amount / 100;
bonus.multRegen(this.modType, amount); //positive regen modifiers
}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -18,30 +18,33 @@ import java.sql.SQLException;
public class StunnedEffectModifier extends AbstractEffectModifier {
public StunnedEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public StunnedEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
if (ac.getObjectType() == GameObjectType.Mob) {
Mob mob = (Mob) ac;
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
if (ac.getObjectType() == GameObjectType.Mob) {
Mob mob = (Mob) ac;
}
PlayerBonuses bonus = ac.getBonuses();
bonus.setBool(this.modType,this.sourceType, true);
ac.cancelOnStun();
ac.setIsCasting(false);
ac.stopMovement(ac.getLoc());
}
PlayerBonuses bonus = ac.getBonuses();
bonus.setBool(this.modType, this.sourceType, true);
ac.cancelOnStun();
ac.setIsCasting(false);
ac.stopMovement(ac.getLoc());
}
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -20,22 +20,25 @@ import java.sql.SQLException;
public class ValueEffectModifier extends AbstractEffectModifier {
public ValueEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public ValueEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
}
}
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -22,26 +22,29 @@ import java.sql.SQLException;
public class WeaponProcEffectModifier extends AbstractEffectModifier {
public WeaponProcEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public WeaponProcEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
}
}
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Item item, int trains) {
}
public void applyProc(AbstractCharacter ac, AbstractWorldObject target) {
PowersManager.applyPower(ac, target, Vector3fImmutable.ZERO, this.string1, (int)this.percentMod, false);
}
@Override
public void applyBonus(Building building, int trains) {
}
public void applyProc(AbstractCharacter ac, AbstractWorldObject target) {
PowersManager.applyPower(ac, target, Vector3fImmutable.ZERO, this.string1, (int) this.percentMod, false);
}
}
@@ -17,38 +17,41 @@ import java.sql.SQLException;
public class WeaponRangeEffectModifier extends AbstractEffectModifier {
public WeaponRangeEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public WeaponRangeEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
Float amount = 0f;
PlayerBonuses bonus = ac.getBonuses();
if (this.percentMod != 0f) { //Stat Percent Modifiers
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
amount = amount/100;
bonus.addFloat(this, amount);
} else { //Stat Modifiers
if (this.useRampAdd)
amount = this.minMod + (this.ramp * trains);
else
amount = this.minMod * (1 + (this.ramp * trains));
bonus.addFloat(this, amount);
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
Float amount = 0f;
PlayerBonuses bonus = ac.getBonuses();
if (this.percentMod != 0f) { //Stat Percent Modifiers
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
amount = amount / 100;
bonus.addFloat(this, amount);
} else { //Stat Modifiers
if (this.useRampAdd)
amount = this.minMod + (this.ramp * trains);
else
amount = this.minMod * (1 + (this.ramp * trains));
bonus.addFloat(this, amount);
}
}
}
@Override
public void applyBonus(Item item, int trains) {}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Item item, int trains) {
}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -20,41 +20,42 @@ import java.sql.SQLException;
public class WeaponSpeedEffectModifier extends AbstractEffectModifier {
public WeaponSpeedEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
public WeaponSpeedEffectModifier(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
@Override
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
}
}
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
@Override
public void applyBonus(AbstractCharacter ac, int trains) {
Float amount = 0f;
Float amount = 0f;
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
amount = amount/100;
amount = amount / 100;
ac.getBonuses().addFloat(this, amount);
}
ac.getBonuses().addFloat(this, amount);
}
@Override
public void applyBonus(Item item, int trains) {
Float amount = 0f;
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
amount = amount/100;
item.addBonus(this, amount);
}
@Override
public void applyBonus(Item item, int trains) {
Float amount = 0f;
if (this.useRampAdd)
amount = this.percentMod + (this.ramp * trains);
else
amount = this.percentMod * (1 + (this.ramp * trains));
amount = amount / 100;
item.addBonus(this, amount);
}
@Override
public void applyBonus(Building building, int trains) {}
@Override
public void applyBonus(Building building, int trains) {
}
}
@@ -28,280 +28,279 @@ import java.util.HashMap;
public abstract class AbstractPowerAction {
protected PowersBase parent;
protected int UUID;
protected String IDString;
protected String type;
protected boolean isAggressive;
protected long validItemFlags;
protected PowersBase parent;
protected int UUID;
protected String IDString;
protected String type;
protected boolean isAggressive;
protected long validItemFlags;
/**
* No Table ID Constructor
*/
public AbstractPowerAction() {
/**
* No Table ID Constructor
*/
public AbstractPowerAction() {
}
}
/**
* ResultSet Constructor
*/
public AbstractPowerAction(ResultSet rs) throws SQLException {
/**
* ResultSet Constructor
*/
public AbstractPowerAction(ResultSet rs) throws SQLException {
this.UUID = rs.getInt("ID");
this.IDString = rs.getString("IDString");
this.type = rs.getString("type");
int flags = rs.getInt("flags");
this.isAggressive = ((flags & 128) != 0) ? true : false;
}
this.UUID = rs.getInt("ID");
this.IDString = rs.getString("IDString");
this.type = rs.getString("type");
int flags = rs.getInt("flags");
this.isAggressive = ((flags & 128) != 0) ? true : false;
}
public AbstractPowerAction( int uUID, String iDString, String type, boolean isAggressive,
long validItemFlags) {
super();
UUID = uUID;
IDString = iDString;
this.type = type;
this.isAggressive = false;
}
public AbstractPowerAction(int uUID, String iDString, String type, boolean isAggressive,
long validItemFlags) {
super();
UUID = uUID;
IDString = iDString;
this.type = type;
this.isAggressive = false;
}
public static void getAllPowerActions(HashMap<String, AbstractPowerAction> powerActions, HashMap<Integer, AbstractPowerAction> powerActionsByID, HashMap<String, EffectsBase> effects) {
PreparedStatementShared ps = null;
try {
ps = new PreparedStatementShared("SELECT * FROM static_power_poweraction");
ResultSet rs = ps.executeQuery();
String IDString, type;
while (rs.next()) {
AbstractPowerAction apa;
type = rs.getString("type");
IDString = rs.getString("IDString");
int token = DbManager.hasher.SBStringHash(IDString);
//cache token, used for applying effects.
PowersManager.ActionTokenByIDString.put(IDString, token);
apa = null;
switch (type)
{
default:
Logger.error("valid type not found for poweraction of ID" + rs.getInt("ID"));
break;
case "ApplyEffect":
apa = new ApplyEffectPowerAction(rs, effects);
break;
case "ApplyEffects":
apa = new ApplyEffectsPowerAction(rs, effects);
break;
case "DeferredPower":
apa = new DeferredPowerPowerAction(rs, effects);
break;
case "DamageOverTime":
apa = new DamageOverTimePowerAction(rs, effects);
break;
case "Peek":
apa = new PeekPowerAction(rs);
break;
case "Charm":
apa = new CharmPowerAction(rs);
break;
case "Fear":
apa = new FearPowerAction(rs);
break;
case "Confusion":
apa = new ConfusionPowerAction(rs);
break;
case "RemoveEffect":
apa = new RemoveEffectPowerAction(rs);
break;
case "Track":
apa = new TrackPowerAction(rs, effects);
break;
case "DirectDamage":
apa = new DirectDamagePowerAction(rs, effects);
break;
case "Transform":
apa = new TransformPowerAction(rs, effects);
break;
case "CreateMob":
apa = new CreateMobPowerAction(rs);
break;
case "Invis":
apa = new InvisPowerAction(rs, effects);
break;
case "ClearNearbyAggro":
apa = new ClearNearbyAggroPowerAction(rs);
break;
case "MobRecall":
apa = new MobRecallPowerAction(rs);
break;
case "SetItemFlag":
apa = new SetItemFlagPowerAction(rs);
break;
case "SimpleDamage":
apa = new SimpleDamagePowerAction(rs);
break;
case "TransferStatOT":
apa = new TransferStatOTPowerAction(rs, effects);
break;
case "TransferStat":
apa = new TransferStatPowerAction(rs, effects);
break;
case "Teleport":
apa = new TeleportPowerAction(rs);
break;
case "TreeChoke":
apa = new TreeChokePowerAction(rs);
break;
case "Block":
apa = new BlockPowerAction(rs);
break;
case "Resurrect":
apa = new ResurrectPowerAction(rs);
break;
case "ClearAggro":
apa = new ClearAggroPowerAction(rs);
break;
case "ClaimMine":
apa = new ClaimMinePowerAction(rs);
break;
case "Recall":
apa = new RecallPowerAction(rs);
break;
case "SpireDisable":
apa = new SpireDisablePowerAction(rs);
break;
case "Steal":
apa = new StealPowerAction(rs);
break;
case "Summon":
apa = new SummonPowerAction(rs);
break;
case "RunegateTeleport":
apa = new RunegateTeleportPowerAction(rs);
break;
case "OpenGate":
apa = new OpenGatePowerAction(rs);
break;
}
powerActions.put(IDString, apa);
powerActionsByID.put(apa.UUID, apa);
apa.validItemFlags = 0;
}
rs.close();
} catch (Exception e) {
Logger.error( e.toString());
} finally {
ps.release();
}
//Add OpenGatePowerAction
AbstractPowerAction openGateAction = new OpenGatePowerAction(5000, "OPENGATE", "OpenGate", false, 0);
powerActions.put("OPENGATE", openGateAction);
powerActionsByID.put(openGateAction.UUID, openGateAction);
}
public static void getAllPowerActions(HashMap<String, AbstractPowerAction> powerActions, HashMap<Integer, AbstractPowerAction> powerActionsByID, HashMap<String, EffectsBase> effects) {
PreparedStatementShared ps = null;
try {
ps = new PreparedStatementShared("SELECT * FROM static_power_poweraction");
ResultSet rs = ps.executeQuery();
String IDString, type;
while (rs.next()) {
AbstractPowerAction apa;
type = rs.getString("type");
IDString = rs.getString("IDString");
int token = DbManager.hasher.SBStringHash(IDString);
//cache token, used for applying effects.
PowersManager.ActionTokenByIDString.put(IDString, token);
apa = null;
switch (type) {
default:
Logger.error("valid type not found for poweraction of ID" + rs.getInt("ID"));
break;
case "ApplyEffect":
apa = new ApplyEffectPowerAction(rs, effects);
break;
case "ApplyEffects":
apa = new ApplyEffectsPowerAction(rs, effects);
break;
case "DeferredPower":
apa = new DeferredPowerPowerAction(rs, effects);
break;
case "DamageOverTime":
apa = new DamageOverTimePowerAction(rs, effects);
break;
case "Peek":
apa = new PeekPowerAction(rs);
break;
case "Charm":
apa = new CharmPowerAction(rs);
break;
case "Fear":
apa = new FearPowerAction(rs);
break;
case "Confusion":
apa = new ConfusionPowerAction(rs);
break;
case "RemoveEffect":
apa = new RemoveEffectPowerAction(rs);
break;
case "Track":
apa = new TrackPowerAction(rs, effects);
break;
case "DirectDamage":
apa = new DirectDamagePowerAction(rs, effects);
break;
case "Transform":
apa = new TransformPowerAction(rs, effects);
break;
case "CreateMob":
apa = new CreateMobPowerAction(rs);
break;
case "Invis":
apa = new InvisPowerAction(rs, effects);
break;
case "ClearNearbyAggro":
apa = new ClearNearbyAggroPowerAction(rs);
break;
case "MobRecall":
apa = new MobRecallPowerAction(rs);
break;
case "SetItemFlag":
apa = new SetItemFlagPowerAction(rs);
break;
case "SimpleDamage":
apa = new SimpleDamagePowerAction(rs);
break;
case "TransferStatOT":
apa = new TransferStatOTPowerAction(rs, effects);
break;
case "TransferStat":
apa = new TransferStatPowerAction(rs, effects);
break;
case "Teleport":
apa = new TeleportPowerAction(rs);
break;
case "TreeChoke":
apa = new TreeChokePowerAction(rs);
break;
case "Block":
apa = new BlockPowerAction(rs);
break;
case "Resurrect":
apa = new ResurrectPowerAction(rs);
break;
case "ClearAggro":
apa = new ClearAggroPowerAction(rs);
break;
case "ClaimMine":
apa = new ClaimMinePowerAction(rs);
break;
case "Recall":
apa = new RecallPowerAction(rs);
break;
case "SpireDisable":
apa = new SpireDisablePowerAction(rs);
break;
case "Steal":
apa = new StealPowerAction(rs);
break;
case "Summon":
apa = new SummonPowerAction(rs);
break;
case "RunegateTeleport":
apa = new RunegateTeleportPowerAction(rs);
break;
case "OpenGate":
apa = new OpenGatePowerAction(rs);
break;
}
powerActions.put(IDString, apa);
powerActionsByID.put(apa.UUID, apa);
apa.validItemFlags = 0;
}
rs.close();
} catch (Exception e) {
Logger.error(e.toString());
} finally {
ps.release();
}
public void startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int numTrains, ActionsBase ab, PowersBase pb) {
this._startAction(source, awo, targetLoc, numTrains, ab, pb);
}
public void startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int numTrains, ActionsBase ab, PowersBase pb, int duration) {
this._startAction(source, awo, targetLoc, numTrains, ab, pb,duration);
}
//Add OpenGatePowerAction
AbstractPowerAction openGateAction = new OpenGatePowerAction(5000, "OPENGATE", "OpenGate", false, 0);
powerActions.put("OPENGATE", openGateAction);
powerActionsByID.put(openGateAction.UUID, openGateAction);
}
protected abstract void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int numTrains, ActionsBase ab, PowersBase pb);
public static void loadValidItemFlags(HashMap<String, AbstractPowerAction> powerActions) {
PreparedStatementShared ps = null;
try {
ps = new PreparedStatementShared("SELECT * FROM `static_power_effect_allowed_item`");
ResultSet rs = ps.executeQuery();
String IDS;
long flags;
while (rs.next()) {
AbstractPowerAction apa;
flags = rs.getLong("flags");
IDS = rs.getString("IDString");
if (powerActions.containsKey(IDS)) {
apa = powerActions.get(IDS);
apa.validItemFlags = flags;
} else {
Logger.error("Unable to find PowerAction " + IDS);
continue;
}
}
rs.close();
} catch (Exception e) {
Logger.error(e.toString());
} finally {
ps.release();
}
protected abstract void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int numTrains, ActionsBase ab, PowersBase pb, int duration);
}
public void handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int numTrains, ActionsBase ab, PowersBase pb) {
this._handleChant(source, target, targetLoc, numTrains, ab, pb);
}
public void startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int numTrains, ActionsBase ab, PowersBase pb) {
this._startAction(source, awo, targetLoc, numTrains, ab, pb);
}
protected abstract void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int numTrains, ActionsBase ab, PowersBase pb);
public void startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int numTrains, ActionsBase ab, PowersBase pb, int duration) {
this._startAction(source, awo, targetLoc, numTrains, ab, pb, duration);
}
public int getUUID() {
return this.UUID;
}
protected abstract void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int numTrains, ActionsBase ab, PowersBase pb);
public String getIDString() {
return this.IDString;
}
protected abstract void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int numTrains, ActionsBase ab, PowersBase pb, int duration);
// public String getMessageType() {
// return this.type;
// }
public void handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int numTrains, ActionsBase ab, PowersBase pb) {
this._handleChant(source, target, targetLoc, numTrains, ab, pb);
}
public boolean isAggressive() {
return this.isAggressive;
}
protected abstract void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int numTrains, ActionsBase ab, PowersBase pb);
public PowersBase getParent() {
return this.parent;
}
public int getUUID() {
return this.UUID;
}
public void setParent(PowersBase value) {
this.parent = value;
}
// public String getMessageType() {
// return this.type;
// }
public void applyEffectForItem(Item item, int trains) {
if (this instanceof ApplyEffectPowerAction)
((ApplyEffectPowerAction)this)._applyEffectForItem(item, trains);
if (this instanceof ApplyEffectsPowerAction)
((ApplyEffectsPowerAction)this)._applyEffectForItem(item, trains);
}
public void applyBakedInStatsForItem(Item item, int trains) {
if (this instanceof ApplyEffectPowerAction)
((ApplyEffectPowerAction)this)._applyBakedInStatsForItem(item, trains);
if (this instanceof ApplyEffectsPowerAction)
((ApplyEffectsPowerAction)this)._applyBakedInStatsForItem(item, trains);
}
public String getIDString() {
return this.IDString;
}
public EffectsBase getEffectsBase() {
if (this instanceof ApplyEffectPowerAction)
return ((ApplyEffectPowerAction)this).getEffect();
else if (this instanceof ApplyEffectsPowerAction)
return ((ApplyEffectsPowerAction)this).getEffect();
return null;
}
public boolean isAggressive() {
return this.isAggressive;
}
public EffectsBase getEffectsBase2() {
if (this instanceof ApplyEffectsPowerAction)
return ((ApplyEffectsPowerAction)this).getEffect2();
return null;
}
public PowersBase getParent() {
return this.parent;
}
public static void loadValidItemFlags(HashMap<String, AbstractPowerAction> powerActions) {
PreparedStatementShared ps = null;
try {
ps = new PreparedStatementShared("SELECT * FROM `static_power_effect_allowed_item`");
ResultSet rs = ps.executeQuery();
String IDS;
long flags;
while (rs.next()) {
AbstractPowerAction apa;
flags = rs.getLong("flags");
IDS = rs.getString("IDString");
if (powerActions.containsKey(IDS)) {
apa = powerActions.get(IDS);
apa.validItemFlags = flags;
} else {
Logger.error("Unable to find PowerAction " + IDS);
continue;
}
}
rs.close();
} catch (Exception e) {
Logger.error(e.toString());
} finally {
ps.release();
}
public void setParent(PowersBase value) {
this.parent = value;
}
}
public void applyEffectForItem(Item item, int trains) {
if (this instanceof ApplyEffectPowerAction)
((ApplyEffectPowerAction) this)._applyEffectForItem(item, trains);
if (this instanceof ApplyEffectsPowerAction)
((ApplyEffectsPowerAction) this)._applyEffectForItem(item, trains);
}
//These functions verify a powerAction is valid for an item type
public long getValidItemFlags() {
return this.validItemFlags;
}
public void applyBakedInStatsForItem(Item item, int trains) {
if (this instanceof ApplyEffectPowerAction)
((ApplyEffectPowerAction) this)._applyBakedInStatsForItem(item, trains);
if (this instanceof ApplyEffectsPowerAction)
((ApplyEffectsPowerAction) this)._applyBakedInStatsForItem(item, trains);
}
public String getType() {
return type;
}
public EffectsBase getEffectsBase() {
if (this instanceof ApplyEffectPowerAction)
return ((ApplyEffectPowerAction) this).getEffect();
else if (this instanceof ApplyEffectsPowerAction)
return ((ApplyEffectsPowerAction) this).getEffect();
return null;
}
public EffectsBase getEffectsBase2() {
if (this instanceof ApplyEffectsPowerAction)
return ((ApplyEffectsPowerAction) this).getEffect2();
return null;
}
//These functions verify a powerAction is valid for an item type
public long getValidItemFlags() {
return this.validItemFlags;
}
public String getType() {
return type;
}
}
@@ -7,9 +7,6 @@
// www.magicbane.com
// ·. · · · · .
// · ·
// · ·
@@ -24,7 +21,6 @@ package engine.powers.poweractions;
import engine.Enum.GameObjectType;
import engine.Enum.ModType;
import engine.Enum.SourceType;
import engine.ai.MobileFSM;
import engine.gameManager.ChatManager;
import engine.jobs.ChantJob;
import engine.jobs.DeferredPowerJob;
@@ -44,222 +40,223 @@ import java.util.HashMap;
public class ApplyEffectPowerAction extends AbstractPowerAction {
private String effectID;
private EffectsBase effect;
private String effectParentID;
private EffectsBase effectParent;
private String effectID;
private EffectsBase effect;
private String effectParentID;
private EffectsBase effectParent;
public ApplyEffectPowerAction(ResultSet rs, HashMap<String, EffectsBase> effects) throws SQLException {
super(rs);
this.effectParentID = rs.getString("IDString");
this.effectParent = effects.get(this.effectParentID);
this.effectID = rs.getString("effectID");
this.effect = effects.get(this.effectID);
}
public ApplyEffectPowerAction(ResultSet rs, HashMap<String, EffectsBase> effects) throws SQLException {
super(rs);
this.effectParentID = rs.getString("IDString");
this.effectParent = effects.get(this.effectParentID);
this.effectID = rs.getString("effectID");
this.effect = effects.get(this.effectID);
}
public ApplyEffectPowerAction(ResultSet rs, EffectsBase effect) throws SQLException {
super(rs);
public ApplyEffectPowerAction(ResultSet rs, EffectsBase effect) throws SQLException {
super(rs);
this.effectID = rs.getString("effectID");
this.effect = effect;
}
this.effectID = rs.getString("effectID");
this.effect = effect;
}
public String getEffectID() {
return this.effectID;
}
private static boolean blockInvul(PowersBase pb, AbstractCharacter source, AbstractWorldObject awo) {
if (awo == null || pb == null || source == null)
return false;
public EffectsBase getEffect() {
return this.effect;
}
if (source.getObjectUUID() == awo.getObjectUUID())
return false;
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
if (this.effect == null || pb == null || ab == null) {
//TODO log error here
return;
}
if (!AbstractWorldObject.IsAbstractCharacter(awo))
return false;
AbstractCharacter ac = (AbstractCharacter) awo;
return false;
}
public String getEffectID() {
return this.effectID;
}
public EffectsBase getEffect() {
return this.effect;
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
if (this.effect == null || pb == null || ab == null) {
//TODO log error here
return;
}
//add schedule job to end it if needed and add effect to pc
int duration = 0;
// if (pb.isChant())
// duration = (int)pb.getChantDuration() * 1000;
// else
duration = ab.getDuration(trains);
String stackType = ab.getStackType();
if (stackType.equals("WeaponMove")) {
DeferredPowerJob eff = new DeferredPowerJob(source, awo, stackType, trains, ab, pb, this.effect, this);
if (stackType.equals("IgnoreStack"))
awo.addEffect(Integer.toString(ab.getUUID()), 10000, eff, this.effect, trains);
else
awo.addEffect(stackType, 10000, eff, this.effect, trains);
if (awo.getObjectType().equals(GameObjectType.PlayerCharacter))
((PlayerCharacter) awo).setWeaponPower(eff);
this.effect.startEffect(source, awo, trains, eff);
} else {
FinishEffectTimeJob eff = new FinishEffectTimeJob(source, awo, stackType, trains, ab, pb, effect);
if (blockInvul(pb, source, awo)) {
this.effect.endEffect(source, awo, trains, pb, eff);
return;
}
//add schedule job to end it if needed and add effect to pc
int duration = 0;
// if (pb.isChant())
// duration = (int)pb.getChantDuration() * 1000;
// else
duration = ab.getDuration(trains);
String stackType = ab.getStackType();
if (stackType.equals("WeaponMove")) {
DeferredPowerJob eff = new DeferredPowerJob(source, awo, stackType, trains, ab, pb, this.effect, this);
if (stackType.equals("IgnoreStack"))
awo.addEffect(Integer.toString(ab.getUUID()), 10000, eff, this.effect, trains);
else
awo.addEffect(stackType, 10000, eff, this.effect, trains);
if (awo.getObjectType().equals(GameObjectType.PlayerCharacter))
((PlayerCharacter)awo).setWeaponPower(eff);
this.effect.startEffect(source, awo, trains, eff);
} else {
FinishEffectTimeJob eff = new FinishEffectTimeJob(source, awo, stackType, trains, ab, pb, effect);
if (blockInvul(pb, source, awo)) {
this.effect.endEffect(source, awo, trains, pb, eff);
return;
}
// Effect lastEff = awo.getEffects().get(eff.getStackType());
//
//
// if (lastEff != null && lastEff.getPowerToken() == eff.getPowerToken())
// lastEff.cancelJob(true);
if (duration > 0) {
if (stackType.equals("IgnoreStack"))
awo.addEffect(Integer.toString(ab.getUUID()), duration, eff, effect, trains);
else
awo.addEffect(stackType, duration, eff, effect, trains);
} else
awo.applyAllBonuses();
// //TODO if chant, start cycle
// if (pb.isChant() && source.equals(awo)) {
// ChantJob cj = new ChantJob(source, awo, stackType, trains, ab, pb, effect, eff);
// source.setLastChant((int)(pb.getChantDuration()-2) * 1000, cj);
// eff.setChant(true);
// }
if (duration > 0) {
if (stackType.equals("IgnoreStack"))
awo.addEffect(Integer.toString(ab.getUUID()), duration, eff, effect, trains);
else
awo.addEffect(stackType, duration, eff, effect, trains);
} else
awo.applyAllBonuses();
// //TODO if chant, start cycle
// if (pb.isChant() && source.equals(awo)) {
// ChantJob cj = new ChantJob(source, awo, stackType, trains, ab, pb, effect, eff);
// source.setLastChant((int)(pb.getChantDuration()-2) * 1000, cj);
// eff.setChant(true);
// }
if (this.effectID.equals("TAUNT")){
if (this.effectID.equals("TAUNT")) {
if (awo != null && awo.getObjectType() == GameObjectType.Mob){
((Mob) awo).setCombatTarget(source);
ChatSystemMsg msg = ChatManager.CombatInfo(source, awo);
DispatchMessage.sendToAllInRange(source, msg);
}
}
this.effect.startEffect(source, awo, trains, eff);
}
}
if (awo != null && awo.getObjectType() == GameObjectType.Mob) {
((Mob) awo).setCombatTarget(source);
ChatSystemMsg msg = ChatManager.CombatInfo(source, awo);
DispatchMessage.sendToAllInRange(source, msg);
}
}
this.effect.startEffect(source, awo, trains, eff);
}
}
protected void _applyEffectForItem(Item item, int trains) {
if (item == null || this.effect == null)
return;
item.addEffectNoTimer(Integer.toString(this.effect.getUUID()), this.effect, trains,false);
item.addEffectNoTimer(Integer.toString(this.effectParent.getUUID()), this.effectParent, trains,false);
}
protected void _applyBakedInStatsForItem(Item item, int trains) {
if (item == null)
return;
if (this.effect == null){
Logger.error( "Unknown Token: EffectBase ID " + this.effectID + '.');
return;
}
protected void _applyEffectForItem(Item item, int trains) {
if (item == null || this.effect == null)
return;
item.addEffectNoTimer(Integer.toString(this.effect.getUUID()), this.effect, trains, false);
item.addEffectNoTimer(Integer.toString(this.effectParent.getUUID()), this.effectParent, trains, false);
}
if (this.effectParent == null){
Logger.error("Unknown Token: EffectBase ID " + this.effectParentID + '.');
return;
}
Effect eff = item.addEffectNoTimer(Integer.toString(this.effect.getUUID()), this.effect, trains,false);
Effect eff3 = item.addEffectNoTimer(Integer.toString(this.effectParent.getUUID()), this.effectParent, trains,false);
if (eff != null && eff3 != null){
eff3.setBakedInStat(true);
item.getEffectNames().add(this.effect.getIDString());
item.getEffectNames().add(this.effectParent.getIDString());
}
}
protected void _applyBakedInStatsForItem(Item item, int trains) {
if (item == null)
return;
if (this.effect == null) {
Logger.error("Unknown Token: EffectBase ID " + this.effectID + '.');
return;
}
@Override
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
if (source != null) {
PlayerBonuses bonuses = source.getBonuses();
if (bonuses == null)
return;
boolean noSilence = bonuses.getBool(ModType.Silenced, SourceType.None);
if (noSilence)
return;
if (this.effectParent == null) {
Logger.error("Unknown Token: EffectBase ID " + this.effectParentID + '.');
return;
}
Effect eff = item.addEffectNoTimer(Integer.toString(this.effect.getUUID()), this.effect, trains, false);
Effect eff3 = item.addEffectNoTimer(Integer.toString(this.effectParent.getUUID()), this.effectParent, trains, false);
if (eff != null && eff3 != null) {
eff3.setBakedInStat(true);
item.getEffectNames().add(this.effect.getIDString());
item.getEffectNames().add(this.effectParent.getIDString());
}
}
}
String stackType = ab.stackType;
stackType = stackType.equals("IgnoreStack") ? Integer.toString(ab.getUUID()) : stackType;
@Override
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
if (source != null) {
PlayerBonuses bonuses = source.getBonuses();
FinishEffectTimeJob eff = new FinishEffectTimeJob(source, target, stackType, trains, ab, pb, effect);
ChantJob cj = new ChantJob(source, target, stackType, trains, ab, pb, effect, eff);
//handle invul
if(pb.getUUID() != 334)
source.setLastChant((int)(pb.getChantDuration()) * 1000, cj);
else
source.setLastChant((int)(pb.getChantDuration()) * 1000, cj);
eff.setChant(true);
}
if (bonuses == null)
return;
private static boolean blockInvul(PowersBase pb, AbstractCharacter source, AbstractWorldObject awo) {
if (awo == null || pb == null || source == null)
return false;
boolean noSilence = bonuses.getBool(ModType.Silenced, SourceType.None);
if (source.getObjectUUID() == awo.getObjectUUID())
return false;
if (noSilence)
return;
if (!AbstractWorldObject.IsAbstractCharacter(awo))
return false;
}
String stackType = ab.stackType;
stackType = stackType.equals("IgnoreStack") ? Integer.toString(ab.getUUID()) : stackType;
AbstractCharacter ac = (AbstractCharacter) awo;
FinishEffectTimeJob eff = new FinishEffectTimeJob(source, target, stackType, trains, ab, pb, effect);
ChantJob cj = new ChantJob(source, target, stackType, trains, ab, pb, effect, eff);
//handle invul
if (pb.getUUID() != 334)
source.setLastChant((int) (pb.getChantDuration()) * 1000, cj);
else
source.setLastChant((int) (pb.getChantDuration()) * 1000, cj);
eff.setChant(true);
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
int trains, ActionsBase ab, PowersBase pb, int duration) {
if (this.effect == null || pb == null || ab == null) {
//TODO log error here
return;
}
return false;
}
//add schedule job to end it if needed and add effect to pc
// if (pb.isChant())
// duration = (int)pb.getChantDuration() * 1000;
// else
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
int trains, ActionsBase ab, PowersBase pb, int duration) {
if (this.effect == null || pb == null || ab == null) {
//TODO log error here
return;
}
String stackType = ab.getStackType();
if (stackType.equals("WeaponMove")) {
DeferredPowerJob eff = new DeferredPowerJob(source, awo, stackType, trains, ab, pb, this.effect, this);
if (stackType.equals("IgnoreStack"))
awo.addEffect(Integer.toString(ab.getUUID()), 10000, eff, this.effect, trains);
else
awo.addEffect(stackType, 10000, eff, this.effect, trains);
if (awo.getObjectType().equals(GameObjectType.PlayerCharacter))
((PlayerCharacter) awo).setWeaponPower(eff);
this.effect.startEffect(source, awo, trains, eff);
} else {
FinishEffectTimeJob eff = new FinishEffectTimeJob(source, awo, stackType, trains, ab, pb, effect);
//add schedule job to end it if needed and add effect to pc
// if (pb.isChant())
// duration = (int)pb.getChantDuration() * 1000;
// else
if (blockInvul(pb, source, awo)) {
this.effect.endEffect(source, awo, trains, pb, eff);
return;
}
String stackType = ab.getStackType();
if (stackType.equals("WeaponMove")) {
DeferredPowerJob eff = new DeferredPowerJob(source, awo, stackType, trains, ab, pb, this.effect, this);
if (stackType.equals("IgnoreStack"))
awo.addEffect(Integer.toString(ab.getUUID()), 10000, eff, this.effect, trains);
else
awo.addEffect(stackType, 10000, eff, this.effect, trains);
if (awo.getObjectType().equals(GameObjectType.PlayerCharacter))
((PlayerCharacter)awo).setWeaponPower(eff);
this.effect.startEffect(source, awo, trains, eff);
} else {
FinishEffectTimeJob eff = new FinishEffectTimeJob(source, awo, stackType, trains, ab, pb, effect);
if (duration > 0) {
if (stackType.equals("IgnoreStack"))
awo.addEffect(Integer.toString(ab.getUUID()), duration, eff, effect, trains);
else
awo.addEffect(stackType, duration, eff, effect, trains);
} else
awo.applyAllBonuses();
// //TODO if chant, start cycle
// if (pb.isChant() && source.equals(awo)) {
// ChantJob cj = new ChantJob(source, awo, stackType, trains, ab, pb, effect, eff);
// source.setLastChant((int)(pb.getChantDuration()-2) * 1000, cj);
// eff.setChant(true);
// }
if (blockInvul(pb, source, awo)) {
this.effect.endEffect(source, awo, trains, pb, eff);
return;
}
if (this.effectID.equals("TAUNT")) {
if (duration > 0) {
if (stackType.equals("IgnoreStack"))
awo.addEffect(Integer.toString(ab.getUUID()), duration, eff, effect, trains);
else
awo.addEffect(stackType, duration, eff, effect, trains);
} else
awo.applyAllBonuses();
// //TODO if chant, start cycle
// if (pb.isChant() && source.equals(awo)) {
// ChantJob cj = new ChantJob(source, awo, stackType, trains, ab, pb, effect, eff);
// source.setLastChant((int)(pb.getChantDuration()-2) * 1000, cj);
// eff.setChant(true);
// }
if (awo != null && awo.getObjectType() == GameObjectType.Mob) {
((Mob) awo).setCombatTarget(source);
ChatSystemMsg msg = ChatManager.CombatInfo(source, awo);
DispatchMessage.sendToAllInRange(source, msg);
}
}
this.effect.startEffect(source, awo, trains, eff);
}
if (this.effectID.equals("TAUNT")){
if (awo != null && awo.getObjectType() == GameObjectType.Mob){
((Mob) awo).setCombatTarget(source);
ChatSystemMsg msg = ChatManager.CombatInfo(source, awo);
DispatchMessage.sendToAllInRange(source, msg);
}
}
this.effect.startEffect(source, awo, trains, eff);
}
}
}
}
@@ -25,100 +25,102 @@ import java.util.HashMap;
public class ApplyEffectsPowerAction extends AbstractPowerAction {
private String IDString;
private String effectID;
private String effectID2;
private EffectsBase effect;
private EffectsBase effect2;
private EffectsBase effectParent;
private String IDString;
private String effectID;
private String effectID2;
private EffectsBase effect;
private EffectsBase effect2;
private EffectsBase effectParent;
public ApplyEffectsPowerAction(ResultSet rs, HashMap<String, EffectsBase> effects) throws SQLException {
super(rs);
this.IDString = rs.getString("IDString");
this.effectID = rs.getString("effectID");
this.effectID2 = rs.getString("effectID2");
this.effect = effects.get(this.effectID);
this.effect2 = effects.get(this.effectID2);
this.effectParent = effects.get(this.IDString);
}
public ApplyEffectsPowerAction(ResultSet rs, HashMap<String, EffectsBase> effects) throws SQLException {
super(rs);
this.IDString = rs.getString("IDString");
this.effectID = rs.getString("effectID");
this.effectID2 = rs.getString("effectID2");
this.effect = effects.get(this.effectID);
this.effect2 = effects.get(this.effectID2);
this.effectParent = effects.get(this.IDString);
public String getEffectID() {
return this.effectID;
}
}
public String getEffectID2() {
return this.effectID2;
}
public String getEffectID() {
return this.effectID;
}
public EffectsBase getEffect() {
return this.effect;
}
public String getEffectID2() {
return this.effectID2;
}
public EffectsBase getEffect2() {
return this.effect2;
}
public EffectsBase getEffect() {
return this.effect;
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
public EffectsBase getEffect2() {
return this.effect2;
}
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
protected void _applyEffectForItem(Item item, int trains) {
if (item == null || this.effect == null)
return;
item.addEffectNoTimer(Integer.toString(this.effect.getUUID()), this.effect, trains,false);
if (this.effect2 != null)
item.addEffectNoTimer(Integer.toString(this.effect2.getUUID()), this.effect2, trains,false);
item.addEffectNoTimer(Integer.toString(this.effectParent.getUUID()), this.effectParent, trains,false);
}
protected void _applyBakedInStatsForItem(Item item, int trains) {
}
if (item == null)
return;
protected void _applyEffectForItem(Item item, int trains) {
if (item == null || this.effect == null)
return;
item.addEffectNoTimer(Integer.toString(this.effect.getUUID()), this.effect, trains, false);
if (this.effect2 != null)
item.addEffectNoTimer(Integer.toString(this.effect2.getUUID()), this.effect2, trains, false);
item.addEffectNoTimer(Integer.toString(this.effectParent.getUUID()), this.effectParent, trains, false);
}
if (this.effect == null){
Logger.error( "Unknown Token: EffectBase ID " + this.effectID + '.');
return;
}
protected void _applyBakedInStatsForItem(Item item, int trains) {
if (this.effect2 == null){
Logger.error( "Unknown Token: EffectBase ID " + this.effectID2 + '.');
return;
}
if (item == null)
return;
if (this.effectParent == null){
Logger.error( "Unknown Token: EffectBase ID " + this.IDString + '.');
return;
}
if (this.effect == null) {
Logger.error("Unknown Token: EffectBase ID " + this.effectID + '.');
return;
}
Effect eff = item.addEffectNoTimer(Integer.toString(this.effect.getUUID()), this.effect, trains,false);
Effect eff2 = item.addEffectNoTimer(Integer.toString(this.effect2.getUUID()), this.effect2, trains,false);
Effect eff3 = item.addEffectNoTimer(Integer.toString(this.effectParent.getUUID()), this.effectParent, trains,false);
if (this.effect2 == null) {
Logger.error("Unknown Token: EffectBase ID " + this.effectID2 + '.');
return;
}
if (eff != null && eff2 != null && eff3 != null){
eff3.setBakedInStat(true);
item.getEffectNames().add(this.effect.getIDString());
item.getEffectNames().add(this.effect2.getIDString());
item.getEffectNames().add(this.effectParent.getIDString());
}
}
@Override
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
}
if (this.effectParent == null) {
Logger.error("Unknown Token: EffectBase ID " + this.IDString + '.');
return;
}
public String getIDString() {
return IDString;
}
Effect eff = item.addEffectNoTimer(Integer.toString(this.effect.getUUID()), this.effect, trains, false);
Effect eff2 = item.addEffectNoTimer(Integer.toString(this.effect2.getUUID()), this.effect2, trains, false);
Effect eff3 = item.addEffectNoTimer(Integer.toString(this.effectParent.getUUID()), this.effectParent, trains, false);
public void setIDString(String iDString) {
IDString = iDString;
}
if (eff != null && eff2 != null && eff3 != null) {
eff3.setBakedInStat(true);
item.getEffectNames().add(this.effect.getIDString());
item.getEffectNames().add(this.effect2.getIDString());
item.getEffectNames().add(this.effectParent.getIDString());
}
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
// TODO Auto-generated method stub
@Override
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
}
}
public String getIDString() {
return IDString;
}
public void setIDString(String iDString) {
IDString = iDString;
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
// TODO Auto-generated method stub
}
}
@@ -21,23 +21,23 @@ import java.sql.SQLException;
public class BlockPowerAction extends AbstractPowerAction {
public BlockPowerAction(ResultSet rs) throws SQLException {
super(rs);
}
public BlockPowerAction(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
}
}
@Override
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
}
@Override
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
// TODO Auto-generated method stub
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
// TODO Auto-generated method stub
}
}
}
@@ -25,49 +25,49 @@ import java.sql.SQLException;
public class CharmPowerAction extends AbstractPowerAction {
private int levelCap;
private int levelCapRamp;
private int levelCap;
private int levelCapRamp;
public CharmPowerAction(ResultSet rs) throws SQLException {
super(rs);
this.levelCap = rs.getInt("levelCap");
this.levelCapRamp = rs.getInt("levelCapRamp");
}
public CharmPowerAction(ResultSet rs) throws SQLException {
super(rs);
this.levelCap = rs.getInt("levelCap");
this.levelCapRamp = rs.getInt("levelCapRamp");
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
if (source == null || awo == null || !(awo.getObjectType().equals(Enum.GameObjectType.Mob)) || !(source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)))
return;
if (source == null || awo == null || !(awo.getObjectType().equals(Enum.GameObjectType.Mob)) || !(source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)))
return;
PlayerCharacter owner = (PlayerCharacter) source;
ClientConnection origin = owner.getClientConnection();
PlayerCharacter owner = (PlayerCharacter) source;
ClientConnection origin = owner.getClientConnection();
if (origin == null)
return;
if (origin == null)
return;
//verify is mob, not pet or guard
Mob mob = (Mob) awo;
if (!mob.isMob())
return;
//verify is mob, not pet or guard
Mob mob = (Mob) awo;
if (!mob.isMob())
return;
//make sure mob isn't too high level
int cap = this.levelCap + (this.levelCapRamp * trains);
if (mob.getLevel() > cap && pb.getToken() != 1577464266)
return;
//make sure mob isn't too high level
int cap = this.levelCap + (this.levelCapRamp * trains);
if (mob.getLevel() > cap && pb.getToken() != 1577464266)
return;
//turn mob into pet.
owner.commandSiegeMinion(mob);
}
//turn mob into pet.
owner.commandSiegeMinion(mob);
}
@Override
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
}
@Override
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
// TODO Auto-generated method stub
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
// TODO Auto-generated method stub
}
}
}
@@ -22,46 +22,46 @@ import java.sql.SQLException;
public class ClaimMinePowerAction extends AbstractPowerAction {
public ClaimMinePowerAction(ResultSet rs) throws SQLException {
super(rs);
}
public ClaimMinePowerAction(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject worldObject, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject worldObject, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
if (source == null || worldObject == null)
return;
if (source == null || worldObject == null)
return;
if (!(source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)))
return;
if (!(source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)))
return;
PlayerCharacter playerCharacter = (PlayerCharacter) source;
PlayerCharacter playerCharacter = (PlayerCharacter) source;
if (!(worldObject.getObjectType().equals(Enum.GameObjectType.Building)))
return;
if (!(worldObject.getObjectType().equals(Enum.GameObjectType.Building)))
return;
Building mineBuilding = (Building)worldObject;
Building mineBuilding = (Building) worldObject;
if (mineBuilding.getRank() > 0)
return;
if (mineBuilding.getRank() > 0)
return;
Mine mine = Mine.getMineFromTower(mineBuilding.getObjectUUID());
Mine mine = Mine.getMineFromTower(mineBuilding.getObjectUUID());
if (mine == null)
return;
if (mine == null)
return;
if (mine.claimMine(playerCharacter) == true)
ChatManager.sendSystemMessage( (PlayerCharacter) source, "You successfully claimed this mine..");
}
if (mine.claimMine(playerCharacter) == true)
ChatManager.sendSystemMessage((PlayerCharacter) source, "You successfully claimed this mine..");
}
@Override
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
}
@Override
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
// TODO Auto-generated method stub
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
// TODO Auto-generated method stub
}
}
}
@@ -23,28 +23,27 @@ import java.sql.SQLException;
public class ClearAggroPowerAction extends AbstractPowerAction {
public ClearAggroPowerAction(ResultSet rs) throws SQLException {
super(rs);
}
public ClearAggroPowerAction(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
if (awo != null && awo.getObjectType() == GameObjectType.Mob){
((Mob)awo).setCombatTarget(null);
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
if (awo != null && awo.getObjectType() == GameObjectType.Mob) {
((Mob) awo).setCombatTarget(null);
}
}
}
@Override
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
}
@Override
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
// TODO Auto-generated method stub
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
// TODO Auto-generated method stub
}
}
}
@@ -22,25 +22,25 @@ import java.sql.SQLException;
public class ClearNearbyAggroPowerAction extends AbstractPowerAction {
public ClearNearbyAggroPowerAction(ResultSet rs) throws SQLException {
super(rs);
}
public ClearNearbyAggroPowerAction(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
if (source.getObjectType() == GameObjectType.Mob){
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
if (source.getObjectType() == GameObjectType.Mob) {
}
}
}
@Override
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
}
@Override
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
// TODO Auto-generated method stub
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
// TODO Auto-generated method stub
}
}
}
@@ -21,23 +21,23 @@ import java.sql.SQLException;
public class ConfusionPowerAction extends AbstractPowerAction {
public ConfusionPowerAction(ResultSet rs) throws SQLException {
super(rs);
}
public ConfusionPowerAction(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
}
}
@Override
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
}
@Override
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
// TODO Auto-generated method stub
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
// TODO Auto-generated method stub
}
}
}
@@ -30,114 +30,112 @@ import java.sql.SQLException;
public class CreateMobPowerAction extends AbstractPowerAction {
private int mobID;
private int mobLevel;
private int mobID;
private int mobLevel;
public CreateMobPowerAction(ResultSet rs) throws SQLException {
super(rs);
public CreateMobPowerAction(ResultSet rs) throws SQLException {
super(rs);
this.mobID = rs.getInt("mobID");
this.mobLevel = rs.getInt("mobLevel");
}
this.mobID = rs.getInt("mobID");
this.mobLevel = rs.getInt("mobLevel");
}
public int getMobID() {
return this.mobID;
}
public int getMobID() {
return this.mobID;
}
public int getMobLevel() {
return this.mobLevel;
}
public int getMobLevel() {
return this.mobLevel;
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
if (source == null || !(source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)))
return;
if (source == null || !(source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)))
return;
PlayerCharacter owner = (PlayerCharacter) source;
Mob currentPet = owner.getPet();
Zone seaFloor = ZoneManager.getSeaFloor();
Guild guild = Guild.getErrantGuild();
ClientConnection origin = owner.getClientConnection();
PlayerCharacter owner = (PlayerCharacter) source;
Mob currentPet = owner.getPet();
Zone seaFloor = ZoneManager.getSeaFloor();
Guild guild = Guild.getErrantGuild();
ClientConnection origin = owner.getClientConnection();
if (seaFloor == null || guild == null || origin == null)
return;
if (seaFloor == null || guild == null || origin == null)
return;
MobBase mobbase = MobBase.getMobBase(mobID);
MobBase mobbase = MobBase.getMobBase(mobID);
if (mobbase == null) {
Logger.error("Attempt to summon pet with null mobbase: " + mobID);
return;
}
if (mobbase == null) {
Logger.error("Attempt to summon pet with null mobbase: " + mobID);
return;
}
if (mobbase.isNecroPet() && owner.inSafeZone())
return;
if (mobbase.isNecroPet() && owner.inSafeZone())
return;
//create Pet
Mob pet = Mob.createPet(mobID, guild, seaFloor, owner, (short)mobLevel);
//create Pet
Mob pet = Mob.createPet(mobID, guild, seaFloor, owner, (short) mobLevel);
if(pet.getMobBaseID() == 12021 || pet.getMobBaseID() == 12022) { //is a necro pet
if(currentPet!= null && !currentPet.isNecroPet() && !currentPet.isSiege()) {
DbManager.removeFromCache(currentPet);
WorldGrid.RemoveWorldObject(currentPet);
if (pet.getMobBaseID() == 12021 || pet.getMobBaseID() == 12022) { //is a necro pet
if (currentPet != null && !currentPet.isNecroPet() && !currentPet.isSiege()) {
DbManager.removeFromCache(currentPet);
WorldGrid.RemoveWorldObject(currentPet);
currentPet.setCombatTarget(null);
if (currentPet.getParentZone() != null)
currentPet.getParentZone().zoneMobSet.remove(currentPet);
if (currentPet.getParentZone() != null)
currentPet.getParentZone().zoneMobSet.remove(currentPet);
currentPet.playerAgroMap.clear();
currentPet.playerAgroMap.clear();
try {
currentPet.clearEffects();
}catch(Exception e){
Logger.error(e.getMessage());
}
try {
currentPet.clearEffects();
} catch (Exception e) {
Logger.error(e.getMessage());
}
//currentPet.disableIntelligence();
}else if (currentPet != null && currentPet.isSiege()){
currentPet.setMob();
currentPet.setOwner(null);
currentPet.setCombatTarget(null);
//currentPet.disableIntelligence();
} else if (currentPet != null && currentPet.isSiege()) {
currentPet.setMob();
currentPet.setOwner(null);
currentPet.setCombatTarget(null);
if (currentPet.isAlive())
WorldGrid.updateObject(currentPet);
}
//remove 10th pet
NPCManager.spawnNecroPet(owner, pet);
if (currentPet.isAlive())
WorldGrid.updateObject(currentPet);
}
//remove 10th pet
}
else { //is not a necro pet
if(currentPet != null) {
if(!currentPet.isNecroPet() && !currentPet.isSiege()) {
DbManager.removeFromCache(currentPet);
currentPet.setCombatTarget(null);
NPCManager.spawnNecroPet(owner, pet);
} else { //is not a necro pet
if (currentPet != null) {
if (!currentPet.isNecroPet() && !currentPet.isSiege()) {
DbManager.removeFromCache(currentPet);
currentPet.setCombatTarget(null);
currentPet.setOwner(null);
WorldGrid.RemoveWorldObject(currentPet);
WorldGrid.RemoveWorldObject(currentPet);
currentPet.getParentZone().zoneMobSet.remove(currentPet);
currentPet.playerAgroMap.clear();
currentPet.clearEffects();
//currentPet.disableIntelligence();
}
else {
if (currentPet.isSiege()){
currentPet.setMob();
currentPet.setOwner(null);
currentPet.setCombatTarget(null);
currentPet.getParentZone().zoneMobSet.remove(currentPet);
currentPet.playerAgroMap.clear();
currentPet.clearEffects();
//currentPet.disableIntelligence();
} else {
if (currentPet.isSiege()) {
currentPet.setMob();
currentPet.setOwner(null);
currentPet.setCombatTarget(null);
if (currentPet.isAlive())
WorldGrid.updateObject(currentPet);
}
}
NPCManager.auditNecroPets(owner);
NPCManager.resetNecroPets(owner);
}
}
if (currentPet.isAlive())
WorldGrid.updateObject(currentPet);
}
}
NPCManager.auditNecroPets(owner);
NPCManager.resetNecroPets(owner);
}
}
/* if(owner.getPet() != null) {
if(owner.getPet().getMobBaseID() != 12021 && owner.getPet().getMobBaseID() != 12022) {
//if not a necro pet, remove pet
@@ -152,22 +150,22 @@ public class CreateMobPowerAction extends AbstractPowerAction {
}
}*/
// if (mobID == 12021 || mobID == 12022) //Necro Pets
// pet.setPet(owner, true);
owner.setPet(pet);
PetMsg pm = new PetMsg(5, pet);
Dispatch dispatch = Dispatch.borrow(owner, pm);
DispatchMessage.dispatchMsgDispatch(dispatch, engine.Enum.DispatchChannel.SECONDARY);
}
// if (mobID == 12021 || mobID == 12022) //Necro Pets
// pet.setPet(owner, true);
owner.setPet(pet);
PetMsg pm = new PetMsg(5, pet);
Dispatch dispatch = Dispatch.borrow(owner, pm);
DispatchMessage.dispatchMsgDispatch(dispatch, engine.Enum.DispatchChannel.SECONDARY);
}
@Override
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
}
@Override
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
// TODO Auto-generated method stub
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
// TODO Auto-generated method stub
}
}
}
@@ -24,62 +24,62 @@ import java.util.HashMap;
public class DamageOverTimePowerAction extends AbstractPowerAction {
private String effectID;
private int numIterations;
private EffectsBase effect;
private String effectID;
private int numIterations;
private EffectsBase effect;
public DamageOverTimePowerAction(ResultSet rs, HashMap<String, EffectsBase> effects) throws SQLException {
super(rs);
public DamageOverTimePowerAction(ResultSet rs, HashMap<String, EffectsBase> effects) throws SQLException {
super(rs);
this.effectID = rs.getString("effectID");
this.numIterations = rs.getInt("numIterations");
this.effect = effects.get(this.effectID);
}
this.effectID = rs.getString("effectID");
this.numIterations = rs.getInt("numIterations");
this.effect = effects.get(this.effectID);
}
public String getEffectID() {
return this.effectID;
}
public String getEffectID() {
return this.effectID;
}
public int getNumIterations() {
return this.numIterations;
}
public int getNumIterations() {
return this.numIterations;
}
public EffectsBase getEffect() {
return this.effect;
}
public EffectsBase getEffect() {
return this.effect;
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
if (this.effect == null || pb == null || ab == null) {
//TODO log error here
return;
}
//add schedule job to end it if needed and add effect to pc
int duration = ab.getDuration(trains);
String stackType = ab.getStackType();
DamageOverTimeJob eff = new DamageOverTimeJob(source, awo, stackType, trains, ab, pb, this.effect, this);
int tick = eff.getTickLength();
if (duration > 0) {
if (stackType.equals("IgnoreStack"))
awo.addEffect(Integer.toString(ab.getUUID()), eff.getTickLength(), eff, this.effect, trains);
else
awo.addEffect(stackType, tick, eff, this.effect, trains);
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
if (this.effect == null || pb == null || ab == null) {
//TODO log error here
return;
}
//add schedule job to end it if needed and add effect to pc
int duration = ab.getDuration(trains);
String stackType = ab.getStackType();
DamageOverTimeJob eff = new DamageOverTimeJob(source, awo, stackType, trains, ab, pb, this.effect, this);
int tick = eff.getTickLength();
if (duration > 0) {
if (stackType.equals("IgnoreStack"))
awo.addEffect(Integer.toString(ab.getUUID()), eff.getTickLength(), eff, this.effect, trains);
else
awo.addEffect(stackType, tick, eff, this.effect, trains);
}
//start effect icon for client. Skip applying dot until first iteration.
eff.setSkipApplyEffect(true);
this.effect.startEffect(source, awo, trains, eff);
eff.setSkipApplyEffect(false);
}
//start effect icon for client. Skip applying dot until first iteration.
eff.setSkipApplyEffect(true);
this.effect.startEffect(source, awo, trains, eff);
eff.setSkipApplyEffect(false);
}
@Override
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
}
@Override
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
// TODO Auto-generated method stub
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
// TODO Auto-generated method stub
}
}
}
@@ -26,70 +26,70 @@ import java.util.HashMap;
public class DeferredPowerPowerAction extends AbstractPowerAction {
private String effectID;
private String deferedPowerID;
private EffectsBase effect;
// private EffectsBase deferedPower;
private String effectID;
private String deferedPowerID;
private EffectsBase effect;
// private EffectsBase deferedPower;
public DeferredPowerPowerAction(ResultSet rs, HashMap<String, EffectsBase> effects) throws SQLException {
super(rs);
public DeferredPowerPowerAction(ResultSet rs, HashMap<String, EffectsBase> effects) throws SQLException {
super(rs);
this.effectID = rs.getString("effectID");
this.deferedPowerID = rs.getString("deferredPowerID");
this.effect = effects.get(this.effectID);
}
this.effectID = rs.getString("effectID");
this.deferedPowerID = rs.getString("deferredPowerID");
this.effect = effects.get(this.effectID);
}
public String getEffectID() {
return this.effectID;
}
public String getEffectID() {
return this.effectID;
}
public String getDeferredPowerID() {
return this.deferedPowerID;
}
public String getDeferredPowerID() {
return this.deferedPowerID;
}
public EffectsBase getEffect() {
return this.effect;
}
public EffectsBase getEffect() {
return this.effect;
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
if (this.effect == null || pb == null || ab == null) {
//TODO log error here
return;
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
if (this.effect == null || pb == null || ab == null) {
//TODO log error here
return;
}
//add schedule job to end it if needed and add effect to pc
//add schedule job to end it if needed and add effect to pc
String stackType = ab.getStackType();
DeferredPowerJob eff = new DeferredPowerJob(source, awo, stackType, trains, ab, pb, this.effect, this);
if (stackType.equals("IgnoreStack"))
awo.addEffect(Integer.toString(ab.getUUID()), 10000, eff, this.effect, trains);
else
awo.addEffect(stackType, 10000, eff, this.effect, trains);
String stackType = ab.getStackType();
DeferredPowerJob eff = new DeferredPowerJob(source, awo, stackType, trains, ab, pb, this.effect, this);
if (stackType.equals("IgnoreStack"))
awo.addEffect(Integer.toString(ab.getUUID()), 10000, eff, this.effect, trains);
else
awo.addEffect(stackType, 10000, eff, this.effect, trains);
switch (awo.getObjectType()){
case PlayerCharacter:
((PlayerCharacter)awo).setWeaponPower(eff);
break;
case Mob:
((Mob)awo).setWeaponPower(eff);
break;
default:
break;
}
switch (awo.getObjectType()) {
case PlayerCharacter:
((PlayerCharacter) awo).setWeaponPower(eff);
break;
case Mob:
((Mob) awo).setWeaponPower(eff);
break;
default:
break;
}
this.effect.startEffect(source, awo, trains, eff);
}
this.effect.startEffect(source, awo, trains, eff);
}
@Override
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
}
@Override
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
// TODO Auto-generated method stub
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
// TODO Auto-generated method stub
}
}
}
@@ -25,69 +25,69 @@ import java.util.HashMap;
public class DirectDamagePowerAction extends AbstractPowerAction {
private String effectID;
private EffectsBase effect;
private String effectID;
private EffectsBase effect;
public DirectDamagePowerAction(ResultSet rs, HashMap<String, EffectsBase> effects) throws SQLException {
super(rs);
public DirectDamagePowerAction(ResultSet rs, HashMap<String, EffectsBase> effects) throws SQLException {
super(rs);
this.effectID = rs.getString("effectID");
this.effect = effects.get(this.effectID);
}
this.effectID = rs.getString("effectID");
this.effect = effects.get(this.effectID);
}
public String getEffectID() {
return this.effectID;
}
public String getEffectID() {
return this.effectID;
}
public EffectsBase getEffect() {
return this.effect;
}
public EffectsBase getEffect() {
return this.effect;
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
if (this.effect == null || pb == null || ab == null) {
//TODO log error here
return;
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
if (this.effect == null || pb == null || ab == null) {
//TODO log error here
return;
}
//add schedule job to end it if needed and add effect to pc
int duration = ab.getDuration(trains);
String stackType = ab.getStackType();
FinishEffectTimeJob eff = new FinishEffectTimeJob(source, awo, stackType, trains, ab, pb, this.effect);
eff.setSkipSendEffect(true);
if (duration > 0) {
if (stackType.equals("IgnoreStack"))
awo.addEffect(Integer.toString(ab.getUUID()), duration, eff, this.effect, trains);
else
awo.addEffect(stackType, duration, eff, this.effect, trains);
}
//add schedule job to end it if needed and add effect to pc
int duration = ab.getDuration(trains);
String stackType = ab.getStackType();
FinishEffectTimeJob eff = new FinishEffectTimeJob(source, awo, stackType, trains, ab, pb, this.effect);
eff.setSkipSendEffect(true);
if (duration > 0) {
if (stackType.equals("IgnoreStack"))
awo.addEffect(Integer.toString(ab.getUUID()), duration, eff, this.effect, trains);
else
awo.addEffect(stackType, duration, eff, this.effect, trains);
}
// //if chant, start cycle
// if (pb.isChant() && targetLoc.x != 0f && targetLoc.z != 0f) {
// PersistentAoeJob paoe = new PersistentAoeJob(source, stackType, trains, ab, pb, effect, eff, targetLoc);
// source.addPersistantAoe(stackType, (int)(pb.getChantDuration() * 1000), paoe, effect, trains);
// eff.setChant(true);
// }
// //if chant, start cycle
// if (pb.isChant() && targetLoc.x != 0f && targetLoc.z != 0f) {
// PersistentAoeJob paoe = new PersistentAoeJob(source, stackType, trains, ab, pb, effect, eff, targetLoc);
// source.addPersistantAoe(stackType, (int)(pb.getChantDuration() * 1000), paoe, effect, trains);
// eff.setChant(true);
// }
this.effect.startEffect(source, awo, trains, eff);
}
this.effect.startEffect(source, awo, trains, eff);
}
@Override
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
String stackType = ab.getStackType();
stackType = stackType.equals("IgnoreStack") ? Integer.toString(ab.getUUID()) : stackType;
FinishEffectTimeJob eff = new FinishEffectTimeJob(source, target, stackType, trains, ab, pb, this.effect);
if (targetLoc.x != 0f && targetLoc.z != 0f) {
PersistentAoeJob paoe = new PersistentAoeJob(source,target, stackType, trains, ab, pb, effect, eff, targetLoc);
source.addPersistantAoe(stackType, (int)(pb.getChantDuration() * 1000), paoe, effect, trains);
eff.setChant(true);
}
}
@Override
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
String stackType = ab.getStackType();
stackType = stackType.equals("IgnoreStack") ? Integer.toString(ab.getUUID()) : stackType;
FinishEffectTimeJob eff = new FinishEffectTimeJob(source, target, stackType, trains, ab, pb, this.effect);
if (targetLoc.x != 0f && targetLoc.z != 0f) {
PersistentAoeJob paoe = new PersistentAoeJob(source, target, stackType, trains, ab, pb, effect, eff, targetLoc);
source.addPersistantAoe(stackType, (int) (pb.getChantDuration() * 1000), paoe, effect, trains);
eff.setChant(true);
}
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
// TODO Auto-generated method stub
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
// TODO Auto-generated method stub
}
}
}
@@ -26,51 +26,51 @@ import java.sql.SQLException;
public class FearPowerAction extends AbstractPowerAction {
private int levelCap;
private int levelCapRamp;
private int levelCap;
private int levelCapRamp;
public FearPowerAction(ResultSet rs) throws SQLException {
super(rs);
this.levelCap = rs.getInt("levelCap");
this.levelCapRamp = rs.getInt("levelCapRamp");
}
public FearPowerAction(ResultSet rs) throws SQLException {
super(rs);
this.levelCap = rs.getInt("levelCap");
this.levelCapRamp = rs.getInt("levelCapRamp");
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
if (source == null || awo == null || !(awo.getObjectType().equals(Enum.GameObjectType.Mob)) || !(source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)))
return;
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
if (source == null || awo == null || !(awo.getObjectType().equals(Enum.GameObjectType.Mob)) || !(source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)))
return;
PlayerCharacter owner = (PlayerCharacter) source;
ClientConnection origin = owner.getClientConnection();
if (origin == null)
return;
PlayerCharacter owner = (PlayerCharacter) source;
ClientConnection origin = owner.getClientConnection();
if (origin == null)
return;
//verify is mob, not pet or guard
Mob mob = (Mob) awo;
if (!mob.isMob())
return;
//verify is mob, not pet or guard
Mob mob = (Mob) awo;
if (!mob.isMob())
return;
//make sure mob isn't too high level
int cap = this.levelCap + (this.levelCapRamp * trains);
if (mob.getLevel() > cap || mob.getLevel() > 79)
return;
//make sure mob isn't too high level
int cap = this.levelCap + (this.levelCapRamp * trains);
if (mob.getLevel() > cap || mob.getLevel() > 79)
return;
//Apply fear to mob
int duration = 10 + ((int)(trains * 0.5));
String stackType = ab.getStackType();
EndFearJob efj = new EndFearJob(source, awo, stackType, trains, ab, pb, null);
((Mob)awo).setFearedObject(source);
JobScheduler.getInstance().scheduleJob(efj, duration * 1000);
}
//Apply fear to mob
int duration = 10 + ((int) (trains * 0.5));
String stackType = ab.getStackType();
EndFearJob efj = new EndFearJob(source, awo, stackType, trains, ab, pb, null);
((Mob) awo).setFearedObject(source);
JobScheduler.getInstance().scheduleJob(efj, duration * 1000);
}
@Override
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
}
@Override
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
// TODO Auto-generated method stub
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
// TODO Auto-generated method stub
}
}
}
@@ -24,55 +24,55 @@ import java.util.HashMap;
public class InvisPowerAction extends AbstractPowerAction {
private String effectID;
private EffectsBase effect;
private String effectID;
private EffectsBase effect;
public InvisPowerAction(ResultSet rs, HashMap<String, EffectsBase> effects) throws SQLException {
super(rs);
public InvisPowerAction(ResultSet rs, HashMap<String, EffectsBase> effects) throws SQLException {
super(rs);
this.effectID = rs.getString("effectID");
this.effect = effects.get(this.effectID);
}
this.effectID = rs.getString("effectID");
this.effect = effects.get(this.effectID);
}
public String getEffectID() {
return this.effectID;
}
public String getEffectID() {
return this.effectID;
}
public EffectsBase getEffect() {
return this.effect;
}
public EffectsBase getEffect() {
return this.effect;
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
if (this.effect == null || pb == null || ab == null) {
//TODO log error here
return;
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
if (this.effect == null || pb == null || ab == null) {
//TODO log error here
return;
}
// if (this.effect.ignoreMod())
// trains = 50; //set above see invis for safe mode and csr-invis
// if (this.effect.ignoreMod())
// trains = 50; //set above see invis for safe mode and csr-invis
//add schedule job to end it if needed and add effect to pc
int duration = ab.getDuration(trains);
String stackType = ab.getStackType();
FinishEffectTimeJob eff = new FinishEffectTimeJob(source, awo, stackType, trains, ab, pb, this.effect);
if (duration > 0) {
if (stackType.equals("IgnoreStack"))
awo.addEffect(Integer.toString(ab.getUUID()), duration, eff, this.effect, trains);
else
awo.addEffect(stackType, duration, eff, this.effect, trains);
}
this.effect.startEffect(source, awo, trains, eff);
}
//add schedule job to end it if needed and add effect to pc
int duration = ab.getDuration(trains);
String stackType = ab.getStackType();
FinishEffectTimeJob eff = new FinishEffectTimeJob(source, awo, stackType, trains, ab, pb, this.effect);
if (duration > 0) {
if (stackType.equals("IgnoreStack"))
awo.addEffect(Integer.toString(ab.getUUID()), duration, eff, this.effect, trains);
else
awo.addEffect(stackType, duration, eff, this.effect, trains);
}
this.effect.startEffect(source, awo, trains, eff);
}
@Override
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
}
@Override
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
// TODO Auto-generated method stub
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
// TODO Auto-generated method stub
}
}
}
@@ -10,7 +10,6 @@
package engine.powers.poweractions;
import engine.Enum.GameObjectType;
import engine.ai.MobileFSM;
import engine.gameManager.MovementManager;
import engine.math.Vector3fImmutable;
import engine.objects.AbstractCharacter;
@@ -25,37 +24,37 @@ import java.sql.SQLException;
public class MobRecallPowerAction extends AbstractPowerAction {
public MobRecallPowerAction(ResultSet rs) throws SQLException {
super(rs);
}
public MobRecallPowerAction(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
if (!AbstractWorldObject.IsAbstractCharacter(awo) || source == null)
return;
AbstractCharacter awoac = (AbstractCharacter)awo;
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
if (!AbstractWorldObject.IsAbstractCharacter(awo) || source == null)
return;
AbstractCharacter awoac = (AbstractCharacter) awo;
if (awo.getObjectType() != GameObjectType.Mob)
return;
MovementManager.translocate(awoac,awoac.getBindLoc(), null);
if (awoac.getObjectType() == GameObjectType.Mob){
//MobileFSM.setAwake((Mob)awoac,true);
((Mob)awoac).setCombatTarget(null);
}
if (awo.getObjectType() != GameObjectType.Mob)
return;
}
MovementManager.translocate(awoac, awoac.getBindLoc(), null);
if (awoac.getObjectType() == GameObjectType.Mob) {
//MobileFSM.setAwake((Mob)awoac,true);
((Mob) awoac).setCombatTarget(null);
}
@Override
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
// TODO Auto-generated method stub
}
}
@Override
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
// TODO Auto-generated method stub
}
}
@@ -26,99 +26,99 @@ import java.sql.SQLException;
public class OpenGatePowerAction extends AbstractPowerAction {
/**
* ResultSet Constructor
*/
public OpenGatePowerAction(ResultSet rs) throws SQLException {
super(rs);
}
/**
* ResultSet Constructor
*/
public OpenGatePowerAction(ResultSet rs) throws SQLException {
super(rs);
}
public OpenGatePowerAction(int uUID, String iDString, String type, boolean isAggressive, long validItemFlags) {
super(uUID, iDString, type, isAggressive, validItemFlags);
// TODO Auto-generated constructor stub
}
public OpenGatePowerAction(int uUID, String iDString, String type, boolean isAggressive, long validItemFlags) {
super(uUID, iDString, type, isAggressive, validItemFlags);
// TODO Auto-generated constructor stub
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
if (awo.getObjectType().equals(GameObjectType.Building) == false)
return;
Building targetBuilding = (Building) awo;
int token;
if (awo.getObjectType().equals(GameObjectType.Building) == false)
return;
// Sanity check.
Building targetBuilding = (Building) awo;
int token;
if (source == null || awo == null || !(awo.getObjectType().equals(Enum.GameObjectType.Building)) || pb == null)
return;
// Sanity check.
// Make sure building has a blueprint
if (source == null || awo == null || !(awo.getObjectType().equals(Enum.GameObjectType.Building)) || pb == null)
return;
if (targetBuilding.getBlueprintUUID() == 0)
return;
// Make sure building has a blueprint
// Make sure building is actually a runegate.
if (targetBuilding.getBlueprintUUID() == 0)
return;
if (targetBuilding.getBlueprint().getBuildingGroup() != BuildingGroup.RUNEGATE)
return;
// Make sure building is actually a runegate.
// Which portal was opened?
if (targetBuilding.getBlueprint().getBuildingGroup() != BuildingGroup.RUNEGATE)
return;
token = pb.getToken();
PortalType portalType = PortalType.AIR;
// Which portal was opened?
switch (token) {
case 428937084: //Death Gate
portalType = PortalType.OBLIV;
break;
token = pb.getToken();
PortalType portalType = PortalType.AIR;
case 429756284: //Chaos Gate
portalType = PortalType.CHAOS;
break;
switch (token) {
case 428937084: //Death Gate
portalType = PortalType.OBLIV;
break;
case 429723516: //Khar Gate
portalType = PortalType.MERCHANT;
break;
case 429756284: //Chaos Gate
portalType = PortalType.CHAOS;
break;
case 429559676: //Spirit Gate
portalType = PortalType.SPIRIT;
break;
case 429723516: //Khar Gate
portalType = PortalType.MERCHANT;
break;
case 429592444: //Water Gate
portalType = PortalType.WATER;
break;
case 429559676: //Spirit Gate
portalType = PortalType.SPIRIT;
break;
case 429428604: //Fire Gate
portalType = PortalType.FIRE;
break;
case 429592444: //Water Gate
portalType = PortalType.WATER;
break;
case 429526908: //Air Gate
portalType = PortalType.AIR;
break;
case 429428604: //Fire Gate
portalType = PortalType.FIRE;
break;
case 429625212: //Earth Gate
portalType = PortalType.EARTH;
break;
case 429526908: //Air Gate
portalType = PortalType.AIR;
break;
default:
}
case 429625212: //Earth Gate
portalType = PortalType.EARTH;
break;
// Which runegate was clicked on?
default:
}
Runegate runeGate = Runegate._runegates.get(targetBuilding.getObjectUUID());
runeGate.activatePortal(portalType);
// Which runegate was clicked on?
}
Runegate runeGate = Runegate._runegates.get(targetBuilding.getObjectUUID());
runeGate.activatePortal(portalType);
@Override
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
}
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
// TODO Auto-generated method stub
@Override
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
}
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
// TODO Auto-generated method stub
}
}
@@ -26,112 +26,111 @@ import java.util.concurrent.ThreadLocalRandom;
public class PeekPowerAction extends AbstractPowerAction {
public PeekPowerAction(ResultSet rs) throws SQLException {
super(rs);
}
public PeekPowerAction(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
protected static boolean peekSuccess(AbstractCharacter pc, AbstractWorldObject awo) {
if (pc == null || awo == null || !AbstractWorldObject.IsAbstractCharacter(awo) || pc.getPowers() == null)
return false;
if (source == null || awo == null || !(source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)))
return;
int levelDif = pc.getLevel() - ((AbstractCharacter) awo).getLevel();
PlayerCharacter pc = null;
if (source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter))
pc = (PlayerCharacter) source;
if (!pc.getPowers().containsKey(429494332))
return false;
AbstractCharacter target = null;
if (AbstractWorldObject.IsAbstractCharacter(awo))
target = (AbstractCharacter) awo;
CharacterPower cp = pc.getPowers().get(429494332);
int trains = cp.getTotalTrains();
//test probability of successful peek
boolean peekSuccess = peekSuccess(source, awo);
if (peekSuccess) {
ChatManager.chatPeekSteal(pc, target, null, true, peekDetect(source, awo), -1);
} else {
ChatManager.chatPeekSteal(pc, target, null, false, false, -1);
return;
}
float chance = 30 + (trains * 1.5f) + levelDif;
chance = (chance < 5f) ? 5f : chance;
chance = (chance > 95f) ? 95f : chance;
LootWindowResponseMsg lwrm = null;
float roll = ThreadLocalRandom.current().nextFloat() * 100f;
if (awo.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
return roll < chance;
PlayerCharacter tar = (PlayerCharacter)awo;
}
if (!tar.isAlive())
return;
protected static boolean peekDetect(AbstractCharacter pc, AbstractWorldObject awo) {
if (pc == null || awo == null || !AbstractWorldObject.IsAbstractCharacter(awo) || pc.getPowers() == null)
return false;
lwrm = new LootWindowResponseMsg(tar.getObjectType().ordinal(), tar.getObjectUUID(), tar.getInventory(true));
} else if (awo.getObjectType().equals(Enum.GameObjectType.Mob)) {
int levelDif = pc.getLevel() - ((AbstractCharacter) awo).getLevel();
Mob tar = (Mob) awo;
if (!pc.getPowers().containsKey(429494332))
return false;
if (!tar.isAlive())
return;
CharacterPower cp = pc.getPowers().get(429494332);
int trains = cp.getTotalTrains();
lwrm = new LootWindowResponseMsg(tar.getObjectType().ordinal(), tar.getObjectUUID(), tar.getInventory(true));
}
if (lwrm == null)
return;
// check if peek is detected
float chance = 30 + (40 - trains) * 1.5f - levelDif;
chance = (chance < 5f) ? 5f : chance;
chance = (chance > 95f) ? 95f : chance;
Dispatch dispatch = Dispatch.borrow(pc, lwrm);
DispatchMessage.dispatchMsgDispatch(dispatch, engine.Enum.DispatchChannel.SECONDARY);
}
float roll = ThreadLocalRandom.current().nextFloat() * 100f;
return roll < chance;
@Override
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
}
}
protected static boolean peekSuccess(AbstractCharacter pc, AbstractWorldObject awo) {
if (pc == null || awo == null || !AbstractWorldObject.IsAbstractCharacter(awo) || pc.getPowers() == null)
return false;
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
int levelDif = pc.getLevel() - ((AbstractCharacter)awo).getLevel();
if (source == null || awo == null || !(source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)))
return;
if (!pc.getPowers().containsKey(429494332))
return false;
PlayerCharacter pc = null;
if (source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter))
pc = (PlayerCharacter) source;
CharacterPower cp = pc.getPowers().get(429494332);
int trains = cp.getTotalTrains();
AbstractCharacter target = null;
if (AbstractWorldObject.IsAbstractCharacter(awo))
target = (AbstractCharacter) awo;
float chance = 30 + (trains * 1.5f) + levelDif;
chance = (chance < 5f) ? 5f : chance;
chance = (chance > 95f) ? 95f : chance;
//test probability of successful peek
boolean peekSuccess = peekSuccess(source, awo);
if (peekSuccess) {
ChatManager.chatPeekSteal(pc, target, null, true, peekDetect(source, awo), -1);
} else {
ChatManager.chatPeekSteal(pc, target, null, false, false, -1);
return;
}
float roll = ThreadLocalRandom.current().nextFloat() * 100f;
LootWindowResponseMsg lwrm = null;
return roll < chance;
if (awo.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
}
PlayerCharacter tar = (PlayerCharacter) awo;
if (!tar.isAlive())
return;
protected static boolean peekDetect(AbstractCharacter pc, AbstractWorldObject awo) {
if (pc == null || awo == null || !AbstractWorldObject.IsAbstractCharacter(awo) || pc.getPowers() == null)
return false;
lwrm = new LootWindowResponseMsg(tar.getObjectType().ordinal(), tar.getObjectUUID(), tar.getInventory(true));
} else if (awo.getObjectType().equals(Enum.GameObjectType.Mob)) {
int levelDif = pc.getLevel() - ((AbstractCharacter)awo).getLevel();
Mob tar = (Mob) awo;
if (!pc.getPowers().containsKey(429494332))
return false;
if (!tar.isAlive())
return;
CharacterPower cp = pc.getPowers().get(429494332);
int trains = cp.getTotalTrains();
lwrm = new LootWindowResponseMsg(tar.getObjectType().ordinal(), tar.getObjectUUID(), tar.getInventory(true));
}
if (lwrm == null)
return;
// check if peek is detected
float chance = 30 + (40-trains)*1.5f - levelDif;
chance = (chance < 5f) ? 5f : chance;
chance = (chance > 95f) ? 95f : chance;
Dispatch dispatch = Dispatch.borrow(pc, lwrm);
DispatchMessage.dispatchMsgDispatch(dispatch, engine.Enum.DispatchChannel.SECONDARY);
}
float roll = ThreadLocalRandom.current().nextFloat() * 100f;
return roll < chance;
@Override
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
}
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
// TODO Auto-generated method stub
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
// TODO Auto-generated method stub
}
}
}
@@ -11,7 +11,6 @@ package engine.powers.poweractions;
import engine.Enum.GameObjectType;
import engine.InterestManagement.WorldGrid;
import engine.ai.MobileFSM;
import engine.gameManager.MovementManager;
import engine.math.Vector3fImmutable;
import engine.net.Dispatch;
@@ -32,57 +31,57 @@ import java.sql.SQLException;
public class RecallPowerAction extends AbstractPowerAction {
public RecallPowerAction(ResultSet rs) throws SQLException {
super(rs);
}
public RecallPowerAction(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
if (!AbstractWorldObject.IsAbstractCharacter(awo) || source == null)
return;
AbstractCharacter awoac = (AbstractCharacter)awo;
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
if (!AbstractWorldObject.IsAbstractCharacter(awo) || source == null)
return;
AbstractCharacter awoac = (AbstractCharacter) awo;
if (awo.getObjectType().equals(GameObjectType.PlayerCharacter)) {
if (awo.getObjectType().equals(GameObjectType.PlayerCharacter)) {
PlayerCharacter pc = (PlayerCharacter) awo;
PlayerCharacter pc = (PlayerCharacter) awo;
if (pc.hasBoon())
return;
if (pc.hasBoon())
return;
ClientConnection cc = pc.getClientConnection();
ClientConnection cc = pc.getClientConnection();
if(source.getObjectUUID() != pc.getObjectUUID()) {
pc.setTimeStampNow("PromptRecall");
pc.setTimeStamp("LastRecallType",1); //recall to bind
PromptRecallMsg promptRecallMsgmsg = new PromptRecallMsg();
Dispatch dispatch = Dispatch.borrow(pc, promptRecallMsgmsg);
DispatchMessage.dispatchMsgDispatch(dispatch, engine.Enum.DispatchChannel.SECONDARY);
if (source.getObjectUUID() != pc.getObjectUUID()) {
pc.setTimeStampNow("PromptRecall");
pc.setTimeStamp("LastRecallType", 1); //recall to bind
PromptRecallMsg promptRecallMsgmsg = new PromptRecallMsg();
Dispatch dispatch = Dispatch.borrow(pc, promptRecallMsgmsg);
DispatchMessage.dispatchMsgDispatch(dispatch, engine.Enum.DispatchChannel.SECONDARY);
} else {
MovementManager.translocate(awoac, awoac.getBindLoc(), null);
}
} else {
Vector3fImmutable bindloc = awoac.getBindLoc();
if (bindloc.x == 0.0f || bindloc.y == 0.0f)
awoac.setBindLoc(MBServerStatics.startX, MBServerStatics.startY, MBServerStatics.startZ);
awoac.teleport(awoac.getBindLoc());
if (awoac.getObjectType() == GameObjectType.Mob){
((Mob)awoac).setCombatTarget(null);
if (awoac.isAlive())
WorldGrid.updateObject(awoac);
}
} else {
MovementManager.translocate(awoac, awoac.getBindLoc(), null);
}
} else {
Vector3fImmutable bindloc = awoac.getBindLoc();
if (bindloc.x == 0.0f || bindloc.y == 0.0f)
awoac.setBindLoc(MBServerStatics.startX, MBServerStatics.startY, MBServerStatics.startZ);
awoac.teleport(awoac.getBindLoc());
if (awoac.getObjectType() == GameObjectType.Mob) {
((Mob) awoac).setCombatTarget(null);
if (awoac.isAlive())
WorldGrid.updateObject(awoac);
}
}
}
}
}
@Override
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
}
@Override
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
// TODO Auto-generated method stub
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
// TODO Auto-generated method stub
}
}
}
@@ -22,41 +22,40 @@ import java.sql.SQLException;
public class RemoveEffectPowerAction extends AbstractPowerAction {
public EffectSourceType sourceType;
private boolean removeAll;
public RemoveEffectPowerAction(ResultSet rs) throws SQLException {
super(rs);
String effectTypeToRemove = rs.getString("effectSourceToRemove").replace("-", "").trim();
sourceType = EffectSourceType.GetEffectSourceType(effectTypeToRemove);
int flags = rs.getInt("flags");
this.removeAll = ((flags & 2) != 0) ? true : false;
}
public EffectSourceType sourceType;
private boolean removeAll;
public RemoveEffectPowerAction(ResultSet rs) throws SQLException {
super(rs);
String effectTypeToRemove = rs.getString("effectSourceToRemove").replace("-", "").trim();
sourceType = EffectSourceType.GetEffectSourceType(effectTypeToRemove);
int flags = rs.getInt("flags");
this.removeAll = ((flags & 2) != 0) ? true : false;
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
if (awo != null) {
if (this.removeAll)
awo.removeEffectBySource(this.sourceType, trains, true);
else
if (this.getIDString().equals("SNC-003A"))
trains = 40;
awo.removeEffectBySource(this.sourceType, trains, false);
}
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
if (awo != null) {
@Override
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
// TODO Auto-generated method stub
if (this.removeAll)
awo.removeEffectBySource(this.sourceType, trains, true);
else if (this.getIDString().equals("SNC-003A"))
trains = 40;
awo.removeEffectBySource(this.sourceType, trains, false);
}
}
}
@Override
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
// TODO Auto-generated method stub
}
}
@@ -21,23 +21,23 @@ import java.sql.SQLException;
public class ResurrectPowerAction extends AbstractPowerAction {
public ResurrectPowerAction(ResultSet rs) throws SQLException {
super(rs);
}
public ResurrectPowerAction(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
}
}
@Override
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
}
@Override
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
// TODO Auto-generated method stub
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
// TODO Auto-generated method stub
}
}
}
@@ -26,62 +26,62 @@ import static engine.math.FastMath.sqrt;
public class RunegateTeleportPowerAction extends AbstractPowerAction {
/**
* ResultSet Constructor
*/
public RunegateTeleportPowerAction(ResultSet rs) throws SQLException {
super(rs);
}
/**
* ResultSet Constructor
*/
public RunegateTeleportPowerAction(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
if (source == null || awo == null || !(awo .getObjectType().equals(Enum.GameObjectType.PlayerCharacter)))
return;
if (source == null || awo == null || !(awo.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)))
return;
PlayerCharacter pc = (PlayerCharacter) awo;
float dist = 9999999999f;
Building rg = null;
Vector3fImmutable rgLoc;
PlayerCharacter pc = (PlayerCharacter) awo;
float dist = 9999999999f;
Building rg = null;
Vector3fImmutable rgLoc;
for (Runegate runegate: Runegate._runegates.values()) {
for (Runegate runegate : Runegate._runegates.values()) {
rgLoc = runegate.gateBuilding.getLoc();
rgLoc = runegate.gateBuilding.getLoc();
float distanceToRunegateSquared = source.getLoc().distanceSquared2D(rgLoc);
float distanceToRunegateSquared = source.getLoc().distanceSquared2D(rgLoc);
if (distanceToRunegateSquared < sqr(dist)) {
dist = sqrt(distanceToRunegateSquared);
rg = runegate.gateBuilding;
}
}
if (distanceToRunegateSquared < sqr(dist)) {
dist = sqrt(distanceToRunegateSquared);
rg = runegate.gateBuilding;
}
}
if(source.getObjectUUID() != pc.getObjectUUID()) {
pc.setTimeStampNow("PromptRecall");
pc.setTimeStamp("LastRecallType",0); //recall to rg
if (source.getObjectUUID() != pc.getObjectUUID()) {
pc.setTimeStampNow("PromptRecall");
pc.setTimeStamp("LastRecallType", 0); //recall to rg
if (rg != null) {
PromptRecallMsg promptRecallMsgmsg = new PromptRecallMsg();
Dispatch dispatch = Dispatch.borrow(pc, promptRecallMsgmsg);
DispatchMessage.dispatchMsgDispatch(dispatch, engine.Enum.DispatchChannel.SECONDARY);
}
if (rg != null) {
PromptRecallMsg promptRecallMsgmsg = new PromptRecallMsg();
Dispatch dispatch = Dispatch.borrow(pc, promptRecallMsgmsg);
DispatchMessage.dispatchMsgDispatch(dispatch, engine.Enum.DispatchChannel.SECONDARY);
}
} else {
if (rg != null) {
pc.teleport(rg.getLoc());
pc.setSafeMode();
}
}
}
} else {
if (rg != null) {
pc.teleport(rg.getLoc());
pc.setSafeMode();
}
}
}
@Override
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
}
@Override
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
// TODO Auto-generated method stub
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
// TODO Auto-generated method stub
}
}
}
@@ -25,41 +25,41 @@ import java.sql.SQLException;
public class SetItemFlagPowerAction extends AbstractPowerAction {
public SetItemFlagPowerAction(ResultSet rs) throws SQLException {
super(rs);
}
public SetItemFlagPowerAction(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
if (source == null || awo == null || !(awo .getObjectType().equals(Enum.GameObjectType.Item)))
return;
if (source == null || awo == null || !(awo.getObjectType().equals(Enum.GameObjectType.Item)))
return;
Item item = (Item) awo;
Item item = (Item) awo;
if (item.containerType != Enum.ItemContainerType.INVENTORY)
return; //Send an error here?
if (item.containerType != Enum.ItemContainerType.INVENTORY)
return; //Send an error here?
//until this is shown to do something else, just use it as item identify spell.
item.setIsID(true);
//until this is shown to do something else, just use it as item identify spell.
item.setIsID(true);
if (!DbManager.ItemQueries.UPDATE_FLAGS(item))
item.setIsID(false); //update failed, reset
if (!DbManager.ItemQueries.UPDATE_FLAGS(item))
item.setIsID(false); //update failed, reset
//update inventory
CharacterItemManager cim = source.getCharItemManager();
if (cim != null)
cim.updateInventory();
}
//update inventory
CharacterItemManager cim = source.getCharItemManager();
if (cim != null)
cim.updateInventory();
}
@Override
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
}
@Override
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
// TODO Auto-generated method stub
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
// TODO Auto-generated method stub
}
}
}
@@ -21,31 +21,31 @@ import java.sql.SQLException;
public class SimpleDamagePowerAction extends AbstractPowerAction {
private int simpleDamage;
private int simpleDamage;
public SimpleDamagePowerAction(ResultSet rs) throws SQLException {
super(rs);
public SimpleDamagePowerAction(ResultSet rs) throws SQLException {
super(rs);
this.simpleDamage = rs.getInt("simpleDamage");
}
this.simpleDamage = rs.getInt("simpleDamage");
}
public int getSimpleDamage() {
return this.simpleDamage;
}
public int getSimpleDamage() {
return this.simpleDamage;
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
}
}
@Override
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
}
@Override
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
// TODO Auto-generated method stub
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
// TODO Auto-generated method stub
}
}
}
@@ -25,65 +25,64 @@ import java.sql.SQLException;
public class SpireDisablePowerAction extends AbstractPowerAction {
/**
* ResultSet Constructor
*/
public SpireDisablePowerAction(ResultSet rs) throws SQLException {
super(rs);
}
/**
* ResultSet Constructor
*/
public SpireDisablePowerAction(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
if (awo == null)
return;
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
if (awo == null)
return;
if (source == null)
return;
if (source == null)
return;
PlayerCharacter pc = null;
PlayerCharacter pc = null;
if (source.getObjectType() == GameObjectType.PlayerCharacter)
pc = (PlayerCharacter)source;
else
return;
if (source.getObjectType() == GameObjectType.PlayerCharacter)
pc = (PlayerCharacter) source;
else
return;
if (awo.getObjectType() != GameObjectType.Building)
return;
if (awo.getObjectType() != GameObjectType.Building)
return;
//Check if Building is Spire.
//Check if Building is Spire.
Building spire = (Building)awo;
Building spire = (Building) awo;
if ((spire.getBlueprintUUID() == 0) ||
(spire.getBlueprint() != null && spire.getBlueprint().getBuildingGroup() != BuildingGroup.SPIRE)) {
ChatManager.chatSystemError((PlayerCharacter)source, "This Building is not a spire.");
return;
}
if ((spire.getBlueprintUUID() == 0) ||
(spire.getBlueprint() != null && spire.getBlueprint().getBuildingGroup() != BuildingGroup.SPIRE)) {
ChatManager.chatSystemError((PlayerCharacter) source, "This Building is not a spire.");
return;
}
if (!spire.isSpireIsActive())
return;
if (!spire.isSpireIsActive())
return;
spire.disableSpire(false);
spire.disableSpire(false);
if (trains > 20)
trains = 20;
if (trains > 20)
trains = 20;
long duration = trains * 4500 + 30000;
spire.setTimeStamp("DISABLED", System.currentTimeMillis() + duration);
long duration = trains * 4500 + 30000;
spire.setTimeStamp("DISABLED", System.currentTimeMillis() + duration);
}
}
@Override
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
}
@Override
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
// TODO Auto-generated method stub
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
// TODO Auto-generated method stub
}
}
}
@@ -32,170 +32,170 @@ import static engine.math.FastMath.sqr;
public class StealPowerAction extends AbstractPowerAction {
/**
* ResultSet Constructor
*/
public StealPowerAction(ResultSet rs) throws SQLException {
super(rs);
}
/**
* ResultSet Constructor
*/
public StealPowerAction(ResultSet rs) throws SQLException {
super(rs);
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
protected static boolean stealSuccess(PlayerCharacter pc, AbstractWorldObject awo) {
if (pc == null || awo == null || !AbstractWorldObject.IsAbstractCharacter(awo) || pc.getPowers() == null)
return false;
if (source == null || awo == null || !(source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) || !(awo.getObjectType().equals(Enum.GameObjectType.Item)))
return;
int levelDif = pc.getLevel() - ((AbstractCharacter) awo).getLevel();
PlayerCharacter sourcePlayer = (PlayerCharacter) source;
if (!pc.getPowers().containsKey(429396028))
return false;
if (sourcePlayer.isSafeMode())
return;
CharacterPower cp = pc.getPowers().get(429396028);
int trains = cp.getTotalTrains();
if (!sourcePlayer.isAlive())
return;
float chance = 20 + (trains * 1.5f) + levelDif;
chance = (chance < 5f) ? 5f : chance;
chance = (chance > 85f) ? 85f : chance;
//prevent stealing no steal mob loot
if (awo instanceof MobLoot && ((MobLoot)awo).noSteal())
return;
float roll = ThreadLocalRandom.current().nextFloat() * 100f;
Item tar = (Item) awo;
AbstractWorldObject owner = (AbstractWorldObject) tar.getOwner();
return roll < chance;
if (owner == null)
return;
}
//called to get amount of gold to steal between 0 and max gold
protected static int getAmountToSteal(Item i) {
if (i.getItemBase() != null && i.getItemBase().getUUID() == 7) {
int amount = i.getNumOfItems();
if (amount < 1)
return -1;
int a = ThreadLocalRandom.current().nextInt(amount + 1);
int b = ThreadLocalRandom.current().nextInt(amount + 1);
int c = ThreadLocalRandom.current().nextInt(amount + 1);
return (a + b + c) / 3;
} else
return 0;
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
if (source == null || awo == null || !(source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) || !(awo.getObjectType().equals(Enum.GameObjectType.Item)))
return;
PlayerCharacter sourcePlayer = (PlayerCharacter) source;
if (sourcePlayer.isSafeMode())
return;
if (!sourcePlayer.isAlive())
return;
//prevent stealing no steal mob loot
if (awo instanceof MobLoot && ((MobLoot) awo).noSteal())
return;
Item tar = (Item) awo;
AbstractWorldObject owner = (AbstractWorldObject) tar.getOwner();
if (owner == null)
return;
AbstractCharacter ownerAC = null;
if (AbstractWorldObject.IsAbstractCharacter(owner))
ownerAC = (AbstractCharacter) owner;
AbstractCharacter ownerAC = null;
if (AbstractWorldObject.IsAbstractCharacter(owner))
ownerAC = (AbstractCharacter) owner;
if (ownerAC != null)
if (ownerAC.getLoc().distanceSquared(sourcePlayer.getLoc()) > sqr(MBServerStatics.LOOT_RANGE))
return;
if (ownerAC != null)
if (ownerAC.getLoc().distanceSquared(sourcePlayer.getLoc()) > sqr(MBServerStatics.LOOT_RANGE))
return;
//only steal from players or mobs
//only steal from players or mobs
if (owner.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
if (owner.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
PlayerCharacter ownerPC = (PlayerCharacter)owner;
PlayerCharacter ownerPC = (PlayerCharacter) owner;
if (ownerPC.isSafeMode() || sourcePlayer.inSafeZone() || ownerPC.inSafeZone())
return;
if (ownerPC.isSafeMode() || sourcePlayer.inSafeZone() || ownerPC.inSafeZone())
return;
if (ownerPC.getLoc().distanceSquared(sourcePlayer.getLoc()) > sqr(MBServerStatics.LOOT_RANGE))
return;
if (ownerPC.getLoc().distanceSquared(sourcePlayer.getLoc()) > sqr(MBServerStatics.LOOT_RANGE))
return;
//dupe check, validate player has item
if (!tar.validForInventory(ownerPC.getClientConnection(), ownerPC, ownerPC.getCharItemManager()))//pc.getCharItemManager()))
return;
//dupe check, validate player has item
if (!tar.validForInventory(ownerPC.getClientConnection(), ownerPC, ownerPC.getCharItemManager()))//pc.getCharItemManager()))
return;
//mark thief and target as player aggressive
sourcePlayer.setLastPlayerAttackTime();
ownerPC.setLastPlayerAttackTime();
//mark thief and target as player aggressive
sourcePlayer.setLastPlayerAttackTime();
ownerPC.setLastPlayerAttackTime();
//Handle target attacking back if in combat and has no other target
CombatManager.handleRetaliate(ownerAC, sourcePlayer);
//Handle target attacking back if in combat and has no other target
CombatManager.handleRetaliate(ownerAC, sourcePlayer);
} else if (owner.getObjectType().equals(Enum.GameObjectType.Mob)) {
sourcePlayer.setLastMobAttackTime(); //mark thief as mob aggressive
} else
return;
} else if (owner.getObjectType().equals(Enum.GameObjectType.Mob)) {
sourcePlayer.setLastMobAttackTime(); //mark thief as mob aggressive
} else
return;
ClientConnection origin = sourcePlayer.getClientConnection();
ClientConnection origin = sourcePlayer.getClientConnection();
if (origin == null)
return;
if (origin == null)
return;
int amount = getAmountToSteal(tar);
int amount = getAmountToSteal(tar);
//test probability of steal success
if (!stealSuccess(sourcePlayer, owner)) {
ChatManager.chatPeekSteal(sourcePlayer, ownerAC, tar, false, false, -1);
return;
} else {
ChatManager.chatPeekSteal(sourcePlayer, ownerAC, tar, true, false, amount);
//TODO send steal failure success
}
//test probability of steal success
if (!stealSuccess(sourcePlayer, owner)) {
ChatManager.chatPeekSteal(sourcePlayer, ownerAC, tar, false, false, -1);
return;
} else {
ChatManager.chatPeekSteal(sourcePlayer, ownerAC, tar, true, false, amount);
//TODO send steal failure success
}
//attempt transfer item
CharacterItemManager myCIM = sourcePlayer.getCharItemManager();
CharacterItemManager ownerCIM = ((AbstractCharacter)owner).getCharItemManager();
if (myCIM == null || ownerCIM == null)
return;
//attempt transfer item
CharacterItemManager myCIM = sourcePlayer.getCharItemManager();
CharacterItemManager ownerCIM = ((AbstractCharacter) owner).getCharItemManager();
if (myCIM == null || ownerCIM == null)
return;
if (tar.getItemBase().getType().equals(ItemType.GOLD)) {
//stealing gold
if (!myCIM.transferGoldToMyInventory((AbstractCharacter)owner, amount))
return;
} else {
//stealing items
if (ownerCIM.lootItemFromMe(tar, sourcePlayer, origin, true, amount) == null)
return;
}
if (tar.getItemBase().getType().equals(ItemType.GOLD)) {
//stealing gold
if (!myCIM.transferGoldToMyInventory((AbstractCharacter) owner, amount))
return;
} else {
//stealing items
if (ownerCIM.lootItemFromMe(tar, sourcePlayer, origin, true, amount) == null)
return;
}
//send loot message to person stealing.
LootMsg lm = new LootMsg(source.getObjectType().ordinal(), source.getObjectUUID(), owner.getObjectType().ordinal(), owner.getObjectUUID(), tar);
Dispatch dispatch = Dispatch.borrow(sourcePlayer, lm);
DispatchMessage.dispatchMsgDispatch(dispatch, engine.Enum.DispatchChannel.SECONDARY);
//send loot message to person stealing.
LootMsg lm = new LootMsg(source.getObjectType().ordinal(), source.getObjectUUID(), owner.getObjectType().ordinal(), owner.getObjectUUID(), tar);
Dispatch dispatch = Dispatch.borrow(sourcePlayer, lm);
DispatchMessage.dispatchMsgDispatch(dispatch, engine.Enum.DispatchChannel.SECONDARY);
//update thief's inventory
if (sourcePlayer.getCharItemManager() != null)
sourcePlayer.getCharItemManager().updateInventory();
//update thief's inventory
if (sourcePlayer.getCharItemManager() != null)
sourcePlayer.getCharItemManager().updateInventory();
//update victims inventory
if (owner.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
PlayerCharacter ownerPC = (PlayerCharacter) owner;
//update victims inventory
if (owner.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
PlayerCharacter ownerPC = (PlayerCharacter) owner;
if (ownerPC.getCharItemManager() != null)
ownerPC.getCharItemManager().updateInventory();
}
if (ownerPC.getCharItemManager() != null)
ownerPC.getCharItemManager().updateInventory();
}
//TODO if victim is trading, cancel trade window for both people involved in trade
}
//TODO if victim is trading, cancel trade window for both people involved in trade
}
@Override
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
}
@Override
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
}
protected static boolean stealSuccess(PlayerCharacter pc, AbstractWorldObject awo) {
if (pc == null || awo == null || !AbstractWorldObject.IsAbstractCharacter(awo) || pc.getPowers() == null)
return false;
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
// TODO Auto-generated method stub
int levelDif = pc.getLevel() - ((AbstractCharacter)awo).getLevel();
if (!pc.getPowers().containsKey(429396028))
return false;
CharacterPower cp = pc.getPowers().get(429396028);
int trains = cp.getTotalTrains();
float chance = 20 + (trains * 1.5f) + levelDif;
chance = (chance < 5f) ? 5f : chance;
chance = (chance > 85f) ? 85f : chance;
float roll = ThreadLocalRandom.current().nextFloat() * 100f;
return roll < chance;
}
//called to get amount of gold to steal between 0 and max gold
protected static int getAmountToSteal(Item i) {
if (i.getItemBase() != null && i.getItemBase().getUUID() == 7) {
int amount = i.getNumOfItems();
if (amount < 1)
return -1;
int a = ThreadLocalRandom.current().nextInt(amount + 1);
int b = ThreadLocalRandom.current().nextInt(amount + 1);
int c = ThreadLocalRandom.current().nextInt(amount + 1);
return (a + b + c) / 3;
} else
return 0;
}
@Override
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
// TODO Auto-generated method stub
}
}
}

Some files were not shown because too many files have changed in this diff Show More