BT16_088.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT16
  5. {
  6. public class BT16_088 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. if (timing == EffectTiming.SecuritySkill)
  12. {
  13. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  14. }
  15. #region Start of Main Phase
  16. if (timing == EffectTiming.OnStartMainPhase)
  17. {
  18. ActivateClass activateClass = new ActivateClass();
  19. activateClass.SetUpICardEffect("Play 1 [Armadillomon] or [Patamon]", CanUseCondition, card);
  20. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  21. cardEffects.Add(activateClass);
  22. string EffectDiscription()
  23. {
  24. return "[Start of Your Main Phase] You may play 1 [Armadillomon] or [Patamon] from your hand without paying the cost. At the next time your opponent's turn ends, return that Digimon to the hand.";
  25. }
  26. bool CanSelectCardCondition(CardSource cardSource)
  27. {
  28. if (cardSource.CardNames.Contains("Armadillomon") || cardSource.CardNames.Contains("Patamon"))
  29. {
  30. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  31. {
  32. return true;
  33. }
  34. }
  35. return false;
  36. }
  37. bool CanUseCondition(Hashtable hashtable)
  38. {
  39. return CardEffectCommons.IsOwnerTurn(card);
  40. }
  41. bool CanActivateCondition(Hashtable hashtable)
  42. {
  43. if (CardEffectCommons.IsExistOnBattleArea(card))
  44. {
  45. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  46. {
  47. return true;
  48. }
  49. }
  50. return false;
  51. }
  52. IEnumerator ActivateCoroutine(Hashtable hashtable)
  53. {
  54. List<CardSource> selectedCards = new List<CardSource>();
  55. int maxCount = 1;
  56. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  57. selectHandEffect.SetUp(
  58. selectPlayer: card.Owner,
  59. canTargetCondition: CanSelectCardCondition,
  60. canTargetCondition_ByPreSelecetedList: null,
  61. canEndSelectCondition: null,
  62. maxCount: maxCount,
  63. canNoSelect: true,
  64. canEndNotMax: false,
  65. isShowOpponent: true,
  66. selectCardCoroutine: SelectCardCoroutine,
  67. afterSelectCardCoroutine: null,
  68. mode: SelectHandEffect.Mode.Custom,
  69. cardEffect: activateClass);
  70. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  71. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  72. yield return StartCoroutine(selectHandEffect.Activate());
  73. IEnumerator SelectCardCoroutine(CardSource cardSource)
  74. {
  75. selectedCards.Add(cardSource);
  76. yield return null;
  77. }
  78. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  79. cardSources: selectedCards,
  80. activateClass: activateClass,
  81. payCost: false,
  82. isTapped: false,
  83. root: SelectCardEffect.Root.Hand,
  84. activateETB: true));
  85. if (selectedCards.Count > 0)
  86. {
  87. Permanent selectedPermanent = selectedCards[0].PermanentOfThisCard();
  88. ActivateClass activateClass1 = new ActivateClass();
  89. activateClass1.SetUpICardEffect("Return this Digimon to the hand", CanUseCondition1, selectedPermanent.TopCard);
  90. activateClass1.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine1, -1, false, EffectDiscription1());
  91. activateClass1.SetEffectSourcePermanent(selectedPermanent);
  92. selectedPermanent.UntilOpponentTurnEndEffects.Add(GetCardEffect);
  93. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  94. {
  95. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
  96. }
  97. string EffectDiscription1()
  98. {
  99. return "[End of Opponent's Turn] Return this Digimon to the hand.";
  100. }
  101. bool CanUseCondition1(Hashtable hashtable1)
  102. {
  103. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  104. {
  105. if (GManager.instance.turnStateMachine.gameContext.TurnPlayer != selectedPermanent.TopCard.Owner)
  106. {
  107. return true;
  108. }
  109. }
  110. return false;
  111. }
  112. bool CanActivateCondition1(Hashtable hashtable1)
  113. {
  114. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  115. {
  116. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  117. {
  118. return true;
  119. }
  120. }
  121. return false;
  122. }
  123. IEnumerator ActivateCoroutine1(Hashtable _hashtable1)
  124. {
  125. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  126. {
  127. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.BouncePeremanentAndProcessAccordingToResult(
  128. targetPermanents: new List<Permanent>() { selectedPermanent },
  129. activateClass: activateClass1,
  130. successProcess: null,
  131. failureProcess: null));
  132. }
  133. }
  134. ICardEffect GetCardEffect(EffectTiming _timing)
  135. {
  136. if (_timing == EffectTiming.OnEndTurn)
  137. {
  138. return activateClass1;
  139. }
  140. return null;
  141. }
  142. }
  143. }
  144. }
  145. #endregion
  146. #region Your Turn - When you Digivolve
  147. if (timing == EffectTiming.OnEnterFieldAnyone)
  148. {
  149. ActivateClass activateClass = new ActivateClass();
  150. activateClass.SetUpICardEffect("+1 Memory", CanUseCondition, card);
  151. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  152. cardEffects.Add(activateClass);
  153. string EffectDiscription()
  154. {
  155. return "[Your Turn] When one of your Digimon digivolves into a black or yellow Digimon, by suspending this Tamer, gain 1 memory. If DNA digivolving, <De-Digivolve 1> 1 of your opponent's Digimon.";
  156. }
  157. bool PermanentCondition(Permanent permanent, Hashtable hashtable)
  158. {
  159. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  160. {
  161. if (permanent.TopCard.CardColors.Contains(CardColor.Black))
  162. {
  163. return true;
  164. }
  165. if (permanent.TopCard.CardColors.Contains(CardColor.Yellow))
  166. {
  167. return true;
  168. }
  169. }
  170. return false;
  171. }
  172. bool CanSelectPermanentCondition(Permanent permanent)
  173. {
  174. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  175. {
  176. return true;
  177. }
  178. return false;
  179. }
  180. bool CanUseCondition(Hashtable hashtable)
  181. {
  182. if (CardEffectCommons.IsExistOnBattleArea(card))
  183. {
  184. if (CardEffectCommons.IsOwnerTurn(card))
  185. {
  186. if (CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, permanent => PermanentCondition(permanent, hashtable)))
  187. {
  188. return true;
  189. }
  190. }
  191. }
  192. return false;
  193. }
  194. bool CanActivateCondition(Hashtable hashtable)
  195. {
  196. if (CardEffectCommons.IsExistOnBattleArea(card))
  197. {
  198. if (CardEffectCommons.CanActivateSuspendCostEffect(card))
  199. {
  200. return true;
  201. }
  202. }
  203. return false;
  204. }
  205. IEnumerator ActivateCoroutine(Hashtable hashtable)
  206. {
  207. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  208. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  209. if (CardEffectCommons.IsJogress(hashtable))
  210. {
  211. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  212. selectPermanentEffect.SetUp(
  213. selectPlayer: card.Owner,
  214. canTargetCondition: CanSelectPermanentCondition,
  215. canTargetCondition_ByPreSelecetedList: null,
  216. canEndSelectCondition: null,
  217. maxCount: 1,
  218. canNoSelect: false,
  219. canEndNotMax: false,
  220. selectPermanentCoroutine: SelectPermanentCoroutine,
  221. afterSelectPermanentCoroutine: null,
  222. mode: SelectPermanentEffect.Mode.Custom,
  223. cardEffect: activateClass);
  224. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to De-Digivolve.", "The opponent is selecting 1 Digimon to De-Digivolve.");
  225. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  226. }
  227. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  228. {
  229. if (permanent != null)
  230. {
  231. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  232. {
  233. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(
  234. permanent: permanent,
  235. DegenerationCount: 1,
  236. cardEffect: activateClass).Degeneration());
  237. }
  238. }
  239. }
  240. }
  241. }
  242. #endregion
  243. return cardEffects;
  244. }
  245. }
  246. }