Search in sources :

Example 1 with Requirement

use of main.elements.conditions.Requirement in project Eidolons by IDemiurge.

the class DC_CostsFactory method getCostsForSpell.

public static Costs getCostsForSpell(DC_ActiveObj spell, boolean isSpell) {
    List<Cost> costs = new ArrayList<>();
    Cost cost = null;
    if (!DC_Engine.isAtbMode()) {
        cost = getCost(spell, PARAMS.AP_COST, PARAMS.C_N_OF_ACTIONS);
        if (cost != null) {
            costs.add(cost);
        }
    }
    cost = getCost(spell, PARAMS.ENERGY_COST, PARAMS.C_ENERGY);
    if (cost != null) {
        costs.add(cost);
    }
    // cost = getCost(spell, PARAMS.ATP_COST, PARAMS.C_N_OF_ATTACKS);
    // if (cost != null)
    // costs.add(cost);
    cost = getCost(spell, PARAMS.CP_COST, PARAMS.C_N_OF_COUNTERS);
    if (cost != null) {
        costs.add(cost);
    }
    // cost = getCost(spell, PARAMS.MP_COST, PARAMS.C_N_OF_MOVES);
    // if (cost != null)
    // costs.add(cost);
    cost = getCost(spell, PARAMS.ESS_COST, PARAMS.C_ESSENCE);
    if (cost != null) {
        costs.add(cost);
    }
    cost = getCost(spell, PARAMS.STA_COST, PARAMS.C_STAMINA);
    if (cost != null) {
        costs.add(cost);
    }
    cost = getCost(spell, PARAMS.FOC_COST, PARAMS.C_FOCUS);
    if (cost != null) {
        costs.add(cost);
    }
    cost = getCost(spell, PARAMS.ENDURANCE_COST, PARAMS.C_ENDURANCE);
    if (cost != null) {
        costs.add(cost);
    }
    // if (spell.getIntParam(PARAMS.FOC_REQ) == 0)
    // return new Costs(costs);
    String s = "" + Math.max(spell.getIntParam(PARAMS.FOC_REQ), spell.getIntParam(PARAMS.FOC_COST));
    CostRequirements requirements = new CostRequirements(new Payment(PARAMS.C_FOCUS, new Formula(s)));
    if (!DC_Engine.isAtbMode())
        requirements.add(new Requirement(new NumericCondition("1", StringMaster.getValueRef(KEYS.ACTIVE, PARAMS.C_COOLDOWN)), InfoMaster.COOLDOWN_REASON));
    addSpecialRequirements(requirements, spell);
    return (isSpell) ? new DC_SpellCosts(requirements, costs) : new DC_ActionCosts(requirements, costs);
}
Also used : Formula(main.system.math.Formula) Requirement(main.elements.conditions.Requirement) ArrayList(java.util.ArrayList) NumericCondition(main.elements.conditions.NumericCondition)

Example 2 with Requirement

use of main.elements.conditions.Requirement in project Eidolons by IDemiurge.

the class SpellInitializer method initCosts.

@Override
public void initCosts() {
    Costs costs;
    costs = DC_CostsFactory.getCostsForSpell(getEntity(), // isSpell()
    true);
    costs.getRequirements().add(new Requirement(new NotCondition(new StatusCheckCondition(UnitEnums.STATUS.SILENCED)), InfoMaster.SILENCE));
    costs.setActive(getEntity());
    getEntity().getActivator().setCanActivate(costs.canBePaid(getRef()));
    getEntity().setCosts(costs);
}
Also used : Requirement(main.elements.conditions.Requirement) Costs(main.elements.costs.Costs) NotCondition(main.elements.conditions.NotCondition) StatusCheckCondition(eidolons.ability.conditions.StatusCheckCondition)

Aggregations

Requirement (main.elements.conditions.Requirement)2 StatusCheckCondition (eidolons.ability.conditions.StatusCheckCondition)1 ArrayList (java.util.ArrayList)1 NotCondition (main.elements.conditions.NotCondition)1 NumericCondition (main.elements.conditions.NumericCondition)1 Costs (main.elements.costs.Costs)1 Formula (main.system.math.Formula)1