use of main.system.math.Formula in project Eidolons by IDemiurge.
the class WaterRule method initSubmergedEffects.
private Effects initSubmergedEffects(float factor) {
Effects effects = new Effects();
Formula formula = new Formula("x*50");
effects.add(new ModifyValueEffect(PARAMS.STEALTH, MOD.MODIFY_BY_PERCENT, formula.substituteVarValue("x", factor + "").toString()));
effects.add(new ModifyValueEffect(PARAMS.NOISE, MOD.MODIFY_BY_PERCENT, formula.substituteVarValue("x", factor + "").toString()));
formula = new Formula("-x*50");
effects.add(new ModifyValueEffect(PARAMS.DEFENSE, MOD.MODIFY_BY_PERCENT, formula.substituteVarValue("x", factor + "").toString()));
effects.add(new ModifyValueEffect(PARAMS.FIRE_RESISTANCE, MOD.MODIFY_BY_CONST, formula.substituteVarValue("x", factor + "").toString()));
return effects;
}
use of main.system.math.Formula in project Eidolons by IDemiurge.
the class ForceRule method applyDamage.
public static void applyDamage(int force, DC_ActiveObj attack, BattleFieldObject source, BattleFieldObject target) {
int damage = getDamage(force, target, target, target);
// attack.modifyParameter(PARAMS.BASE_DAMAGE, damage);
// if (target.getShield()!=null )
Ref ref = attack.getRef().getCopy();
ref.setTarget(target.getId());
new DealDamageEffect(new Formula(damage + ""), GenericEnums.DAMAGE_TYPE.BLUDGEONING).apply(ref);
}
use of main.system.math.Formula in project Eidolons by IDemiurge.
the class StringMaster method getInteger.
public static Integer getInteger(String value, Ref ref) {
if (value == null)
return 0;
if (!isInteger(value)) {
return new Formula(value).getInt(ref == null ? new Ref() : ref);
}
if (value.contains(".")) {
value = value.split(Pattern.quote("."))[0];
}
if (isFAST_INTEGER_MODE()) {
int result = 0;
boolean negative = false;
for (int i = 0; i < value.length(); i++) {
char c = value.toCharArray()[i];
if (c == ('.')) {
break;
}
if (c == ('-')) {
negative = true;
} else {
result += getInteger(c) * Math.pow(10, value.length() - i - 1);
}
}
if (negative) {
// for length
result = -result;
}
return result;
} else {
String result = "";
for (char c : value.toCharArray()) {
if (c == ('.')) {
break;
}
if (c == ('-') || Character.isDigit(c)) {
result += c;
}
}
if (!result.isEmpty()) {
return Integer.valueOf(result);
}
}
return 0;
}
use of main.system.math.Formula in project Eidolons by IDemiurge.
the class ConditionMaster method getXLineCondition.
public static Condition getXLineCondition(Obj obj1, Obj obj2, boolean bidirectional) {
Conditions conditions = new Conditions();
if (!bidirectional) {
Condition sideCondition = (PositionMaster.isToTheLeft(obj1, obj2)) ? new NumericCondition(new Formula("{MATCH_POS_X}"), new Formula("{SOURCE_POS_X}"), false) : new NumericCondition(new Formula("{SOURCE_POS_X}"), new Formula("{MATCH_POS_X}"), false);
conditions.add(sideCondition);
}
Condition lineCondition = new NumericCondition(new Formula("{SOURCE_POS_Y}"), new Formula("{MATCH_POS_Y}"), true);
conditions.add(lineCondition);
return conditions;
}
use of main.system.math.Formula in project Eidolons by IDemiurge.
the class ConditionMaster method getDiagonalLineCondition.
public static Condition getDiagonalLineCondition(Obj sourceObj, Obj targetObj, boolean bidirectional) {
Conditions conditions = new Conditions();
if (!bidirectional) {
Condition sideCondition = (PositionMaster.isToTheLeft(targetObj, sourceObj)) ? new NumericCondition(new Formula("{SOURCE_POS_X}"), new Formula("{MATCH_POS_X}"), false) : new NumericCondition(new Formula("{MATCH_POS_X}"), new Formula("{SOURCE_POS_X}"), false);
conditions.add(sideCondition);
Condition sideCondition2 = (!PositionMaster.isAbove(targetObj, sourceObj)) ? new NumericCondition(new Formula("{MATCH_POS_Y}"), new Formula("{SOURCE_POS_Y}"), false) : new NumericCondition(new Formula("{SOURCE_POS_Y}"), new Formula("{MATCH_POS_Y}"), false);
conditions.add(sideCondition2);
}
Condition diagonalCondition = new NumericCondition(new Formula("[ABS({MATCH_POS_X} - {SOURCE_POS_X})]"), new Formula("[ABS({MATCH_POS_Y} - {SOURCE_POS_Y})]"), true);
conditions.add(diagonalCondition);
return conditions;
}
Aggregations