| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- using System.Collections;
- using System;
- public partial class CardEffectFactory
- {
- #region Trigger effect of [Vortex] on oneself
- public static ActivateClass VortexSelfEffect(bool isInheritedEffect, CardSource card, Func<bool> condition,
- ICardEffect rootCardEffect = null)
- {
- Permanent targetPermanent = card.PermanentOfThisCard();
- bool CanUseCondition()
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
- (condition == null || condition());
- }
- return VortexEffect(targetPermanent: targetPermanent, isInheritedEffect: isInheritedEffect, condition: CanUseCondition,
- rootCardEffect: rootCardEffect, card);
- }
- #endregion
- #region Trigger effect of [Vortex]
- public static ActivateClass VortexEffect(Permanent targetPermanent, bool isInheritedEffect, Func<bool> condition,
- ICardEffect rootCardEffect, CardSource card)
- {
- if (targetPermanent == null) return null;
- if (targetPermanent.TopCard == null) return null;
- if (card == null) return null;
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Vortex", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, DataBase.VortexEffectDiscription());
- activateClass.SetIsInheritedEffect(isInheritedEffect);
- if (rootCardEffect != null)
- {
- activateClass.SetIsInheritedEffect(false);
- activateClass.SetEffectSourcePermanent(targetPermanent);
- activateClass.SetRootCardEffect(rootCardEffect);
- }
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleArea(card) &&
- CardEffectCommons.IsOwnerTurn(card);
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.CanActivateVortex(targetPermanent.TopCard, activateClass) &&
- (condition == null || condition());
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- return CardEffectCommons.VortexProcess(targetPermanent.TopCard, activateClass);
- }
- return activateClass;
- }
- #endregion
- }
|