Search in sources :

Example 16 with Formula

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;
}
Also used : Formula(main.system.math.Formula) ModifyValueEffect(eidolons.ability.effects.common.ModifyValueEffect) Effects(main.ability.effects.Effects)

Example 17 with Formula

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);
}
Also used : Formula(main.system.math.Formula) Ref(main.entity.Ref) DealDamageEffect(eidolons.ability.effects.oneshot.DealDamageEffect)

Example 18 with Formula

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;
}
Also used : Formula(main.system.math.Formula) Ref(main.entity.Ref)

Example 19 with Formula

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;
}
Also used : ClassificationCondition(main.elements.conditions.standard.ClassificationCondition) DynamicCondition(main.elements.conditions.standard.DynamicCondition) OwnershipCondition(main.elements.conditions.standard.OwnershipCondition) Formula(main.system.math.Formula)

Example 20 with Formula

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;
}
Also used : ClassificationCondition(main.elements.conditions.standard.ClassificationCondition) DynamicCondition(main.elements.conditions.standard.DynamicCondition) OwnershipCondition(main.elements.conditions.standard.OwnershipCondition) Formula(main.system.math.Formula)

Aggregations

Formula (main.system.math.Formula)53 PARAMETER (main.content.values.parameters.PARAMETER)12 Ref (main.entity.Ref)11 AddBuffEffect (eidolons.ability.effects.attachment.AddBuffEffect)8 ModifyValueEffect (eidolons.ability.effects.common.ModifyValueEffect)8 Effects (main.ability.effects.Effects)7 SkillPointCondition (eidolons.ability.conditions.req.SkillPointCondition)5 DealDamageEffect (eidolons.ability.effects.oneshot.DealDamageEffect)5 ArrayList (java.util.ArrayList)5 Effect (main.ability.effects.Effect)5 ClassTreeCondition (eidolons.ability.conditions.req.ClassTreeCondition)4 MultiClassCondition (eidolons.ability.conditions.req.MultiClassCondition)4 ValueGroupCondition (eidolons.ability.conditions.req.ValueGroupCondition)4 Unit (eidolons.entity.obj.unit.Unit)4 ObjType (main.entity.type.ObjType)4 ModifyPropertyEffect (eidolons.ability.effects.common.ModifyPropertyEffect)3 RemoveBuffEffect (eidolons.ability.effects.oneshot.buff.RemoveBuffEffect)3 RollEffect (eidolons.ability.effects.oneshot.mechanic.RollEffect)3 SummonEffect (eidolons.ability.effects.oneshot.unit.SummonEffect)3 DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)3