Search in sources :

Example 1 with Costs

use of main.elements.costs.Costs in project Eidolons by IDemiurge.

the class DualAttackMaster method checkCostsCanMerge.

private static boolean checkCostsCanMerge(DC_UnitAction main, DC_UnitAction offhand) {
    Costs costsMain = main.getCosts();
    costsMain = DC_CostsFactory.getCostsForAction(main);
    Costs costsOffhand = offhand.getCosts();
    costsOffhand = DC_CostsFactory.getCostsForAction(offhand);
    for (Cost cost : costsMain.getCosts()) {
        PARAMETER p = cost.getPayment().getParamToPay();
        Cost cost2 = costsOffhand.getCost(p);
        Integer value1 = cost.getPayment().getAmountFormula().getInt();
        Integer value2 = (cost2 == null) ? 0 : cost2.getPayment().getAmountFormula().getInt();
        Boolean mode = getMinMaxOrAverage((PARAMS) p);
        if (!checkCost(value1, value2, mode))
            return false;
    }
    return true;
}
Also used : Costs(main.elements.costs.Costs) Cost(main.elements.costs.Cost) PARAMETER(main.content.values.parameters.PARAMETER)

Example 2 with Costs

use of main.elements.costs.Costs in project Eidolons by IDemiurge.

the class DualAttackMaster method getDualCosts.

private static Costs getDualCosts(DC_UnitAction main, DC_UnitAction offhand) {
    List<Cost> list = new ArrayList<>();
    Costs costsMain = main.getCosts();
    // if (costsMain == null)
    costsMain = DC_CostsFactory.getCostsForAction(main);
    Costs costsOffhand = offhand.getCosts();
    // if (costsOffhand == null)
    costsOffhand = DC_CostsFactory.getCostsForAction(offhand);
    for (Cost cost : costsMain.getCosts()) {
        PARAMETER p = cost.getPayment().getParamToPay();
        Cost cost2 = costsOffhand.getCost(p);
        Integer value1 = cost.getPayment().getAmountFormula().getInt();
        Integer value2 = (cost2 == null) ? 0 : cost2.getPayment().getAmountFormula().getInt();
        Boolean mode = getMinMaxOrAverage((PARAMS) p);
        Integer value = MathMaster.getTotalOrMinMax(mode, value1, value2);
        list.add(new CostImpl(new Payment(p, value), cost.getCostParam()));
    }
    Costs costsDual = new Costs(list);
    Integer focReq = 25;
    list.add(new CostImpl(new Payment(PARAMS.FOC_REQ, focReq)));
    return costsDual;
}
Also used : Costs(main.elements.costs.Costs) Payment(main.elements.costs.Payment) ArrayList(java.util.ArrayList) CostImpl(main.elements.costs.CostImpl) Cost(main.elements.costs.Cost) PARAMETER(main.content.values.parameters.PARAMETER)

Example 3 with Costs

use of main.elements.costs.Costs in project Eidolons by IDemiurge.

the class ActionAnimation method drawCosts.

protected boolean drawCosts(AnimPhase phase) {
    int base = getDefaultIconMapOffsetY();
    boolean invert = false;
    Boolean edge;
    boolean positive;
    if (getTarget() == source || phase.isDrawOnSource()) {
        edge = game.getBattleField().getGrid().isOnEdgeY(source.getCoordinates());
        // TODO
        positive = BooleanMaster.isTrue(edge) || edge == null;
        base = getOffsetBase(positive);
        if (base < 0) {
            invert = true;
        }
    }
    if (getTarget().getCoordinates().isAdjacent(source.getCoordinates())) {
        if (PositionMaster.inLine(source, target)) {
            if (PositionMaster.isAbove(target, source)) {
                invert = true;
            }
            if (PositionMaster.isAbove(source, target)) {
                invert = false;
            }
        }
    }
    Costs costs = (Costs) phase.getArgs()[0];
    Map<Image, String> map = new XLinkedMap<>();
    for (Cost s : costs.getCosts()) {
        if (s.isPaidAlt()) {
            s = s.getAltCost();
        }
        Formula formula = s.getPayment().getAmountFormula();
        PARAMETER param = s.getPayment().getParamToPay();
        Image image = ImageManager.getValueIcon(param);
        if (image == null) {
            continue;
        }
        String string = "" + (-s.getPayment().getLastPaid());
        map.put(image, string);
        List<String> list = new ArrayList<>();
        list.add(string);
        getSubPhaseTooltipMap().put(image, list);
    }
    drawIconMap(map, false, true, base, invert);
    return true;
}
Also used : Costs(main.elements.costs.Costs) XLinkedMap(main.data.XLinkedMap) Cost(main.elements.costs.Cost) Formula(main.system.math.Formula) PARAMETER(main.content.values.parameters.PARAMETER)

