Ejemplo n.º 1
0
 public static void RecomputeSpellCost(SpellStatus spellStatus, ref SpellStatusData data)
 {
     if (spellStatus.ownerPlayer != null)
     {
         int?baseCost = spellStatus.baseCost;
         if (!baseCost.HasValue)
         {
             data.apCost   = null;
             data.baseCost = null;
             return;
         }
         SpellDefinition   definition = spellStatus.definition;
         CastTargetContext context    = spellStatus.CreateCastTargetContext();
         int cost = spellStatus.definition.GetCost(context) ?? 0;
         data.apCost   = SpellCostModification.ApplyCostModification(spellStatus.ownerPlayer.spellCostModifiers, cost, definition, context);
         data.baseCost = baseCost.Value;
     }
 }
Ejemplo n.º 2
0
        public static CastValidity ComputeSpellCostCastValidity(PlayerStatus owner, SpellStatus spellStatus)
        {
            if (owner.HasProperty(PropertyId.PlaySpellForbidden))
            {
                return(CastValidity.NOT_ALLOW_TO_PLAY_SPELLS);
            }
            CastTargetContext    castTargetContext = spellStatus.CreateCastTargetContext();
            IReadOnlyList <Cost> costs             = spellStatus.definition.costs;

            for (int i = 0; i < costs.Count; i++)
            {
                CastValidity castValidity = costs[i].CheckValidity(owner, castTargetContext);
                if (castValidity != 0)
                {
                    return(castValidity);
                }
            }
            return(CastValidity.SUCCESS);
        }
Ejemplo n.º 3
0
        private static void ShowSpellCostsPreview()
        {
            CastTargetContext context = s_spellBeingCast.CreateCastTargetContext();

            PreviewCosts(s_spellBeingCast.definition.costs, context);
        }