P_201.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. // Phascomon
  6. namespace DCGO.CardEffects.P
  7. {
  8. public class P_201 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Alternative Digivolution Condition
  14. if (timing == EffectTiming.None)
  15. {
  16. bool PermanentCondition(Permanent targetPermanent)
  17. {
  18. return targetPermanent.TopCard.IsLevel2 && targetPermanent.TopCard.EqualsCardName("Kapurimon");
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  21. permanentCondition: PermanentCondition,
  22. digivolutionCost: 0,
  23. ignoreDigivolutionRequirement: false,
  24. card: card,
  25. condition: null)
  26. );
  27. }
  28. #endregion
  29. #region OP/OD Shared
  30. bool CanSelectCardCondition(CardSource cardSource)
  31. {
  32. return cardSource.HasText("Belphemon") || cardSource.HasText("Gizmon");
  33. }
  34. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  35. {
  36. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  37. revealCount: 3,
  38. simplifiedSelectCardConditions:
  39. new SimplifiedSelectCardConditionClass[]
  40. {
  41. new SimplifiedSelectCardConditionClass(
  42. canTargetCondition:CanSelectCardCondition,
  43. message: "Select 1 card with [Belphemon] or [Gizmon] in its text.",
  44. mode: SelectCardEffect.Mode.AddHand,
  45. maxCount: 1,
  46. selectCardCoroutine: null)
  47. },
  48. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  49. activateClass: activateClass
  50. ));
  51. if (card.Owner.HandCards.Any())
  52. {
  53. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  54. selectHandEffect.SetUp(
  55. selectPlayer: card.Owner,
  56. canTargetCondition: _ => true,
  57. canTargetCondition_ByPreSelecetedList: null,
  58. canEndSelectCondition: null,
  59. maxCount: 1,
  60. canNoSelect: true,
  61. canEndNotMax: false,
  62. isShowOpponent: true,
  63. selectCardCoroutine: null,
  64. afterSelectCardCoroutine: null,
  65. mode: SelectHandEffect.Mode.Discard,
  66. cardEffect: activateClass);
  67. selectHandEffect.SetUpCustomMessage("Select 1 card in your hand to trash.", "The opponent is selecting 1 card to trash.");
  68. selectHandEffect.SetUpCustomMessage_ShowCard("Selected card.");
  69. yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
  70. }
  71. }
  72. #endregion
  73. #region On Play
  74. if (timing == EffectTiming.OnEnterFieldAnyone)
  75. {
  76. ActivateClass activateClass = new ActivateClass();
  77. activateClass.SetUpICardEffect("Reveal top 3, then trash 1 from hand", CanUseCondition, card);
  78. activateClass.SetUpActivateClass(CanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), -1, false, EffectDiscription());
  79. cardEffects.Add(activateClass);
  80. string EffectDiscription()
  81. {
  82. return "[On Play] Reveal the top 3 cards of your deck. Add 1 card with [Belphemon] or [Gizmon] in its text among them to the hand. Return the rest to the bottom of the deck. Then, trash 1 card in your hand.";
  83. }
  84. bool CanUseCondition(Hashtable hashtable)
  85. {
  86. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  87. && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  88. }
  89. bool CanActivateCondition(Hashtable hashtable)
  90. {
  91. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  92. }
  93. }
  94. #endregion
  95. #region On Deletion
  96. if (timing == EffectTiming.OnDestroyedAnyone)
  97. {
  98. ActivateClass activateClass = new ActivateClass();
  99. activateClass.SetUpICardEffect("Reveal top 3, then trash 1 from hand", CanUseCondition, card);
  100. activateClass.SetUpActivateClass(CanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), -1, false, EffectDiscription());
  101. cardEffects.Add(activateClass);
  102. string EffectDiscription()
  103. {
  104. return "[On Deletion] Reveal the top 3 cards of your deck. Add 1 card with [Belphemon] or [Gizmon] in its text among them to the hand. Return the rest to the bottom of the deck. Then, trash 1 card in your hand.";
  105. }
  106. bool CanUseCondition(Hashtable hashtable)
  107. {
  108. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card);
  109. }
  110. bool CanActivateCondition(Hashtable hashtable)
  111. {
  112. return CardEffectCommons.CanActivateOnDeletion(card);
  113. }
  114. }
  115. #endregion
  116. #region EOOT - OPT
  117. if (timing == EffectTiming.OnEndTurn)
  118. {
  119. ActivateClass activateClass = new ActivateClass();
  120. activateClass.SetUpICardEffect("By trashing 1 card, suspend 1 digimon", CanUseCondition, card);
  121. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  122. activateClass.SetIsInheritedEffect(true);
  123. activateClass.SetHashString("P_201_EOT");
  124. cardEffects.Add(activateClass);
  125. string EffectDiscription()
  126. {
  127. return "[End of Opponent's Turn] [Once Per Turn] By trashing 1 card in your hand, suspend 1 of your opponent's Digimon.";
  128. }
  129. bool CanUseCondition(Hashtable hashtable)
  130. {
  131. return CardEffectCommons.IsExistOnField(card);
  132. }
  133. bool CanActivateCondition(Hashtable hashtable)
  134. {
  135. return CardEffectCommons.IsExistOnField(card)
  136. && CardEffectCommons.IsOpponentTurn(card);
  137. }
  138. bool CanSelectPermament(Permanent permanent)
  139. {
  140. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  141. }
  142. IEnumerator ActivateCoroutine(Hashtable hashtable)
  143. {
  144. bool trashed = false;
  145. if (card.Owner.HandCards.Any())
  146. {
  147. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  148. selectHandEffect.SetUp(
  149. selectPlayer: card.Owner,
  150. canTargetCondition: _ => true,
  151. canTargetCondition_ByPreSelecetedList: null,
  152. canEndSelectCondition: null,
  153. maxCount: 1,
  154. canNoSelect: true,
  155. canEndNotMax: false,
  156. isShowOpponent: true,
  157. selectCardCoroutine: null,
  158. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  159. mode: SelectHandEffect.Mode.Discard,
  160. cardEffect: activateClass);
  161. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  162. {
  163. if (cardSources.Any()) trashed = true;
  164. yield return null;
  165. }
  166. selectHandEffect.SetUpCustomMessage("Select 1 card in your hand to trash.", "The opponent is selecting 1 card to trash.");
  167. selectHandEffect.SetUpCustomMessage_ShowCard("Selected card.");
  168. yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
  169. }
  170. if (trashed && CardEffectCommons.HasMatchConditionPermanent(CanSelectPermament))
  171. {
  172. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermament));
  173. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  174. selectPermanentEffect.SetUp(
  175. selectPlayer: card.Owner.Enemy,
  176. canTargetCondition: CanSelectPermament,
  177. canTargetCondition_ByPreSelecetedList: null,
  178. canEndSelectCondition: null,
  179. maxCount: maxCount,
  180. canNoSelect: false,
  181. canEndNotMax: false,
  182. selectPermanentCoroutine: null,
  183. afterSelectPermanentCoroutine: null,
  184. mode: SelectPermanentEffect.Mode.Tap,
  185. cardEffect: activateClass);
  186. selectPermanentEffect.SetUpCustomMessage("Select 1 of your opponent's Digimon to suspend.", "The opponent is selecting 1 Digimon to suspend.");
  187. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  188. }
  189. }
  190. }
  191. #endregion
  192. return cardEffects;
  193. }
  194. }
  195. }