BT23_065.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System;
  4. using System.Linq;
  5. //Phantomon
  6. namespace DCGO.CardEffects.BT23
  7. {
  8. public class BT23_065 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Hand Main
  14. if (timing == EffectTiming.OnDeclaration)
  15. {
  16. ActivateClass activateClass = new ActivateClass();
  17. activateClass.SetUpICardEffect("Place 1 [Bakemon] from trash under 1 [Ghostmon], to digivolve for 3", CanUseCondition, card);
  18. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  19. cardEffects.Add(activateClass);
  20. string EffectDiscription()
  21. {
  22. return "[Hand] [Main] If you have [Violet Inboots], by placing 1 [Bakemon] from your trash as any of your [Ghostmon]'s bottom digivolution card, it digivolves into this card for a digivolution cost of 3, ignoring digivolution requirements.";
  23. }
  24. bool CanUseCondition(Hashtable hashtable)
  25. {
  26. return CardEffectCommons.IsExistOnHand(card)
  27. && CardEffectCommons.IsOwnerTurn(card)
  28. && CardEffectCommons.HasMatchConditionOwnersPermanent(card, IsVioletInboots)
  29. && CardEffectCommons.HasMatchConditionOwnersPermanent(card, IsGhostmon)
  30. && CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, IsBakemon);
  31. }
  32. bool IsVioletInboots(Permanent permanent)
  33. {
  34. return permanent.IsTamer && permanent.TopCard.EqualsCardName("Violet Inboots");
  35. }
  36. bool IsGhostmon(Permanent permanent)
  37. {
  38. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  39. permanent.TopCard.EqualsCardName("Ghostmon");
  40. }
  41. bool IsBakemon(CardSource source)
  42. {
  43. return source.IsDigimon && source.EqualsCardName("Bakemon");
  44. }
  45. bool IsProganomon(CardSource cardSource)
  46. {
  47. return CardEffectCommons.IsExistOnHand(cardSource) && cardSource == card;
  48. }
  49. IEnumerator ActivateCoroutine(Hashtable hashtable)
  50. {
  51. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, IsVioletInboots))
  52. {
  53. Permanent sunarizamon = null;
  54. CardSource landramon = null;
  55. #region Select Bakemon From Trash
  56. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersCardCountInTrash(card, IsBakemon));
  57. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  58. selectCardEffect.SetUp(
  59. canTargetCondition: IsBakemon,
  60. canTargetCondition_ByPreSelecetedList: null,
  61. canEndSelectCondition: null,
  62. canNoSelect: () => false,
  63. selectCardCoroutine: SelectCardCoroutine,
  64. afterSelectCardCoroutine: null,
  65. message: "Select 1 [Bakemon] to add as digivolution source",
  66. maxCount: maxCount,
  67. canEndNotMax: false,
  68. isShowOpponent: true,
  69. mode: SelectCardEffect.Mode.Custom,
  70. root: SelectCardEffect.Root.Trash,
  71. customRootCardList: null,
  72. canLookReverseCard: true,
  73. selectPlayer: card.Owner,
  74. cardEffect: activateClass);
  75. IEnumerator SelectCardCoroutine(CardSource cardSource)
  76. {
  77. landramon = cardSource;
  78. yield return null;
  79. }
  80. selectCardEffect.SetUpCustomMessage("Select 1 [Bakemon] to add as digivolution source.", "The opponent is selecting 1 [Bakemon] to add as digivolution source.");
  81. yield return StartCoroutine(selectCardEffect.Activate());
  82. #endregion
  83. if (landramon != null)
  84. {
  85. #region Select Ghostmon Permanent
  86. int maxCount1 = Math.Min(1, CardEffectCommons.MatchConditionOwnersPermanentCount(card, IsGhostmon));
  87. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  88. selectPermanentEffect.SetUp(
  89. selectPlayer: card.Owner,
  90. canTargetCondition: IsGhostmon,
  91. canTargetCondition_ByPreSelecetedList: null,
  92. canEndSelectCondition: null,
  93. maxCount: maxCount1,
  94. canNoSelect: false,
  95. canEndNotMax: false,
  96. selectPermanentCoroutine: SelectPermanentCoroutine,
  97. afterSelectPermanentCoroutine: null,
  98. mode: SelectPermanentEffect.Mode.Custom,
  99. cardEffect: activateClass);
  100. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  101. {
  102. sunarizamon = permanent;
  103. yield return null;
  104. }
  105. selectPermanentEffect.SetUpCustomMessage("Select 1 [Ghostmon] to add digivolution sources.", "The opponent is selecting 1 [Ghostmon] to add digivolution sources.");
  106. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  107. #endregion
  108. if (sunarizamon != null)
  109. {
  110. yield return ContinuousController.instance.StartCoroutine(sunarizamon.AddDigivolutionCardsBottom(new List<CardSource>() { landramon }, activateClass));
  111. if (sunarizamon.DigivolutionCards.Contains(landramon))
  112. {
  113. #region Digivolve into MarineBullmon
  114. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  115. sunarizamon,
  116. IsProganomon,
  117. payCost: true,
  118. reduceCostTuple: null,
  119. fixedCostTuple: null,
  120. ignoreDigivolutionRequirementFixedCost: 3,
  121. isHand: true,
  122. activateClass: activateClass,
  123. successProcess: null,
  124. ignoreSelection: true,
  125. failedProcess: FailureProcess(),
  126. isOptional:false));
  127. #endregion
  128. }
  129. IEnumerator FailureProcess()
  130. {
  131. List<IDiscardHand> discardHands = new List<IDiscardHand>() { new IDiscardHand(card, null) };
  132. yield return ContinuousController.instance.StartCoroutine(new IDiscardHands(discardHands, null).DiscardHands());
  133. }
  134. }
  135. }
  136. }
  137. }
  138. }
  139. #endregion
  140. #region On Deletion Shared
  141. string SharedEffectDiscription()
  142. {
  143. return "[On Deletion] You may play 1 level 4 or lower Digimon card with the [Ghost] trait from your trash without paying the cost.";
  144. }
  145. bool SharedCanActivateCondition(Hashtable hashtable, ActivateClass activateClass)
  146. {
  147. return CardEffectCommons.CanActivateOnDeletion(card, activateClass);
  148. }
  149. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  150. {
  151. bool CanSelectCardCondition1(CardSource source)
  152. {
  153. return source.HasGhostTraits &&
  154. source.HasLevel && source.Level <= 4 &&
  155. source.IsDigimon &&
  156. CardEffectCommons.CanPlayAsNewPermanent(source, false, activateClass, SelectCardEffect.Root.Trash);
  157. }
  158. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition1))
  159. {
  160. List<CardSource> selectedCards = new List<CardSource>();
  161. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  162. selectCardEffect.SetUp(
  163. canTargetCondition: CanSelectCardCondition1,
  164. canTargetCondition_ByPreSelecetedList: null,
  165. canEndSelectCondition: null,
  166. canNoSelect: () => true,
  167. selectCardCoroutine: SelectCardCoroutine,
  168. afterSelectCardCoroutine: null,
  169. message: "Select 1 card to play.",
  170. maxCount: 1,
  171. canEndNotMax: false,
  172. isShowOpponent: true,
  173. mode: SelectCardEffect.Mode.Custom,
  174. root: SelectCardEffect.Root.Trash,
  175. customRootCardList: null,
  176. canLookReverseCard: true,
  177. selectPlayer: card.Owner,
  178. cardEffect: activateClass);
  179. selectCardEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  180. selectCardEffect.SetUpCustomMessage_ShowCard("Played Card");
  181. yield return StartCoroutine(selectCardEffect.Activate());
  182. IEnumerator SelectCardCoroutine(CardSource cardSource)
  183. {
  184. selectedCards.Add(cardSource);
  185. yield return null;
  186. }
  187. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Trash, activateETB: true));
  188. }
  189. }
  190. #endregion
  191. #region On Deletion
  192. if (timing == EffectTiming.OnDestroyedAnyone)
  193. {
  194. ActivateClass activateClass = new ActivateClass();
  195. activateClass.SetUpICardEffect("Play 1 level 4 [Ghost] trait from trash", CanUseCondition, card);
  196. activateClass.SetUpActivateClass(hash => SharedCanActivateCondition(hash, activateClass), hash => SharedActivateCoroutine(hash, activateClass), -1, false, SharedEffectDiscription());
  197. cardEffects.Add(activateClass);
  198. bool CanUseCondition(Hashtable hashtable)
  199. {
  200. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  201. }
  202. }
  203. #endregion
  204. #region On Deletion - ESS
  205. if (timing == EffectTiming.OnDestroyedAnyone)
  206. {
  207. ActivateClass activateClass = new ActivateClass();
  208. activateClass.SetUpICardEffect("Play 1 level 4 [Ghost] trait from trash", CanUseCondition, card);
  209. activateClass.SetUpActivateClass(hash => SharedCanActivateCondition(hash, activateClass), hash => SharedActivateCoroutine(hash, activateClass), -1, false, SharedEffectDiscription());
  210. activateClass.SetIsInheritedEffect(true);
  211. cardEffects.Add(activateClass);
  212. bool CanUseCondition(Hashtable hashtable)
  213. {
  214. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  215. }
  216. }
  217. #endregion
  218. return cardEffects;
  219. }
  220. }
  221. }