P_145.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.P
  5. {
  6. public class P_145 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alternate Digivolution Requirement
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. if (targetPermanent.TopCard.CardNames.Contains("Myotismon"))
  17. {
  18. return true;
  19. }
  20. return false;
  21. }
  22. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  23. permanentCondition: PermanentCondition,
  24. digivolutionCost: 0,
  25. ignoreDigivolutionRequirement: false,
  26. card: card,
  27. condition: null));
  28. }
  29. #endregion
  30. #region On Play
  31. if (timing == EffectTiming.OnEnterFieldAnyone)
  32. {
  33. ActivateClass activateClass = new ActivateClass();
  34. activateClass.SetUpICardEffect("Delete 1 Opponent's level 4 or lower Digimon", CanUseCondition, card);
  35. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  36. cardEffects.Add(activateClass);
  37. string EffectDiscription()
  38. {
  39. return "[On Play] Delete 1 of your opponent's level 4 or lower Digimon.";
  40. }
  41. bool SelectDeletionTarget(Permanent permanent)
  42. {
  43. if(CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  44. {
  45. return permanent.TopCard.HasLevel && permanent.Level <= 4;
  46. }
  47. return false;
  48. }
  49. bool CanUseCondition(Hashtable hashtable)
  50. {
  51. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  52. }
  53. bool CanActivateCondition(Hashtable hashtable)
  54. {
  55. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  56. {
  57. if(CardEffectCommons.HasMatchConditionOpponentsPermanent(card, SelectDeletionTarget))
  58. {
  59. return true;
  60. }
  61. }
  62. return false;
  63. }
  64. IEnumerator ActivateCoroutine(Hashtable hashtable)
  65. {
  66. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  67. selectPermanentEffect.SetUp(
  68. selectPlayer: card.Owner,
  69. canTargetCondition: SelectDeletionTarget,
  70. canTargetCondition_ByPreSelecetedList: null,
  71. canEndSelectCondition: null,
  72. maxCount: 1,
  73. canNoSelect: false,
  74. canEndNotMax: false,
  75. selectPermanentCoroutine: null,
  76. afterSelectPermanentCoroutine: null,
  77. mode: SelectPermanentEffect.Mode.Destroy,
  78. cardEffect: activateClass);
  79. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  80. }
  81. }
  82. #endregion
  83. #region When Digivolving
  84. if (timing == EffectTiming.OnEnterFieldAnyone)
  85. {
  86. ActivateClass activateClass = new ActivateClass();
  87. activateClass.SetUpICardEffect("Delete 1 Opponent's level 4 or lower Digimon", CanUseCondition, card);
  88. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  89. cardEffects.Add(activateClass);
  90. string EffectDiscription()
  91. {
  92. return "[When Digivolving] Delete 1 of your opponent's level 4 or lower Digimon.";
  93. }
  94. bool SelectDeletionTarget(Permanent permanent)
  95. {
  96. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  97. {
  98. return permanent.TopCard.HasLevel && permanent.Level <= 4;
  99. }
  100. return false;
  101. }
  102. bool CanUseCondition(Hashtable hashtable)
  103. {
  104. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  105. }
  106. bool CanActivateCondition(Hashtable hashtable)
  107. {
  108. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  109. {
  110. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, SelectDeletionTarget))
  111. {
  112. return true;
  113. }
  114. }
  115. return false;
  116. }
  117. IEnumerator ActivateCoroutine(Hashtable hashtable)
  118. {
  119. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  120. selectPermanentEffect.SetUp(
  121. selectPlayer: card.Owner,
  122. canTargetCondition: SelectDeletionTarget,
  123. canTargetCondition_ByPreSelecetedList: null,
  124. canEndSelectCondition: null,
  125. maxCount: 1,
  126. canNoSelect: false,
  127. canEndNotMax: false,
  128. selectPermanentCoroutine: null,
  129. afterSelectPermanentCoroutine: null,
  130. mode: SelectPermanentEffect.Mode.Destroy,
  131. cardEffect: activateClass);
  132. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  133. }
  134. }
  135. #endregion
  136. #region On Deletion
  137. if (timing == EffectTiming.OnDestroyedAnyone)
  138. {
  139. ActivateClass activateClass = new ActivateClass();
  140. activateClass.SetUpICardEffect("Play 1 level 6 Digimon with [Myotismon] from your trash", CanUseCondition, card);
  141. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  142. cardEffects.Add(activateClass);
  143. string EffectDiscription()
  144. {
  145. return "[On Deletion] If [Myotismon] or [X Antibody] is in this Digimon's digivolution cards, you may play 1 level 6 Digimon card with [Myotismon] in its name from your trash without paying the cost.";
  146. }
  147. bool SelectMyotismonToPlay(CardSource cardSource)
  148. {
  149. if(cardSource.HasLevel && cardSource.Level == 6)
  150. {
  151. if (cardSource.ContainsCardName("Myotismon"))
  152. {
  153. if(CardEffectCommons.CanPlayAsNewPermanent(
  154. cardSource:cardSource,
  155. payCost: false,
  156. cardEffect: activateClass,
  157. root: SelectCardEffect.Root.Trash))
  158. {
  159. return true;
  160. }
  161. }
  162. }
  163. return false;
  164. }
  165. bool CanUseCondition(Hashtable hashtable)
  166. {
  167. if(CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass))
  168. {
  169. if (card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => cardSource.CardNames.Contains("Myotismon") || cardSource.EqualsCardName("X Antibody")) >= 1)
  170. {
  171. return true;
  172. }
  173. }
  174. return false;
  175. }
  176. bool CanActivateCondition(Hashtable hashtable)
  177. {
  178. if (CardEffectCommons.CanActivateOnDeletion(card, activateClass))
  179. {
  180. return CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, SelectMyotismonToPlay);
  181. }
  182. return false;
  183. }
  184. IEnumerator ActivateCoroutine(Hashtable hashtable)
  185. {
  186. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  187. selectCardEffect.SetUp(
  188. canTargetCondition: SelectMyotismonToPlay,
  189. canTargetCondition_ByPreSelecetedList: null,
  190. canEndSelectCondition: null,
  191. canNoSelect: () => true,
  192. selectCardCoroutine: PlaySelectedCard,
  193. afterSelectCardCoroutine: null,
  194. message: "Select 1 card to play",
  195. maxCount: 1,
  196. canEndNotMax: false,
  197. isShowOpponent: true,
  198. mode: SelectCardEffect.Mode.Custom,
  199. root: SelectCardEffect.Root.Trash,
  200. customRootCardList: null,
  201. canLookReverseCard: true,
  202. selectPlayer: card.Owner,
  203. cardEffect: activateClass);
  204. selectCardEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  205. selectCardEffect.SetUpCustomMessage_ShowCard("Played Card");
  206. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  207. IEnumerator PlaySelectedCard(CardSource selectedCards)
  208. {
  209. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  210. cardSources: new List<CardSource>() { selectedCards },
  211. activateClass: activateClass,
  212. payCost: false,
  213. isTapped: false,
  214. root: SelectCardEffect.Root.Trash,
  215. activateETB: true));
  216. }
  217. }
  218. }
  219. #endregion
  220. return cardEffects;
  221. }
  222. }
  223. }