ST18_13.cs 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.ST18
  4. {
  5. public class ST18_13 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Fortitude
  11. if (timing == EffectTiming.OnDestroyedAnyone)
  12. {
  13. cardEffects.Add(CardEffectFactory.FortitudeSelfEffect(isInheritedEffect: false, card: card, condition: null));
  14. }
  15. #endregion
  16. #region On Play/ When Digivolving Shared
  17. bool CanSelectPermanentSharedCondition(Permanent permanent)
  18. {
  19. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) &&
  20. permanent.IsSuspended;
  21. }
  22. bool CanActivateSharedCondition(Hashtable hashtable)
  23. {
  24. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  25. CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentSharedCondition);
  26. }
  27. #endregion
  28. #region On Play
  29. if (timing == EffectTiming.OnEnterFieldAnyone)
  30. {
  31. ActivateClass activateClass = new ActivateClass();
  32. activateClass.SetUpICardEffect("Return 1 of your opponent's suspended Digimon to the hand", CanUseCondition, card);
  33. activateClass.SetUpActivateClass(CanActivateSharedCondition, ActivateCoroutine, -1, false, EffectDescription());
  34. cardEffects.Add(activateClass);
  35. string EffectDescription()
  36. {
  37. return
  38. "[On Play] Return 1 of your opponent's suspended Digimon to the hand.";
  39. }
  40. bool CanUseCondition(Hashtable hashtable)
  41. {
  42. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  43. }
  44. IEnumerator ActivateCoroutine(Hashtable hashtable)
  45. {
  46. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentSharedCondition))
  47. {
  48. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  49. selectPermanentEffect.SetUp(
  50. selectPlayer: card.Owner,
  51. canTargetCondition_ByPreSelecetedList: null,
  52. canTargetCondition: CanSelectPermanentSharedCondition,
  53. canEndSelectCondition: null,
  54. maxCount: 1,
  55. canNoSelect: false,
  56. canEndNotMax: false,
  57. selectPermanentCoroutine: null,
  58. afterSelectPermanentCoroutine: null,
  59. mode: SelectPermanentEffect.Mode.Bounce,
  60. cardEffect: activateClass);
  61. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to return to hand.",
  62. "The opponent is selecting 1 Digimon to return to hand.");
  63. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  64. }
  65. }
  66. }
  67. #endregion
  68. #region When Digivolving
  69. if (timing == EffectTiming.OnEnterFieldAnyone)
  70. {
  71. ActivateClass activateClass = new ActivateClass();
  72. activateClass.SetUpICardEffect("Return 1 of your opponent's suspended Digimon to the hand", CanUseCondition, card);
  73. activateClass.SetUpActivateClass(CanActivateSharedCondition, ActivateCoroutine, -1, false, EffectDescription());
  74. cardEffects.Add(activateClass);
  75. string EffectDescription()
  76. {
  77. return
  78. "[When Digivolving] Return 1 of your opponent's suspended Digimon to the hand.";
  79. }
  80. bool CanUseCondition(Hashtable hashtable)
  81. {
  82. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  83. }
  84. IEnumerator ActivateCoroutine(Hashtable hashtable)
  85. {
  86. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentSharedCondition))
  87. {
  88. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  89. selectPermanentEffect.SetUp(
  90. selectPlayer: card.Owner,
  91. canTargetCondition_ByPreSelecetedList: null,
  92. canTargetCondition: CanSelectPermanentSharedCondition,
  93. canEndSelectCondition: null,
  94. maxCount: 1,
  95. canNoSelect: false,
  96. canEndNotMax: false,
  97. selectPermanentCoroutine: null,
  98. afterSelectPermanentCoroutine: null,
  99. mode: SelectPermanentEffect.Mode.Bounce,
  100. cardEffect: activateClass);
  101. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to return to hand.",
  102. "The opponent is selecting 1 Digimon to return to hand.");
  103. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  104. }
  105. }
  106. }
  107. #endregion
  108. return cardEffects;
  109. }
  110. }
  111. }