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;
}
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;
}
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;
}
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);
}
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;
}
Aggregations