DavisMotomiyaAndKenIchijoji_BT16_085.cs 13 KB

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