BT17_069.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT17
  6. {
  7. public class BT17_069 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternate Digivolution
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.ContainsTraits("SoC") &&
  18. targetPermanent.TopCard.HasLevel &&
  19. targetPermanent.TopCard.Level == 5;
  20. }
  21. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition,
  22. digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  23. }
  24. #endregion
  25. #region When Digivolving
  26. if (timing == EffectTiming.OnEnterFieldAnyone)
  27. {
  28. ActivateClass activateClass = new ActivateClass();
  29. activateClass.SetUpICardEffect("Play 1 Digimon from trash", CanUseCondition, card);
  30. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  31. cardEffects.Add(activateClass);
  32. string EffectDescription()
  33. {
  34. return
  35. "[When Digivolving] If [Eiji Nagasumi] is in this Digimon's digivolution cards, you may play 1 [Fenriloogamon]/[Kazuchimon] from your trash without paying the cost. At the next end of your opponent's turn, return that Digimon to the hand.";
  36. }
  37. bool CanUseCondition(Hashtable hashtable)
  38. {
  39. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  40. {
  41. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  42. }
  43. return false;
  44. }
  45. bool CanSelectTrashCardCondition(CardSource cardSource)
  46. {
  47. return cardSource.IsDigimon &&
  48. CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass) &&
  49. (cardSource.EqualsCardName("Fenriloogamon") || cardSource.EqualsCardName("Kazuchimon"));
  50. }
  51. bool IsEijiCardCondition(CardSource cardSource)
  52. {
  53. return cardSource.IsTamer &&
  54. (cardSource.EqualsCardName("Eiji Nagasumi") ||
  55. cardSource.EqualsCardName("EijiNagasumi"));
  56. }
  57. bool CanActivateCondition(Hashtable hashtable)
  58. {
  59. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  60. card.PermanentOfThisCard().DigivolutionCards.Some(IsEijiCardCondition) &&
  61. CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectTrashCardCondition);
  62. }
  63. IEnumerator ActivateCoroutine(Hashtable hashtable)
  64. {
  65. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectTrashCardCondition))
  66. {
  67. int maxCount = Math.Min(1, card.Owner.TrashCards.Count(CanSelectTrashCardCondition));
  68. List<CardSource> selectedCards = new List<CardSource>();
  69. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  70. selectCardEffect.SetUp(
  71. canTargetCondition: CanSelectTrashCardCondition,
  72. canTargetCondition_ByPreSelecetedList: null,
  73. canEndSelectCondition: null,
  74. canNoSelect: () => true,
  75. selectCardCoroutine: SelectCardCoroutine,
  76. afterSelectCardCoroutine: null,
  77. message: "Select 1 card to play.",
  78. maxCount: maxCount,
  79. canEndNotMax: false,
  80. isShowOpponent: true,
  81. mode: SelectCardEffect.Mode.Custom,
  82. root: SelectCardEffect.Root.Trash,
  83. customRootCardList: null,
  84. canLookReverseCard: true,
  85. selectPlayer: card.Owner,
  86. cardEffect: activateClass);
  87. selectCardEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  88. selectCardEffect.SetUpCustomMessage_ShowCard("Played Card");
  89. yield return StartCoroutine(selectCardEffect.Activate());
  90. IEnumerator SelectCardCoroutine(CardSource cardSource)
  91. {
  92. selectedCards.Add(cardSource);
  93. yield return null;
  94. }
  95. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  96. cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false,
  97. root: SelectCardEffect.Root.Trash, activateETB: true));
  98. if (selectedCards.Count > 0)
  99. {
  100. Permanent selectedPermanent = selectedCards[0].PermanentOfThisCard();
  101. ActivateClass activateDebuffClass = new ActivateClass();
  102. activateDebuffClass.SetUpICardEffect("Return this Digimon to the hand", CanUseDebuffCondition,
  103. selectedPermanent.TopCard);
  104. activateDebuffClass.SetUpActivateClass(CanActivateDebuffCondition, ActivateDebuffCoroutine, -1, false,
  105. EffectDebuffDescription());
  106. activateDebuffClass.SetEffectSourcePermanent(selectedPermanent);
  107. selectedPermanent.UntilOpponentTurnEndEffects.Add(GetCardEffect);
  108. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  109. {
  110. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>()
  111. .CreateDebuffEffect(selectedPermanent));
  112. }
  113. string EffectDebuffDescription()
  114. {
  115. return "[End of Opponent's Turn] Return this Digimon to the hand.";
  116. }
  117. bool CanUseDebuffCondition(Hashtable debuffHashtable)
  118. {
  119. return CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent) &&
  120. GManager.instance.turnStateMachine.gameContext.TurnPlayer != selectedPermanent.TopCard.Owner;
  121. }
  122. bool CanActivateDebuffCondition(Hashtable debuffHashtable)
  123. {
  124. return CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent) &&
  125. !selectedPermanent.TopCard.CanNotBeAffected(activateClass);
  126. }
  127. IEnumerator ActivateDebuffCoroutine(Hashtable debuffHashtable)
  128. {
  129. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  130. {
  131. yield return ContinuousController.instance.StartCoroutine(
  132. CardEffectCommons.BouncePeremanentAndProcessAccordingToResult(
  133. targetPermanents: new List<Permanent>() { selectedPermanent },
  134. activateClass: activateDebuffClass,
  135. successProcess: null,
  136. failureProcess: null));
  137. }
  138. }
  139. ICardEffect GetCardEffect(EffectTiming debuffTiming)
  140. {
  141. if (debuffTiming == EffectTiming.OnEndTurn)
  142. {
  143. return activateDebuffClass;
  144. }
  145. return null;
  146. }
  147. }
  148. }
  149. }
  150. }
  151. #endregion
  152. #region All Turns
  153. if (timing == EffectTiming.OnEnterFieldAnyone)
  154. {
  155. ActivateClass activateClass = new ActivateClass();
  156. activateClass.SetUpICardEffect(
  157. "Delete 1 of your opponent's Digimon with 10000 DP or less", CanUseCondition,
  158. card);
  159. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false,
  160. EffectDescription());
  161. activateClass.SetHashString("Delete10000_BT17_069");
  162. cardEffects.Add(activateClass);
  163. string EffectDescription()
  164. {
  165. return
  166. "[Your Turn] [Once Per Turn] When one of your Digimon or Tamers that have the [SoC] trait or [Pulsemon] in its text is played, delete 1 of your opponent's Digimon with 10000 DP or less.";
  167. }
  168. bool PlayedPermanentCondition(Permanent permanent)
  169. {
  170. return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card) &&
  171. (permanent.IsDigimon || permanent.IsTamer) &&
  172. (permanent.TopCard.ContainsTraits("SoC") || permanent.TopCard.HasText("Pulsemon"));
  173. }
  174. bool CanSelectOpponentPermanentCondition(Permanent permanent)
  175. {
  176. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) &&
  177. permanent.DP <= card.Owner.MaxDP_DeleteEffect(10000, activateClass);
  178. }
  179. bool CanUseCondition(Hashtable hashtable)
  180. {
  181. return CardEffectCommons.IsExistOnBattleArea(card) &&
  182. CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PlayedPermanentCondition);
  183. }
  184. bool CanActivateCondition(Hashtable hashtable)
  185. {
  186. return CardEffectCommons.IsExistOnBattleArea(card);
  187. }
  188. IEnumerator ActivateCoroutine(Hashtable hashtable)
  189. {
  190. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentPermanentCondition))
  191. {
  192. int maxCount = Math.Min(1,
  193. CardEffectCommons.MatchConditionPermanentCount(CanSelectOpponentPermanentCondition));
  194. SelectPermanentEffect selectPermanentEffect =
  195. GManager.instance.GetComponent<SelectPermanentEffect>();
  196. selectPermanentEffect.SetUp(
  197. selectPlayer: card.Owner,
  198. canTargetCondition: CanSelectOpponentPermanentCondition,
  199. canTargetCondition_ByPreSelecetedList: null,
  200. canEndSelectCondition: null,
  201. maxCount: maxCount,
  202. canNoSelect: false,
  203. canEndNotMax: false,
  204. selectPermanentCoroutine: null,
  205. afterSelectPermanentCoroutine: null,
  206. mode: SelectPermanentEffect.Mode.Destroy,
  207. cardEffect: activateClass);
  208. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  209. }
  210. }
  211. }
  212. #endregion
  213. #region Your Turn - ESS
  214. if (timing == EffectTiming.None)
  215. {
  216. ChangeEndTurnMinMemoryClass changeEndTurnMinMemoryClass = new ChangeEndTurnMinMemoryClass();
  217. changeEndTurnMinMemoryClass.SetUpICardEffect("The turn end condition is the opponent having 3 or more memory.",
  218. CanUseCondition, card);
  219. changeEndTurnMinMemoryClass.SetUpChangeEndTurnMinMemoryClass(_ => 3);
  220. changeEndTurnMinMemoryClass.SetIsInheritedEffect(true);
  221. cardEffects.Add(changeEndTurnMinMemoryClass);
  222. bool CanUseCondition(Hashtable hashtable)
  223. {
  224. return CardEffectCommons.IsExistOnBattleArea(card) &&
  225. CardEffectCommons.IsOwnerTurn(card) &&
  226. card.PermanentOfThisCard().TopCard.ContainsCardName("Fenriloogamon");
  227. }
  228. }
  229. #endregion
  230. return cardEffects;
  231. }
  232. }
  233. }