BT15_059.cs 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT15
  6. {
  7. public class BT15_059 : 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. if (targetPermanent.TopCard.CardTraits.Contains("SoC"))
  17. {
  18. if (targetPermanent.TopCard.HasLevel)
  19. {
  20. if (targetPermanent.Level == 3)
  21. {
  22. return true;
  23. }
  24. }
  25. }
  26. return false;
  27. }
  28. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  29. permanentCondition: PermanentCondition,
  30. digivolutionCost: 2,
  31. ignoreDigivolutionRequirement: false,
  32. card: card,
  33. condition: null));
  34. }
  35. if (timing == EffectTiming.OnEnterFieldAnyone)
  36. {
  37. ActivateClass activateClass = new ActivateClass();
  38. activateClass.SetUpICardEffect("Place 1 card to digivolution cards to <De-Digivolve 1>", CanUseCondition, card);
  39. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  40. cardEffects.Add(activateClass);
  41. string EffectDiscription()
  42. {
  43. return "[On Play] By placing 1 [Marvin Jackson] from your hand under this Digimon as it's bottom digivolution card, [De-Digivolve 1] 1 of your opponent's Digimon.";
  44. }
  45. bool CanSelectCardCondition(CardSource cardSource)
  46. {
  47. if (cardSource.CardNames.Contains("Marvin Jackson"))
  48. {
  49. return true;
  50. }
  51. if (cardSource.CardNames.Contains("MarvinJackson"))
  52. {
  53. return true;
  54. }
  55. return false;
  56. }
  57. bool CanSelectPermanentCondition(Permanent permanent)
  58. {
  59. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  60. }
  61. bool CanUseCondition(Hashtable hashtable)
  62. {
  63. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  64. }
  65. bool CanActivateCondition(Hashtable hashtable)
  66. {
  67. if (CardEffectCommons.IsExistOnBattleArea(card))
  68. {
  69. if (card.Owner.HandCards.Count >= 1)
  70. {
  71. return true;
  72. }
  73. }
  74. return false;
  75. }
  76. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  77. {
  78. if (CardEffectCommons.IsExistOnBattleArea(card))
  79. {
  80. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  81. {
  82. List<CardSource> selectedCards = new List<CardSource>();
  83. int maxCount = 1;
  84. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  85. selectHandEffect.SetUp(
  86. selectPlayer: card.Owner,
  87. canTargetCondition: CanSelectCardCondition,
  88. canTargetCondition_ByPreSelecetedList: null,
  89. canEndSelectCondition: null,
  90. maxCount: maxCount,
  91. canNoSelect: true,
  92. canEndNotMax: false,
  93. isShowOpponent: true,
  94. selectCardCoroutine: SelectCardCoroutine,
  95. afterSelectCardCoroutine: null,
  96. mode: SelectHandEffect.Mode.Custom,
  97. cardEffect: activateClass);
  98. selectHandEffect.SetUpCustomMessage(
  99. "Select 1 card to place on bottom of digivolution cards.",
  100. "The opponent is selecting 1 card to place on bottom of digivolution cards.");
  101. selectHandEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  102. yield return StartCoroutine(selectHandEffect.Activate());
  103. IEnumerator SelectCardCoroutine(CardSource cardSource)
  104. {
  105. selectedCards.Add(cardSource);
  106. yield return null;
  107. }
  108. if (selectedCards.Count >= 1)
  109. {
  110. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(
  111. selectedCards,
  112. activateClass));
  113. Permanent selectedPermanent = null;
  114. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  115. {
  116. maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  117. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  118. selectPermanentEffect.SetUp(
  119. selectPlayer: card.Owner,
  120. canTargetCondition: CanSelectPermanentCondition,
  121. canTargetCondition_ByPreSelecetedList: null,
  122. canEndSelectCondition: null,
  123. maxCount: maxCount,
  124. canNoSelect: false,
  125. canEndNotMax: false,
  126. selectPermanentCoroutine: SelectPermanentCoroutine,
  127. afterSelectPermanentCoroutine: null,
  128. mode: SelectPermanentEffect.Mode.Custom,
  129. cardEffect: activateClass);
  130. selectPermanentEffect.SetUpCustomMessage(
  131. "Select 1 Digimon to De-Digivolve.",
  132. "The opponent is selecting 1 Digimon to De-Digivolve.");
  133. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  134. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  135. {
  136. selectedPermanent = permanent;
  137. yield return null;
  138. }
  139. if (selectedPermanent != null)
  140. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(selectedPermanent, 1, activateClass).Degeneration());
  141. }
  142. }
  143. }
  144. }
  145. }
  146. }
  147. if (timing == EffectTiming.OnEnterFieldAnyone)
  148. {
  149. ActivateClass activateClass = new ActivateClass();
  150. activateClass.SetUpICardEffect("Place 1 card to digivolution cards to <De-Digivolve 1>", CanUseCondition, card);
  151. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  152. cardEffects.Add(activateClass);
  153. string EffectDiscription()
  154. {
  155. return "[On Play] By placing 1[Marvin Jackson] from your hand under this Digimon as it's bottom digivolution card, [De-Digivolve 1] 1 of your opponent's Digimon.";
  156. }
  157. bool CanSelectCardCondition(CardSource cardSource)
  158. {
  159. if (cardSource.CardNames.Contains("Marvin Jackson"))
  160. {
  161. return true;
  162. }
  163. if (cardSource.CardNames.Contains("MarvinJackson"))
  164. {
  165. return true;
  166. }
  167. return false;
  168. }
  169. bool CanSelectPermanentCondition(Permanent permanent)
  170. {
  171. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  172. }
  173. bool CanUseCondition(Hashtable hashtable)
  174. {
  175. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  176. }
  177. bool CanActivateCondition(Hashtable hashtable)
  178. {
  179. if (CardEffectCommons.IsExistOnBattleArea(card))
  180. {
  181. if (card.Owner.HandCards.Count >= 1)
  182. {
  183. return true;
  184. }
  185. }
  186. return false;
  187. }
  188. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  189. {
  190. if (CardEffectCommons.IsExistOnBattleArea(card))
  191. {
  192. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  193. {
  194. List<CardSource> selectedCards = new List<CardSource>();
  195. int maxCount = 1;
  196. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  197. selectHandEffect.SetUp(
  198. selectPlayer: card.Owner,
  199. canTargetCondition: CanSelectCardCondition,
  200. canTargetCondition_ByPreSelecetedList: null,
  201. canEndSelectCondition: null,
  202. maxCount: maxCount,
  203. canNoSelect: true,
  204. canEndNotMax: false,
  205. isShowOpponent: true,
  206. selectCardCoroutine: SelectCardCoroutine,
  207. afterSelectCardCoroutine: null,
  208. mode: SelectHandEffect.Mode.Custom,
  209. cardEffect: activateClass);
  210. selectHandEffect.SetUpCustomMessage(
  211. "Select 1 card to place on bottom of digivolution cards.",
  212. "The opponent is selecting 1 card to place on bottom of digivolution cards.");
  213. selectHandEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  214. yield return StartCoroutine(selectHandEffect.Activate());
  215. IEnumerator SelectCardCoroutine(CardSource cardSource)
  216. {
  217. selectedCards.Add(cardSource);
  218. yield return null;
  219. }
  220. if (selectedCards.Count >= 1)
  221. {
  222. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(
  223. selectedCards,
  224. activateClass));
  225. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  226. {
  227. maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  228. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  229. selectPermanentEffect.SetUp(
  230. selectPlayer: card.Owner,
  231. canTargetCondition: CanSelectPermanentCondition,
  232. canTargetCondition_ByPreSelecetedList: null,
  233. canEndSelectCondition: null,
  234. maxCount: maxCount,
  235. canNoSelect: false,
  236. canEndNotMax: false,
  237. selectPermanentCoroutine: SelectPermanentCoroutine,
  238. afterSelectPermanentCoroutine: null,
  239. mode: SelectPermanentEffect.Mode.Custom,
  240. cardEffect: activateClass);
  241. selectPermanentEffect.SetUpCustomMessage(
  242. "Select 1 Digimon to De-Digivolve.",
  243. "The opponent is selecting 1 Digimon to De-Digivolve.");
  244. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  245. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  246. {
  247. Permanent selectedPermanent = permanent;
  248. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(selectedPermanent, 1, activateClass).Degeneration());
  249. }
  250. }
  251. }
  252. }
  253. }
  254. }
  255. }
  256. if (timing == EffectTiming.None)
  257. {
  258. cardEffects.Add(CardEffectFactory.RebootSelfStaticEffect(isInheritedEffect: true, card: card, condition: null));
  259. }
  260. return cardEffects;
  261. }
  262. }
  263. }