public static CastValidity ComputeCompanionCostCastValidity(PlayerStatus owner, ReserveCompanionStatus companionStatus) { DynamicValueFightContext castTargetContext = companionStatus.CreateValueContext(); if (companionStatus.state == CompanionReserveState.Idle && companionStatus.isGiven) { return(CastValidity.SUCCESS); } IReadOnlyList <Cost> cost = companionStatus.definition.cost; int i = 0; for (int count = cost.Count; i < count; i++) { CastValidity castValidity = cost[i].CheckValidity(owner, castTargetContext); if (castValidity != 0) { return(castValidity); } } return(CastValidity.SUCCESS); }
private static void PreviewCosts(IReadOnlyList <Cost> costs, DynamicValueFightContext context) { LocalPlayerUIRework localPlayerUI = FightUIRework.instance.GetLocalPlayerUI(s_playerCasting); for (int i = 0; i < costs.Count; i++) { Cost cost = costs[i]; if (cost == null) { continue; } ActionPointsCost actionPointsCost; int value3; if ((actionPointsCost = (cost as ActionPointsCost)) == null) { if (!(cost is DrainActionPointsCost)) { ElementPointsCost elementPointsCost; if ((elementPointsCost = (cost as ElementPointsCost)) == null) { DrainElementsPoints drainElementsPoints; if ((drainElementsPoints = (cost as DrainElementsPoints)) == null) { ReservePointsCost reservePointsCost; int value; if ((reservePointsCost = (cost as ReservePointsCost)) == null) { if (cost is DrainReservePointsCost) { localPlayerUI.PreviewReservePoints(0, ValueModifier.Set); } } else if (reservePointsCost.value.GetValue(context, out value)) { localPlayerUI.PreviewReservePoints(value, ValueModifier.Add); } } else { DrainElementsPoints drainElementsPoints2 = drainElementsPoints; int count = drainElementsPoints2.elements.Count; for (int j = 0; j < count; j++) { PreviewElementaryPoints(localPlayerUI, drainElementsPoints2.elements[j], 0, ValueModifier.Set); } } } else { ElementPointsCost elementPointsCost2 = elementPointsCost; if (elementPointsCost2.value.GetValue(context, out int value2)) { PreviewElementaryPoints(localPlayerUI, elementPointsCost2.element, value2, ValueModifier.Add); } } } else { localPlayerUI.PreviewActionPoints(0, ValueModifier.Set); } } else if (actionPointsCost.value.GetValue(context, out value3)) { localPlayerUI.PreviewActionPoints(value3, ValueModifier.Add); } } }