BT11_095.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT11
  5. {
  6. public class BT11_095 : 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.OnStartMainPhase)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Place a card under this Tamer from hand to gain Memory +1 and Draw 1", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[Start of Your Main Phase] By placing 1 Digimon card with [Xros Heart] or [Blue Flare] in its traits from your hand under this Tamer, gain 1 memory and <Draw 1>.";
  20. }
  21. bool CanSelectCardCondition(CardSource cardSource)
  22. {
  23. if (cardSource != null)
  24. {
  25. if (cardSource.Owner == card.Owner)
  26. {
  27. if (cardSource.IsDigimon)
  28. {
  29. if (cardSource.CardTraits.Contains("Xros Heart"))
  30. {
  31. return true;
  32. }
  33. if (cardSource.CardTraits.Contains("XrosHeart"))
  34. {
  35. return true;
  36. }
  37. if (cardSource.CardTraits.Contains("Blue Flare"))
  38. {
  39. return true;
  40. }
  41. if (cardSource.CardTraits.Contains("BlueFlare"))
  42. {
  43. return true;
  44. }
  45. }
  46. }
  47. }
  48. return false;
  49. }
  50. bool CanUseCondition(Hashtable hashtable)
  51. {
  52. if (CardEffectCommons.IsExistOnBattleArea(card))
  53. {
  54. if (CardEffectCommons.IsOwnerTurn(card))
  55. {
  56. return true;
  57. }
  58. }
  59. return false;
  60. }
  61. bool CanActivateCondition(Hashtable hashtable)
  62. {
  63. if (isExistOnField(card))
  64. {
  65. if (card.Owner.GetBattleAreaPermanents().Contains(card.PermanentOfThisCard()))
  66. {
  67. if (card.Owner.HandCards.Count >= 1)
  68. {
  69. return true;
  70. }
  71. }
  72. }
  73. return false;
  74. }
  75. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  76. {
  77. if (isExistOnField(card))
  78. {
  79. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  80. {
  81. bool placed = false;
  82. int maxCount = 1;
  83. List<CardSource> selectedCards = new List<CardSource>();
  84. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  85. selectHandEffect.SetUp(
  86. selectPlayer: card.Owner,
  87. canTargetCondition: CanSelectCardCondition,
  88. canTargetCondition_ByPreSelecetedList: null,
  89. canEndSelectCondition: CanEndSelectCondition,
  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("Select 1 card to place in Digivolution cards.", "The opponent is selecting 1 card to place in Digivolution cards.");
  99. selectHandEffect.SetNotShowCard();
  100. yield return StartCoroutine(selectHandEffect.Activate());
  101. bool CanEndSelectCondition(List<CardSource> cardSources)
  102. {
  103. if (maxCount >= 1)
  104. {
  105. if (cardSources.Count <= 0)
  106. {
  107. return false;
  108. }
  109. }
  110. return true;
  111. }
  112. IEnumerator SelectCardCoroutine(CardSource cardSource)
  113. {
  114. selectedCards.Add(cardSource);
  115. yield return null;
  116. }
  117. if (selectedCards.Count >= 1)
  118. {
  119. if (!card.PermanentOfThisCard().IsToken)
  120. {
  121. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(selectedCards, activateClass));
  122. placed = true;
  123. }
  124. }
  125. if (placed)
  126. {
  127. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  128. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  129. }
  130. }
  131. }
  132. }
  133. }
  134. if (timing == EffectTiming.BeforePayCost)
  135. {
  136. ActivateClass activateClass = new ActivateClass();
  137. activateClass.SetUpICardEffect("Can select DigiXros cards from Tamer's digivolution cards", CanUseCondition, card);
  138. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  139. activateClass.SetHashString("CanSelectDigiXrosFromTamer_BT10_088");
  140. cardEffects.Add(activateClass);
  141. string EffectDiscription()
  142. {
  143. return "[Your Turn] When you play 1 Digimon with DigiXros requirements, by suspending this Tamer, you may place cards from under one of your Tamers as digivolution cards for a DigiXros.";
  144. }
  145. bool CardCondition(CardSource cardSource)
  146. {
  147. if (cardSource.Owner == card.Owner)
  148. {
  149. if (cardSource.IsDigimon)
  150. {
  151. if (cardSource.HasDigiXros)
  152. {
  153. return true;
  154. }
  155. }
  156. }
  157. return false;
  158. }
  159. bool CanUseCondition(Hashtable hashtable)
  160. {
  161. if (CardEffectCommons.IsExistOnBattleArea(card))
  162. {
  163. if (CardEffectCommons.IsOwnerTurn(card))
  164. {
  165. if (CardEffectCommons.CanTriggerWhenPermanentWouldPlay(hashtable, CardCondition))
  166. {
  167. if (CardEffectCommons.IsOnly1CardPlayed(hashtable))
  168. {
  169. return true;
  170. }
  171. }
  172. }
  173. }
  174. return false;
  175. }
  176. bool CanActivateCondition(Hashtable hashtable)
  177. {
  178. if (CardEffectCommons.IsExistOnBattleArea(card))
  179. {
  180. if (CardEffectCommons.CanActivateSuspendCostEffect(card))
  181. {
  182. return true;
  183. }
  184. }
  185. return false;
  186. }
  187. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  188. {
  189. if (isExistOnField(card))
  190. {
  191. if (!card.PermanentOfThisCard().IsSuspended && card.PermanentOfThisCard().CanSuspend)
  192. {
  193. Hashtable hashtable = new Hashtable();
  194. hashtable.Add("CardEffect", activateClass);
  195. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, hashtable).Tap());
  196. ContinuousController.instance.PlaySE(GManager.instance.GetComponent<Effects>().BuffSE);
  197. AddMaxUnderTamerCountDigiXrosClass addMaxTamerCountDigiXrosClass = new AddMaxUnderTamerCountDigiXrosClass();
  198. addMaxTamerCountDigiXrosClass.SetUpICardEffect("Can select DigiXros cards from Tamer's digivolution cards", CanUseCondition1, card);
  199. addMaxTamerCountDigiXrosClass.SetUpAddMaxUnderTamerCountDigiXrosClass(getMaxUnderTamerCount: GetCount);
  200. card.Owner.UntilCalculateFixedCostEffect.Add((_timing) => addMaxTamerCountDigiXrosClass);
  201. bool CanUseCondition1(Hashtable hashtable)
  202. {
  203. return true;
  204. }
  205. int GetCount(CardSource cardSource)
  206. {
  207. if (CardSourceCondition(cardSource))
  208. {
  209. return 100;
  210. }
  211. return 0;
  212. }
  213. bool CardSourceCondition(CardSource cardSource)
  214. {
  215. if (cardSource != null)
  216. {
  217. if (cardSource.Owner == card.Owner)
  218. {
  219. if (cardSource.HasDigiXros)
  220. {
  221. return true;
  222. }
  223. }
  224. }
  225. return false;
  226. }
  227. }
  228. }
  229. }
  230. }
  231. if (timing == EffectTiming.SecuritySkill)
  232. {
  233. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  234. }
  235. return cardEffects;
  236. }
  237. }
  238. }