EX11_028.cs 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Galemon
  5. namespace DCGO.CardEffects.EX11
  6. {
  7. public class EX11_028 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Shared OP/WD
  13. string SharedEffectName() => "Suspend 1 Digimon.";
  14. string SharedEffectDescription(string tag) => $"[{tag}] You may suspend 1 Digimon.";
  15. bool SharedCanActivateCondition(Hashtable hashtable)
  16. {
  17. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  18. }
  19. bool PermanentConditionBattleArea(Permanent permanent)
  20. {
  21. return CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(permanent);
  22. }
  23. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  24. {
  25. if (CardEffectCommons.HasMatchConditionPermanent(PermanentConditionBattleArea))
  26. {
  27. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(PermanentConditionBattleArea));
  28. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  29. selectPermanentEffect.SetUp(
  30. selectPlayer: card.Owner,
  31. canTargetCondition: PermanentConditionBattleArea,
  32. canTargetCondition_ByPreSelecetedList: null,
  33. canEndSelectCondition: null,
  34. maxCount: maxCount,
  35. canNoSelect: true,
  36. canEndNotMax: false,
  37. selectPermanentCoroutine: null,
  38. afterSelectPermanentCoroutine: null,
  39. mode: SelectPermanentEffect.Mode.Tap,
  40. cardEffect: activateClass);
  41. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to suspend.", "The opponent is selecting 1 Digimon to suspend.");
  42. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  43. }
  44. }
  45. #endregion
  46. #region On Play
  47. if (timing == EffectTiming.OnEnterFieldAnyone)
  48. {
  49. ActivateClass activateClass = new ActivateClass();
  50. activateClass.SetUpICardEffect(SharedEffectName(), CanUseCondition, card);
  51. activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), -1, false, SharedEffectDescription("On Play"));
  52. cardEffects.Add(activateClass);
  53. bool CanUseCondition(Hashtable hashtable)
  54. {
  55. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  56. && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  57. }
  58. }
  59. #endregion
  60. #region When Digivolving
  61. if (timing == EffectTiming.OnEnterFieldAnyone)
  62. {
  63. ActivateClass activateClass = new ActivateClass();
  64. activateClass.SetUpICardEffect(SharedEffectName(), CanUseCondition, card);
  65. activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), -1, false, SharedEffectDescription("When Digivolving"));
  66. cardEffects.Add(activateClass);
  67. bool CanUseCondition(Hashtable hashtable)
  68. {
  69. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  70. && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  71. }
  72. }
  73. #endregion
  74. #region All Turns
  75. if (timing == EffectTiming.OnTappedAnyone)
  76. {
  77. ActivateClass activateClass = new ActivateClass();
  78. activateClass.SetUpICardEffect("Play 1 [Shoto Kazama] from your hand", CanUseCondition, card);
  79. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  80. activateClass.SetHashString("EX11_028_AT");
  81. cardEffects.Add(activateClass);
  82. string EffectDiscription()
  83. {
  84. return "[All Turns] [Once Per Turn] When any of your Digimon suspend, if you have 1 or fewer Tamers, you may play 1 [Shoto Kazama] from your hand without paying the cost.";
  85. }
  86. bool HasTamers(Permanent permanent)
  87. {
  88. return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card)
  89. && permanent.IsTamer;
  90. }
  91. bool HasShotoKazama(CardSource source)
  92. {
  93. return source.EqualsCardName("Shoto Kazama")
  94. && CardEffectCommons.CanPlayAsNewPermanent(source, false, activateClass);
  95. }
  96. bool PermanentCondition(Permanent permanent)
  97. {
  98. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  99. }
  100. bool CanUseCondition(Hashtable hashtable)
  101. {
  102. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  103. && CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, PermanentCondition);
  104. }
  105. bool CanActivateCondition(Hashtable hashtable)
  106. {
  107. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  108. && CardEffectCommons.MatchConditionOwnersPermanentCount(card, HasTamers) <= 1;
  109. }
  110. IEnumerator ActivateCoroutine(Hashtable hashtable)
  111. {
  112. List<CardSource> selectedCards = new List<CardSource>();
  113. if (CardEffectCommons.HasMatchConditionOwnersHand(card, HasShotoKazama))
  114. {
  115. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  116. selectHandEffect.SetUp(
  117. selectPlayer: card.Owner,
  118. canTargetCondition: HasShotoKazama,
  119. canTargetCondition_ByPreSelecetedList: null,
  120. canEndSelectCondition: null,
  121. maxCount: 1,
  122. canNoSelect: false,
  123. canEndNotMax: false,
  124. isShowOpponent: true,
  125. selectCardCoroutine: SelectCardCoroutine,
  126. afterSelectCardCoroutine: null,
  127. mode: SelectHandEffect.Mode.Custom,
  128. cardEffect: activateClass);
  129. yield return StartCoroutine(selectHandEffect.Activate());
  130. }
  131. IEnumerator SelectCardCoroutine(CardSource cardSource)
  132. {
  133. selectedCards.Add(cardSource);
  134. yield return null;
  135. }
  136. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  137. }
  138. }
  139. #endregion
  140. #region ESS - Win Battle
  141. if (timing == EffectTiming.OnEndBattle)
  142. {
  143. ActivateClass activateClass = new ActivateClass();
  144. activateClass.SetUpICardEffect("Gain 1 memory.", CanUseCondition, card);
  145. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  146. activateClass.SetIsInheritedEffect(true);
  147. activateClass.SetHashString("EX11_032_ESS_Unsuspend");
  148. cardEffects.Add(activateClass);
  149. string EffectDescription()
  150. => "[Your Turn] [Once Per Turn] When this Digimon wins a battle, gain 1 memory.";
  151. bool CanUseCondition(Hashtable hashtable)
  152. {
  153. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  154. {
  155. if (CardEffectCommons.IsOwnerTurn(card))
  156. {
  157. bool WinnerCondition(Permanent permanent) => permanent.cardSources.Contains(card);
  158. if (CardEffectCommons.CanTriggerWhenWinBattle(
  159. hashtable: hashtable,
  160. winnerCondition: WinnerCondition))
  161. {
  162. return true;
  163. }
  164. }
  165. }
  166. return false;
  167. }
  168. bool CanActivateCondition(Hashtable hashtable)
  169. {
  170. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  171. }
  172. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  173. {
  174. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  175. }
  176. }
  177. #endregion
  178. return cardEffects;
  179. }
  180. }
  181. }