Example 4 with Costs

use of main.elements.costs.Costs in project Eidolons by IDemiurge.

the class SpellInitializer method initChannelingCosts.

public void initChannelingCosts() {
    Costs channelingResolveCosts = ChannelingRule.getChannelingResolveCosts(getEntity());
    Costs channelingActivateCosts = ChannelingRule.getChannelingActivateCosts(getEntity());
    getEntity().setChannelingActivateCosts(channelingActivateCosts);
    getEntity().setChannelingResolveCosts(channelingResolveCosts);
}
Also used : Costs(main.elements.costs.Costs)

Example 5 with Costs

use of main.elements.costs.Costs in project Eidolons by IDemiurge.

the class ChannelingRule method getChannelingCosts.

public static Costs getChannelingCosts(DC_SpellObj action, boolean activateOrResolve) {
    List<Cost> list = new ArrayList<>();
    for (PARAMS costParam : activateOrResolve ? costParamsActivate : costParamsResolve) {
        PARAMS payParam = DC_ContentManager.getPayParameterForCost(costParam);
        Cost cost = DC_CostsFactory.getCost(action, costParam, payParam);
        // int mod = 100;
        // cost.getPayment().getAmountFormula().applyModifier(mod);
        list.add(cost);
    }
    // Costs costs = getEntity().getCosts();
    // Costs channelingResolveCosts = new Costs(costs.getRequirements(), costs.getCosts());
    // Costs channelingActivateCosts = new Costs(costs.getRequirements(), costs
    // .getCost(PARAMS.C_N_OF_ACTIONS));
    // channelingResolveCosts.removeCost(PARAMS.C_N_OF_ACTIONS);
    CostRequirements reqs = action.getCosts().getRequirements();
    Costs costs = new Costs(reqs, list);
    if (!activateOrResolve)
        costs.removeRequirement(InfoMaster.COOLDOWN_REASON);
    return costs;
}
Also used : Costs(main.elements.costs.Costs) CostRequirements(main.elements.costs.CostRequirements) ArrayList(java.util.ArrayList) PARAMS(eidolons.content.PARAMS) Cost(main.elements.costs.Cost)

Aggregations

Costs (main.elements.costs.Costs)10 Cost (main.elements.costs.Cost)6 PARAMETER (main.content.values.parameters.PARAMETER)4 ArrayList (java.util.ArrayList)3 CostImpl (main.elements.costs.CostImpl)2 Payment (main.elements.costs.Payment)2 Formula (main.system.math.Formula)2 StatusCheckCondition (eidolons.ability.conditions.StatusCheckCondition)1 ModifyValueEffect (eidolons.ability.effects.common.ModifyValueEffect)1 ActivateEffect (eidolons.ability.effects.oneshot.activation.ActivateEffect)1 PARAMS (eidolons.content.PARAMS)1 DC_UnitAction (eidolons.entity.active.DC_UnitAction)1 Abilities (main.ability.Abilities)1 Ability (main.ability.Ability)1 ActiveAbility (main.ability.ActiveAbility)1 Effects (main.ability.effects.Effects)1 XLinkedMap (main.data.XLinkedMap)1 NotCondition (main.elements.conditions.NotCondition)1 PropCondition (main.elements.conditions.PropCondition)1 Requirement (main.elements.conditions.Requirement)1