BT11_070.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT11
  6. {
  7. public class BT11_070 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.CardNames.Contains("Vemmon");
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  19. permanentCondition: PermanentCondition,
  20. digivolutionCost: 6,
  21. ignoreDigivolutionRequirement: false,
  22. card: card,
  23. condition: null));
  24. }
  25. if (timing == EffectTiming.OnEnterFieldAnyone)
  26. {
  27. ActivateClass activateClass = new ActivateClass();
  28. activateClass.SetUpICardEffect("Reveal the top 3 cards of deck and delete 1 Tamer", CanUseCondition, card);
  29. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  30. cardEffects.Add(activateClass);
  31. string EffectDiscription()
  32. {
  33. return "[When Digivolving] Reveal the top 3 cards of your deck. Place 1 [Vemmon] among them under this Digimon as its bottom digivolution card. Trash the rest. Then, if there are 5 or more [Vemmon] in this Digimon's digivolution cards, delete 1 of your opponent's Tamers.";
  34. }
  35. bool CanSelectCardCondition(CardSource cardSource)
  36. {
  37. return cardSource.CardNames.Contains("Vemmon");
  38. }
  39. bool CanSelectPermanentCondition(Permanent permanent)
  40. {
  41. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
  42. {
  43. if (permanent.IsTamer)
  44. {
  45. return true;
  46. }
  47. }
  48. return false;
  49. }
  50. bool CanUseCondition(Hashtable hashtable)
  51. {
  52. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  53. }
  54. bool CanActivateCondition(Hashtable hashtable)
  55. {
  56. return CardEffectCommons.IsExistOnBattleArea(card);
  57. }
  58. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  59. {
  60. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  61. revealCount: 3,
  62. simplifiedSelectCardConditions:
  63. new SimplifiedSelectCardConditionClass[]
  64. {
  65. new SimplifiedSelectCardConditionClass(
  66. canTargetCondition:CanSelectCardCondition,
  67. message: "Select 1 [Vemmon].",
  68. mode: SelectCardEffect.Mode.Custom,
  69. maxCount: 1,
  70. selectCardCoroutine: SelectCardCoroutine),
  71. },
  72. remainingCardsPlace: RemainingCardsPlace.Trash,
  73. activateClass: activateClass,
  74. canNoSelect: true
  75. ));
  76. IEnumerator SelectCardCoroutine(CardSource cardSource)
  77. {
  78. if (CardEffectCommons.IsExistOnBattleArea(card))
  79. {
  80. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(new List<CardSource>() { cardSource }, activateClass));
  81. }
  82. }
  83. if (CardEffectCommons.IsExistOnBattleArea(card))
  84. {
  85. if (card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => cardSource.CardNames.Contains("Vemmon")) >= 5)
  86. {
  87. int maxCount = Math.Min(1, card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition));
  88. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  89. selectPermanentEffect.SetUp(
  90. selectPlayer: card.Owner,
  91. canTargetCondition: CanSelectPermanentCondition,
  92. canTargetCondition_ByPreSelecetedList: null,
  93. canEndSelectCondition: null,
  94. maxCount: maxCount,
  95. canNoSelect: false,
  96. canEndNotMax: false,
  97. selectPermanentCoroutine: null,
  98. afterSelectPermanentCoroutine: null,
  99. mode: SelectPermanentEffect.Mode.Destroy,
  100. cardEffect: activateClass);
  101. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  102. }
  103. }
  104. }
  105. }
  106. if (timing == EffectTiming.OnAllyAttack)
  107. {
  108. ActivateClass activateClass = new ActivateClass();
  109. activateClass.SetUpICardEffect("Return 2 [Vemmon] from [Galacticmon]'s digivolution cards to the deck bottom to switch attack target to this Digimon", CanUseCondition, card);
  110. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  111. activateClass.SetIsInheritedEffect(true);
  112. activateClass.SetHashString("SwitchAttackTarget_BT11_070");
  113. cardEffects.Add(activateClass);
  114. string EffectDiscription()
  115. {
  116. return "[Opponent's Turn][Once Per Turn] When an opponent's Digimon attacks, by placing 2 [Vemmon] from 1 of your [Galacticmon]'s digivolution cards at the bottom of their owners' decks, switch the target of attack to this Digimon.";
  117. }
  118. bool CanSelectCardCondition(CardSource cardSource)
  119. {
  120. return cardSource.CardNames.Contains("Vemmon");
  121. }
  122. bool CanSelectPermanentCondition(Permanent permanent)
  123. {
  124. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  125. {
  126. if (permanent.TopCard.CardNames.Contains("Galacticmon"))
  127. {
  128. if (permanent.DigivolutionCards.Count(CanSelectCardCondition) >= 2)
  129. {
  130. return true;
  131. }
  132. }
  133. }
  134. return false;
  135. }
  136. bool PermanentCondition(Permanent permanent)
  137. {
  138. return CardEffectCommons.IsOpponentPermanent(permanent, card);
  139. }
  140. bool CanUseCondition(Hashtable hashtable)
  141. {
  142. if (CardEffectCommons.IsExistOnBattleArea(card))
  143. {
  144. if (CardEffectCommons.IsOpponentTurn(card))
  145. {
  146. if (CardEffectCommons.CanTriggerOnPermanentAttack(hashtable, PermanentCondition))
  147. {
  148. return true;
  149. }
  150. }
  151. }
  152. return false;
  153. }
  154. bool CanActivateCondition(Hashtable hashtable)
  155. {
  156. if (CardEffectCommons.IsExistOnBattleArea(card))
  157. {
  158. if (card.Owner.GetBattleAreaPermanents().Count(CanSelectPermanentCondition) >= 1)
  159. {
  160. return true;
  161. }
  162. }
  163. return false;
  164. }
  165. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  166. {
  167. Permanent selectedPermanent = null;
  168. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  169. {
  170. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  171. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  172. selectPermanentEffect.SetUp(
  173. selectPlayer: card.Owner,
  174. canTargetCondition: CanSelectPermanentCondition,
  175. canTargetCondition_ByPreSelecetedList: null,
  176. canEndSelectCondition: null,
  177. maxCount: maxCount,
  178. canNoSelect: false,
  179. canEndNotMax: false,
  180. selectPermanentCoroutine: SelectPermanentCoroutine,
  181. afterSelectPermanentCoroutine: null,
  182. mode: SelectPermanentEffect.Mode.Custom,
  183. cardEffect: activateClass);
  184. selectPermanentEffect.SetUpCustomMessage("Select 1 [Galacticmon].", "The opponent is selecting 1 [Galacticmon].");
  185. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  186. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  187. {
  188. selectedPermanent = permanent;
  189. yield return null;
  190. }
  191. }
  192. if (selectedPermanent != null)
  193. {
  194. List<CardSource> selectedCards = new List<CardSource>();
  195. if (selectedPermanent.DigivolutionCards.Count(CanSelectCardCondition) >= 2)
  196. {
  197. int maxCount = 2;
  198. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  199. selectCardEffect.SetUp(
  200. canTargetCondition: CanSelectCardCondition,
  201. canTargetCondition_ByPreSelecetedList: null,
  202. canEndSelectCondition: null,
  203. canNoSelect: () => false,
  204. selectCardCoroutine: SelectCardCoroutine,
  205. afterSelectCardCoroutine: null,
  206. message: "Select 2 [Vemmon] that will return to the bottom of deck\n(cards will be placed back to the bottom of the deck so that cards with lower numbers are on top).",
  207. maxCount: maxCount,
  208. canEndNotMax: false,
  209. isShowOpponent: true,
  210. mode: SelectCardEffect.Mode.Custom,
  211. root: SelectCardEffect.Root.Custom,
  212. customRootCardList: selectedPermanent.DigivolutionCards,
  213. canLookReverseCard: true,
  214. selectPlayer: card.Owner,
  215. cardEffect: activateClass);
  216. selectCardEffect.SetUpCustomMessage(
  217. "Select digivolution cards to return to the bottom of deck.",
  218. "The opponent is selecting digivolution cards to return to the bottom of deck.");
  219. selectCardEffect.SetNotShowCard();
  220. yield return StartCoroutine(selectCardEffect.Activate());
  221. IEnumerator SelectCardCoroutine(CardSource cardSource)
  222. {
  223. selectedCards.Add(cardSource);
  224. yield return null;
  225. }
  226. if (selectedCards.Count >= 1)
  227. {
  228. yield return ContinuousController.instance.StartCoroutine(new ReturnToLibraryBottomDigivolutionCardsClass(
  229. selectedPermanent,
  230. selectedCards,
  231. CardEffectCommons.CardEffectHashtable(activateClass)).ReturnToLibraryBottomDigivolutionCards());
  232. if (selectedCards.Count == 2 && isExistOnField(card))
  233. {
  234. yield return ContinuousController.instance.StartCoroutine(GManager.instance.attackProcess.SwitchDefender(
  235. activateClass,
  236. false,
  237. card.PermanentOfThisCard()));
  238. }
  239. }
  240. }
  241. }
  242. }
  243. }
  244. return cardEffects;
  245. }
  246. }
  247. }