コード例 #1
0
        static void Postfix(UnitPartTouch __instance)
        {
            var charges_part = __instance.Owner.Get <UnitPartTouchMultipleCharges>();

            if (charges_part == null)
            {
                return;
            }
            __instance.Owner.Remove <UnitPartTouchMultipleCharges>();
        }
コード例 #2
0
        static void Postfix(UnitPartTouch __instance, BlueprintAbility ability, AbilityData source, AbilityExecutionContext context)
        {
            var multiple_charges = source.Blueprint.GetComponent <AbilityEffectStickyTouchMultiple>();

            if (multiple_charges != null)
            {
                int charges = multiple_charges.num_charges.Calculate(context);
                __instance.Owner.Ensure <UnitPartTouchMultipleCharges>().init(charges);
            }
        }
コード例 #3
0
 public static bool IsFreeTouch(this UnitCommand command)
 {
     if (command is UnitUseAbility unitUseAbility)
     {
         UnitPartTouch unitPartTouch = command.Executor.Get <UnitPartTouch>();
         if ((unitPartTouch?.IsCastedInThisRound ?? false) && unitUseAbility.Spell == unitPartTouch.Ability.Data)
         {
             return(true);
         }
     }
     return(false);
 }
コード例 #4
0
        static bool Prefix(TouchSpellsController __instance, AbilityExecutionContext context)
        {
            UnitEntityData maybeCaster = context.MaybeCaster;

            if (maybeCaster == null)
            {
                return(false);
            }
            UnitPartTouch unitPartTouch = maybeCaster.Get <UnitPartTouch>();

            if (!(bool)(unitPartTouch) || (unitPartTouch.Ability.Data != context.Ability))
            {
                return(false);
            }

            var charges_part = maybeCaster.Get <UnitPartTouchMultipleCharges>();

            if (charges_part != null && charges_part.hasCharges())
            {
                charges_part.consume();
                if (!charges_part.hasCharges())
                {
                    maybeCaster.Remove <UnitPartTouch>();
                }
            }
            else
            {
                maybeCaster.Remove <UnitPartTouch>();
            }
            if (maybeCaster.IsAutoUseAbility(context.Ability))
            {
                return(false);
            }
            maybeCaster.CombatState.ManualTarget = null;
            return(false);
        }
コード例 #5
0
 public static void SetAppearTime(this UnitPartTouch unitPartTouch, TimeSpan value)
 {
     unitPartTouch.SetPropertyValue(nameof(UnitPartTouch.AppearTime), value);
 }