BT12_089.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT12
  4. {
  5. public class BT12_089 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. if (timing == EffectTiming.OnStartTurn)
  11. {
  12. cardEffects.Add(CardEffectFactory.SetMemoryTo3TamerEffect(card));
  13. }
  14. if (timing == EffectTiming.OnDeclaration)
  15. {
  16. ActivateClass activateClass = new ActivateClass();
  17. activateClass.SetUpICardEffect("Digivolve your [Guilmon] into [Gallantmon]", CanUseCondition, card);
  18. activateClass.SetUpActivateClass(null, ActivateCoroutine, 1, false, EffectDiscription());
  19. activateClass.SetHashString("Digivolution_BT12_0898");
  20. cardEffects.Add(activateClass);
  21. string EffectDiscription()
  22. {
  23. return "[Main][Once Per Turn] By placing this Tamer along with 1 each of [Growlmon] and [WarGrowlmon] from your trash under one of your [Guilmon] in any order as its bottom digivolution cards, you may digivolve that Digimon into a [Gallantmon] in your hand for its cost, ignoring its level. The Digimon that digivolved with this effect gets +2000 DP for the turn.";
  24. }
  25. bool CanSelectPermanentCondition(Permanent permanent)
  26. {
  27. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  28. {
  29. if (permanent.TopCard.CardNames.Contains("Guilmon"))
  30. {
  31. if (!permanent.IsToken)
  32. {
  33. return true;
  34. }
  35. }
  36. }
  37. return false;
  38. }
  39. bool CanSelectCardCondition(CardSource cardSource)
  40. {
  41. return cardSource.CardNames.Contains("Growlmon");
  42. }
  43. bool CanSelectCardCondition1(CardSource cardSource)
  44. {
  45. return cardSource.CardNames.Contains("WarGrowlmon");
  46. }
  47. bool CanSelectCardCondition2(CardSource cardSource)
  48. {
  49. return cardSource.CardNames.Contains("Gallantmon");
  50. }
  51. bool CanUseCondition(Hashtable hashtable)
  52. {
  53. if (CardEffectCommons.IsExistOnBattleArea(card))
  54. {
  55. if (!card.PermanentOfThisCard().IsToken)
  56. {
  57. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  58. {
  59. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  60. {
  61. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition1))
  62. {
  63. return true;
  64. }
  65. }
  66. }
  67. }
  68. }
  69. return false;
  70. }
  71. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  72. {
  73. if (CardEffectCommons.IsExistOnBattleArea(card))
  74. {
  75. List<CardSource> selectedCards = new List<CardSource>() { card };
  76. bool added = false;
  77. Permanent selectedPermanent = null;
  78. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  79. {
  80. int maxCount = 1;
  81. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  82. selectCardEffect.SetUp(
  83. canTargetCondition: CanSelectCardCondition,
  84. canTargetCondition_ByPreSelecetedList: null,
  85. canEndSelectCondition: null,
  86. canNoSelect: () => false,
  87. selectCardCoroutine: SelectCardCoroutine,
  88. afterSelectCardCoroutine: null,
  89. message: "Select 1 [Growlmon] to place in Digivolution cards.",
  90. maxCount: maxCount,
  91. canEndNotMax: false,
  92. isShowOpponent: true,
  93. mode: SelectCardEffect.Mode.Custom,
  94. root: SelectCardEffect.Root.Trash,
  95. customRootCardList: null,
  96. canLookReverseCard: true,
  97. selectPlayer: card.Owner,
  98. cardEffect: activateClass);
  99. selectCardEffect.SetUpCustomMessage("Select 1 [Growlmon] to place in Digivolution cards.", "The opponent is selecting 1 [Growlmon] to place in Digivolution cards.");
  100. selectCardEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  101. yield return StartCoroutine(selectCardEffect.Activate());
  102. IEnumerator SelectCardCoroutine(CardSource cardSource)
  103. {
  104. selectedCards.Add(cardSource);
  105. yield return null;
  106. }
  107. }
  108. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition1))
  109. {
  110. int maxCount = 1;
  111. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  112. selectCardEffect.SetUp(
  113. canTargetCondition: CanSelectCardCondition1,
  114. canTargetCondition_ByPreSelecetedList: null,
  115. canEndSelectCondition: null,
  116. canNoSelect: () => false,
  117. selectCardCoroutine: SelectCardCoroutine,
  118. afterSelectCardCoroutine: null,
  119. message: "Select 1 [WarGrowlmon] to place in Digivolution cards.",
  120. maxCount: maxCount,
  121. canEndNotMax: false,
  122. isShowOpponent: true,
  123. mode: SelectCardEffect.Mode.Custom,
  124. root: SelectCardEffect.Root.Trash,
  125. customRootCardList: null,
  126. canLookReverseCard: true,
  127. selectPlayer: card.Owner,
  128. cardEffect: activateClass);
  129. selectCardEffect.SetUpCustomMessage("Select 1 [WarGrowlmon] to place in Digivolution cards.", "The opponent is selecting 1 [WarGrowlmon] to place in Digivolution cards.");
  130. selectCardEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  131. yield return StartCoroutine(selectCardEffect.Activate());
  132. IEnumerator SelectCardCoroutine(CardSource cardSource)
  133. {
  134. selectedCards.Add(cardSource);
  135. yield return null;
  136. }
  137. }
  138. if (selectedCards.Count == 3)
  139. {
  140. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  141. {
  142. int maxCount = 1;
  143. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  144. selectPermanentEffect.SetUp(
  145. selectPlayer: card.Owner,
  146. canTargetCondition: CanSelectPermanentCondition,
  147. canTargetCondition_ByPreSelecetedList: null,
  148. canEndSelectCondition: null,
  149. maxCount: maxCount,
  150. canNoSelect: false,
  151. canEndNotMax: false,
  152. selectPermanentCoroutine: SelectPermanentCoroutine,
  153. afterSelectPermanentCoroutine: null,
  154. mode: SelectPermanentEffect.Mode.Custom,
  155. cardEffect: activateClass);
  156. selectPermanentEffect.SetUpCustomMessage("Select 1 [Guilmon].", "The opponent is selecting 1 [Guilmon].");
  157. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  158. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  159. {
  160. selectedPermanent = permanent;
  161. yield return null;
  162. }
  163. }
  164. if (selectedPermanent != null)
  165. {
  166. if (selectedCards.Count == 3)
  167. {
  168. List<CardSource> digivolutionCards = new List<CardSource>();
  169. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  170. selectCardEffect.SetUp(
  171. canTargetCondition: (cardSource) => true,
  172. canTargetCondition_ByPreSelecetedList: null,
  173. canEndSelectCondition: null,
  174. canNoSelect: () => false,
  175. selectCardCoroutine: null,
  176. afterSelectCardCoroutine: AfterSelectCardCoroutine1,
  177. message: "Specify the order to place the cards in the digivolution cards\n(cards will be placed so that cards with lower numbers are on top).",
  178. maxCount: selectedCards.Count,
  179. canEndNotMax: false,
  180. isShowOpponent: false,
  181. mode: SelectCardEffect.Mode.Custom,
  182. root: SelectCardEffect.Root.Custom,
  183. customRootCardList: selectedCards,
  184. canLookReverseCard: true,
  185. selectPlayer: card.Owner,
  186. cardEffect: activateClass);
  187. selectCardEffect.SetUpCustomMessage_ShowCard("Digivolution Cards");
  188. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  189. IEnumerator AfterSelectCardCoroutine1(List<CardSource> cardSources)
  190. {
  191. digivolutionCards = cardSources.Clone();
  192. yield return null;
  193. }
  194. if (selectedPermanent.TopCard != null)
  195. {
  196. yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddDigivolutionCardsBottom(digivolutionCards, activateClass));
  197. added = true;
  198. }
  199. }
  200. }
  201. }
  202. if (added)
  203. {
  204. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  205. targetPermanent: selectedPermanent,
  206. cardCondition: CanSelectCardCondition2,
  207. payCost: true,
  208. reduceCostTuple: null,
  209. fixedCostTuple: null,
  210. ignoreDigivolutionRequirementFixedCost: -1,
  211. isHand: true,
  212. activateClass: activateClass,
  213. successProcess: SuccessProcess(),
  214. ignoreRequirements: CardEffectCommons.IgnoreRequirement.Level));
  215. IEnumerator SuccessProcess()
  216. {
  217. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  218. targetPermanent: selectedPermanent,
  219. changeValue: 2000,
  220. effectDuration: EffectDuration.UntilEachTurnEnd,
  221. activateClass: activateClass));
  222. }
  223. }
  224. }
  225. }
  226. }
  227. if (timing == EffectTiming.SecuritySkill)
  228. {
  229. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  230. }
  231. return cardEffects;
  232. }
  233. }
  234. }