BT11_085.cs 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  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_085 : 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.OnEnterFieldAnyone)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("Play 1 digivolution card", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[On Play] You may play 1 purple or blue level 3 Digimon card from 1 of your purple or blue Digimon's digivolution cards without paying the cost.";
  21. }
  22. bool CanSelectPermanentCondition(Permanent permanent)
  23. {
  24. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  25. {
  26. if (permanent.DigivolutionCards.Count(CanSelectCardCondition) >= 1)
  27. {
  28. if (permanent.TopCard.CardColors.Contains(CardColor.Purple) || permanent.TopCard.CardColors.Contains(CardColor.Blue))
  29. {
  30. return true;
  31. }
  32. }
  33. }
  34. return false;
  35. }
  36. bool CanSelectCardCondition(CardSource cardSource)
  37. {
  38. if (cardSource.IsDigimon)
  39. {
  40. if (cardSource.HasCardColor(CardColor.Purple) || cardSource.HasCardColor(CardColor.Blue))
  41. {
  42. if (cardSource.Level == 3)
  43. {
  44. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  45. {
  46. if (cardSource.HasLevel)
  47. {
  48. return true;
  49. }
  50. }
  51. }
  52. }
  53. }
  54. return false;
  55. }
  56. bool CanUseCondition(Hashtable hashtable)
  57. {
  58. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  59. }
  60. bool CanActivateCondition(Hashtable hashtable)
  61. {
  62. if (CardEffectCommons.IsExistOnBattleArea(card))
  63. {
  64. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  65. {
  66. return true;
  67. }
  68. }
  69. return false;
  70. }
  71. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  72. {
  73. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  74. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  75. selectPermanentEffect.SetUp(
  76. selectPlayer: card.Owner,
  77. canTargetCondition: CanSelectPermanentCondition,
  78. canTargetCondition_ByPreSelecetedList: null,
  79. canEndSelectCondition: null,
  80. maxCount: maxCount,
  81. canNoSelect: true,
  82. canEndNotMax: false,
  83. selectPermanentCoroutine: SelectPermanentCoroutine,
  84. afterSelectPermanentCoroutine: null,
  85. mode: SelectPermanentEffect.Mode.Custom,
  86. cardEffect: activateClass);
  87. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that has digivolution cards.", "The opponent is selecting 1 Digimon that has digivolution cards.");
  88. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  89. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  90. {
  91. Permanent selectedPermanent = permanent;
  92. if (selectedPermanent != null)
  93. {
  94. if (selectedPermanent.DigivolutionCards.Count(CanSelectCardCondition) >= 1)
  95. {
  96. maxCount = Math.Min(1, selectedPermanent.DigivolutionCards.Count(CanSelectCardCondition));
  97. List<CardSource> selectedCards = new List<CardSource>();
  98. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  99. selectCardEffect.SetUp(
  100. canTargetCondition: CanSelectCardCondition,
  101. canTargetCondition_ByPreSelecetedList: null,
  102. canEndSelectCondition: null,
  103. canNoSelect: () => true,
  104. selectCardCoroutine: SelectCardCoroutine,
  105. afterSelectCardCoroutine: null,
  106. message: "Select 1 digivolution card to play.",
  107. maxCount: maxCount,
  108. canEndNotMax: false,
  109. isShowOpponent: true,
  110. mode: SelectCardEffect.Mode.Custom,
  111. root: SelectCardEffect.Root.Custom,
  112. customRootCardList: selectedPermanent.DigivolutionCards,
  113. canLookReverseCard: true,
  114. selectPlayer: card.Owner,
  115. cardEffect: activateClass);
  116. selectCardEffect.SetUpCustomMessage("Select 1 digivolution card to play.", "The opponent is selecting 1 digivolution card to play.");
  117. selectCardEffect.SetUpCustomMessage_ShowCard("Played Card");
  118. yield return StartCoroutine(selectCardEffect.Activate());
  119. IEnumerator SelectCardCoroutine(CardSource cardSource)
  120. {
  121. selectedCards.Add(cardSource);
  122. yield return null;
  123. }
  124. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.DigivolutionCards, activateETB: true));
  125. }
  126. }
  127. }
  128. }
  129. }
  130. if (timing == EffectTiming.OnEnterFieldAnyone)
  131. {
  132. ActivateClass activateClass = new ActivateClass();
  133. activateClass.SetUpICardEffect("Play 1 digivolution card", CanUseCondition, card);
  134. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  135. cardEffects.Add(activateClass);
  136. string EffectDiscription()
  137. {
  138. return "[When Digivolving] You may play 1 purple or blue level 3 Digimon card from 1 of your purple or blue Digimon's digivolution cards without paying the cost.";
  139. }
  140. bool CanSelectPermanentCondition(Permanent permanent)
  141. {
  142. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  143. {
  144. if (permanent.DigivolutionCards.Count(CanSelectCardCondition) >= 1)
  145. {
  146. if (permanent.TopCard.CardColors.Contains(CardColor.Purple) || permanent.TopCard.CardColors.Contains(CardColor.Blue))
  147. {
  148. return true;
  149. }
  150. }
  151. }
  152. return false;
  153. }
  154. bool CanSelectCardCondition(CardSource cardSource)
  155. {
  156. if (cardSource.IsDigimon)
  157. {
  158. if (cardSource.HasCardColor(CardColor.Purple) || cardSource.HasCardColor(CardColor.Blue))
  159. {
  160. if (cardSource.Level == 3)
  161. {
  162. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  163. {
  164. if (cardSource.HasLevel)
  165. {
  166. return true;
  167. }
  168. }
  169. }
  170. }
  171. }
  172. return false;
  173. }
  174. bool CanUseCondition(Hashtable hashtable)
  175. {
  176. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  177. }
  178. bool CanActivateCondition(Hashtable hashtable)
  179. {
  180. if (CardEffectCommons.IsExistOnBattleArea(card))
  181. {
  182. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  183. {
  184. return true;
  185. }
  186. }
  187. return false;
  188. }
  189. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  190. {
  191. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  192. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  193. selectPermanentEffect.SetUp(
  194. selectPlayer: card.Owner,
  195. canTargetCondition: CanSelectPermanentCondition,
  196. canTargetCondition_ByPreSelecetedList: null,
  197. canEndSelectCondition: null,
  198. maxCount: maxCount,
  199. canNoSelect: true,
  200. canEndNotMax: false,
  201. selectPermanentCoroutine: SelectPermanentCoroutine,
  202. afterSelectPermanentCoroutine: null,
  203. mode: SelectPermanentEffect.Mode.Custom,
  204. cardEffect: activateClass);
  205. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that has digivolution cards.", "The opponent is selecting 1 Digimon that has digivolution cards.");
  206. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  207. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  208. {
  209. Permanent selectedPermanent = permanent;
  210. if (selectedPermanent != null)
  211. {
  212. if (selectedPermanent.DigivolutionCards.Count(CanSelectCardCondition) >= 1)
  213. {
  214. maxCount = Math.Min(1, selectedPermanent.DigivolutionCards.Count(CanSelectCardCondition));
  215. List<CardSource> selectedCards = new List<CardSource>();
  216. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  217. selectCardEffect.SetUp(
  218. canTargetCondition: CanSelectCardCondition,
  219. canTargetCondition_ByPreSelecetedList: null,
  220. canEndSelectCondition: null,
  221. canNoSelect: () => true,
  222. selectCardCoroutine: SelectCardCoroutine,
  223. afterSelectCardCoroutine: null,
  224. message: "Select 1 digivolution card to play.",
  225. maxCount: maxCount,
  226. canEndNotMax: false,
  227. isShowOpponent: true,
  228. mode: SelectCardEffect.Mode.Custom,
  229. root: SelectCardEffect.Root.Custom,
  230. customRootCardList: selectedPermanent.DigivolutionCards,
  231. canLookReverseCard: true,
  232. selectPlayer: card.Owner,
  233. cardEffect: activateClass);
  234. selectCardEffect.SetUpCustomMessage("Select 1 digivolution card to play.", "The opponent is selecting 1 digivolution card to play.");
  235. selectCardEffect.SetUpCustomMessage_ShowCard("Played Card");
  236. yield return StartCoroutine(selectCardEffect.Activate());
  237. IEnumerator SelectCardCoroutine(CardSource cardSource)
  238. {
  239. selectedCards.Add(cardSource);
  240. yield return null;
  241. }
  242. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.DigivolutionCards, activateETB: true));
  243. }
  244. }
  245. }
  246. }
  247. }
  248. if (timing == EffectTiming.OnEnterFieldAnyone)
  249. {
  250. ActivateClass activateClass = new ActivateClass();
  251. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  252. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  253. activateClass.SetIsInheritedEffect(true);
  254. activateClass.SetHashString("Memory+1_BT11_085");
  255. cardEffects.Add(activateClass);
  256. string EffectDiscription()
  257. {
  258. return "[All Turns][Once Per Turn] When you play a Digimon by an effect, gain 1 memory.";
  259. }
  260. bool CanUseCondition(Hashtable hashtable)
  261. {
  262. if (CardEffectCommons.IsExistOnBattleArea(card))
  263. {
  264. if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, (permanent) => CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)))
  265. {
  266. if (CardEffectCommons.IsByEffect(hashtable, null))
  267. {
  268. return true;
  269. }
  270. }
  271. }
  272. return false;
  273. }
  274. bool CanActivateCondition(Hashtable hashtable)
  275. {
  276. if (CardEffectCommons.IsExistOnBattleArea(card))
  277. {
  278. return true;
  279. }
  280. return false;
  281. }
  282. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  283. {
  284. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  285. }
  286. }
  287. return cardEffects;
  288. }
  289. }
  290. }