BT20_083.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Diagnostics;
  4. namespace DCGO.CardEffects.BT20
  5. {
  6. public class BT20_083 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Treated As
  12. if (timing == EffectTiming.None)
  13. {
  14. ChangeCardNamesClass changeCardNamesClass = new ChangeCardNamesClass();
  15. changeCardNamesClass.SetUpICardEffect("Also treated as [X Antibody]", CanUseCondition, card);
  16. changeCardNamesClass.SetUpChangeCardNamesClass(changeCardNames: changeCardNames);
  17. cardEffects.Add(changeCardNamesClass);
  18. bool CanUseCondition(Hashtable hashtable)
  19. {
  20. return true;
  21. }
  22. List<string> changeCardNames(CardSource cardSource, List<string> CardNames)
  23. {
  24. if (cardSource == card)
  25. {
  26. CardNames.Add("X Antibody");
  27. }
  28. return CardNames;
  29. }
  30. }
  31. #endregion
  32. #region Blocker
  33. if (timing == EffectTiming.None)
  34. {
  35. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(
  36. isInheritedEffect: false,
  37. card: card,
  38. condition: null));
  39. }
  40. #endregion
  41. #region On Play
  42. if (timing == EffectTiming.OnEnterFieldAnyone)
  43. {
  44. ActivateClass activateClass = new ActivateClass();
  45. activateClass.SetUpICardEffect("Digivolve this Digimon into [Omnimon (X Antibody)]", CanUseCondition, card);
  46. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  47. cardEffects.Add(activateClass);
  48. string EffectDiscription()
  49. {
  50. return "[On Play] If you have 1 or fewer security cards, this Digimon may digivolve into [Omnimon (X Antibody)] in the hand, ignoring digivolution requirements and without paying the cost.";
  51. }
  52. bool CanSelectCardCondition(CardSource cardSource)
  53. {
  54. return cardSource.IsDigimon && cardSource.EqualsCardName("Omnimon (X Antibody)");
  55. }
  56. bool CanUseCondition(Hashtable hashtable)
  57. {
  58. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  59. }
  60. bool CanActivateCondition(Hashtable hashtable)
  61. {
  62. if (CardEffectCommons.IsExistOnBattleArea(card))
  63. {
  64. if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition))
  65. {
  66. if (card.Owner.SecurityCards.Count <= 1)
  67. {
  68. return true;
  69. }
  70. }
  71. }
  72. return false;
  73. }
  74. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  75. {
  76. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  77. targetPermanent: card.PermanentOfThisCard(),
  78. cardCondition: CanSelectCardCondition,
  79. payCost: false,
  80. reduceCostTuple: null,
  81. fixedCostTuple: null,
  82. ignoreDigivolutionRequirementFixedCost: 0,
  83. isHand: true,
  84. activateClass: activateClass,
  85. ignoreRequirements: CardEffectCommons.IgnoreRequirement.All,
  86. successProcess: null));
  87. }
  88. }
  89. #endregion
  90. #region On Deletion
  91. if (timing == EffectTiming.OnDestroyedAnyone)
  92. {
  93. ActivateClass activateClass = new ActivateClass();
  94. activateClass.SetUpICardEffect("Place under [King Drasil_7D6] in the breeding area.", CanUseCondition, card);
  95. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  96. cardEffects.Add(activateClass);
  97. string EffectDiscription()
  98. {
  99. return "[On Deletion] You may place this card as the bottom digivolution card of your [King Drasil_7D6] in the breeding area.";
  100. }
  101. bool isKingDrasil(Permanent permanent)
  102. {
  103. return CardEffectCommons.IsPermanentExistsOnOwnerBreedingArea(permanent, card) &&
  104. permanent.TopCard.EqualsCardName("King Drasil_7D6");
  105. }
  106. bool CanUseCondition(Hashtable hashtable)
  107. {
  108. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  109. }
  110. bool CanActivateCondition(Hashtable hashtable)
  111. {
  112. return CardEffectCommons.CanActivateOnDeletion(card, activateClass) &&
  113. CardEffectCommons.HasMatchConditionPermanent(isKingDrasil, true);
  114. }
  115. IEnumerator ActivateCoroutine(Hashtable hashtable)
  116. {
  117. Permanent breedingPermanent = card.Owner.GetBreedingAreaPermanents()[0];
  118. yield return ContinuousController.instance.StartCoroutine(card.Owner.brainStormObject.CloseBrainstrorm(card));
  119. yield return ContinuousController.instance.StartCoroutine(breedingPermanent.AddDigivolutionCardsBottom(new List<CardSource>() { card }, activateClass));
  120. }
  121. }
  122. #endregion
  123. #region Opponents Turn - ESS
  124. if (timing == EffectTiming.OnLoseSecurity)
  125. {
  126. ActivateClass activateClass = new ActivateClass();
  127. activateClass.SetUpICardEffect("play 1 [Omekamon]", CanUseCondition, card);
  128. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  129. activateClass.SetIsInheritedEffect(true);
  130. cardEffects.Add(activateClass);
  131. string EffectDiscription()
  132. {
  133. return "[Breeding] [Opponent's Turn] When your security stack is removed from, by suspending this Digimon, play 1 [Omekamon] from this Digimon's digivolution cards without paying the cost.";
  134. }
  135. bool CanSelectCardCondition(CardSource cardSource)
  136. {
  137. if (cardSource.EqualsCardName("Omekamon"))
  138. {
  139. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  140. {
  141. return true;
  142. }
  143. }
  144. return false;
  145. }
  146. bool CanUseCondition(Hashtable hashtable)
  147. {
  148. if (CardEffectCommons.IsExistOnBreedingArea(card))
  149. {
  150. if (CardEffectCommons.CanTriggerWhenLoseSecurity(hashtable, player => player == card.Owner))
  151. {
  152. return true;
  153. }
  154. }
  155. return false;
  156. }
  157. bool CanActivateCondition(Hashtable hashtable)
  158. {
  159. if (CardEffectCommons.IsExistOnBreedingArea(card))
  160. {
  161. if (CardEffectCommons.IsOpponentTurn(card))
  162. {
  163. if (CardEffectCommons.CanActivateSuspendCostEffect(card, true))
  164. {
  165. return true;
  166. }
  167. }
  168. }
  169. return false;
  170. }
  171. IEnumerator ActivateCoroutine(Hashtable hashtable)
  172. {
  173. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  174. List<CardSource> selectedCards = new List<CardSource>();
  175. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  176. selectCardEffect.SetUp(
  177. canTargetCondition: CanSelectCardCondition,
  178. canTargetCondition_ByPreSelecetedList: null,
  179. canEndSelectCondition: null,
  180. canNoSelect: () => true,
  181. selectCardCoroutine: SelectCardCoroutine,
  182. afterSelectCardCoroutine: null,
  183. message: "Select 1 card to play.",
  184. maxCount: 1,
  185. canEndNotMax: false,
  186. isShowOpponent: true,
  187. mode: SelectCardEffect.Mode.Custom,
  188. root: SelectCardEffect.Root.Custom,
  189. customRootCardList: card.PermanentOfThisCard().DigivolutionCards,
  190. canLookReverseCard: true,
  191. selectPlayer: card.Owner,
  192. cardEffect: activateClass);
  193. selectCardEffect.SetUpCustomMessage("Select 1 digivolution card to play.", "The opponent is selecting 1 digivolution card to play.");
  194. selectCardEffect.SetUpCustomMessage_ShowCard("Played Card");
  195. yield return StartCoroutine(selectCardEffect.Activate());
  196. IEnumerator SelectCardCoroutine(CardSource cardSource)
  197. {
  198. selectedCards.Add(cardSource);
  199. yield return null;
  200. }
  201. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  202. cardSources: selectedCards,
  203. activateClass: activateClass,
  204. payCost: false,
  205. isTapped: false,
  206. root: SelectCardEffect.Root.DigivolutionCards,
  207. activateETB: true));
  208. }
  209. }
  210. #endregion
  211. return cardEffects;
  212. }
  213. }
  214. }