use of main.elements.costs.Cost 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;
}
use of main.elements.costs.Cost 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;
}
use of main.elements.costs.Cost 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;
}
use of main.elements.costs.Cost 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;
}
use of main.elements.costs.Cost in project Eidolons by IDemiurge.
the class DualAttackMaster method createDual.
private static DC_UnitAction createDual(DC_UnitAction main, DC_UnitAction offhand) {
Costs costs = getDualCosts(main, offhand);
// cooldown!
ActiveAbility activateAttacks = new ActiveAbility(main.getTargeting(), new Effects(new ActivateEffect(main.getName(), true), new ActivateEffect(offhand.getName(), true)));
Ability setCooldown = new ActiveAbility(new AutoTargeting(new PropCondition(G_PROPS.ACTION_TAGS, "Dual", false)), new ModifyValueEffect(PARAMS.C_COOLDOWN, MOD.SET, getCooldown(main.getOwnerObj())));
Abilities abilities = new Abilities();
abilities.add(activateAttacks);
abilities.add(setCooldown);
ObjType newType = new ObjType("Dual: " + main.getName() + " and " + offhand.getName(), DataManager.getType("Dual Attack", DC_TYPE.ACTIONS));
for (Cost cost : costs.getCosts()) {
PARAMETER p = cost.getCostParam();
if (p == null)
continue;
newType.setParam(p, cost.getPayment().getAmountFormula().toString());
}
DC_UnitAction dual = new DC_UnitAction(newType, main.getOwner(), main.getGame(), new Ref(main.getOwnerObj()));
dual.setAbilities(abilities);
dual.setCosts(costs);
dual.setTargeting(main.getTargeting());
dual.getTargeter().setTargetingInitialized(true);
dual.setConstructed(true);
return dual;
}
Aggregations