BT16_084.cs 13 KB

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