ST18_03.cs 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.ST18
  4. {
  5. public class ST18_03 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region When Attacking
  11. if (timing == EffectTiming.OnAllyAttack)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Suspend 1 opponent's Digimon", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  16. cardEffects.Add(activateClass);
  17. string EffectDescription()
  18. {
  19. return
  20. "[When Attacking] Suspend 1 of your opponent's Digimon.";
  21. }
  22. bool CanUseCondition(Hashtable hashtable)
  23. {
  24. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  25. }
  26. bool CanSelectPermanentCondition(Permanent permanent)
  27. {
  28. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) &&
  29. permanent.CanSuspend;
  30. }
  31. bool CanActivateCondition(Hashtable hashtable)
  32. {
  33. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  34. CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition);
  35. }
  36. IEnumerator ActivateCoroutine(Hashtable hashtable)
  37. {
  38. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  39. selectPermanentEffect.SetUp(
  40. selectPlayer: card.Owner,
  41. canTargetCondition: CanSelectPermanentCondition,
  42. canTargetCondition_ByPreSelecetedList: null,
  43. canEndSelectCondition: null,
  44. maxCount: 1,
  45. canNoSelect: false,
  46. canEndNotMax: false,
  47. selectPermanentCoroutine: null,
  48. afterSelectPermanentCoroutine: null,
  49. mode: SelectPermanentEffect.Mode.Tap,
  50. cardEffect: activateClass);
  51. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  52. }
  53. }
  54. #endregion
  55. return cardEffects;
  56. }
  57. }
  58. }