BT13_110.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT13
  6. {
  7. public class BT13_110 : 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.OptionSkill)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  16. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[Main] <Draw 1>. You may place 1 Digimon card from your hand as the bottom digivolution card of 1 of your [King Drasil_7D6] in the breeding area. Then, place this card in the battle area.";
  21. }
  22. bool CanSelectCardCondition(CardSource cardSource)
  23. {
  24. return cardSource.IsDigimon;
  25. }
  26. bool CanSelectPermanentCondition(Permanent permanent)
  27. {
  28. if (CardEffectCommons.IsPermanentExistsOnOwnerBreedingArea(permanent, card))
  29. {
  30. if (!permanent.IsToken)
  31. {
  32. if (permanent.TopCard.CardNames.Contains("King Drasil_7D6"))
  33. {
  34. return true;
  35. }
  36. if (permanent.TopCard.CardNames.Contains("KingDrasil_7D6"))
  37. {
  38. return true;
  39. }
  40. }
  41. }
  42. return false;
  43. }
  44. bool CanUseCondition(Hashtable hashtable)
  45. {
  46. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  47. }
  48. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  49. {
  50. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  51. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  52. {
  53. if (card.Owner.GetBreedingAreaPermanents().Count(CanSelectPermanentCondition) >= 1)
  54. {
  55. CardSource selectedCard = null;
  56. int maxCount = 1;
  57. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  58. selectHandEffect.SetUp(
  59. selectPlayer: card.Owner,
  60. canTargetCondition: CanSelectCardCondition,
  61. canTargetCondition_ByPreSelecetedList: null,
  62. canEndSelectCondition: null,
  63. maxCount: maxCount,
  64. canNoSelect: true,
  65. canEndNotMax: false,
  66. isShowOpponent: true,
  67. selectCardCoroutine: SelectCardCoroutine,
  68. afterSelectCardCoroutine: null,
  69. mode: SelectHandEffect.Mode.Custom,
  70. cardEffect: activateClass);
  71. selectHandEffect.SetUpCustomMessage(
  72. "Select 1 card to place at the bottom of digivolution cards.",
  73. "The opponent is selecting 1 card to place at the bottom of digivolution cards.");
  74. yield return StartCoroutine(selectHandEffect.Activate());
  75. IEnumerator SelectCardCoroutine(CardSource cardSource)
  76. {
  77. selectedCard = cardSource;
  78. yield return null;
  79. }
  80. if (selectedCard != null)
  81. {
  82. if (card.Owner.GetBreedingAreaPermanents().Count(CanSelectPermanentCondition) >= 1)
  83. {
  84. Permanent selectedPermanent = card.Owner.GetBreedingAreaPermanents()[0];
  85. if (CanSelectPermanentCondition(selectedPermanent))
  86. {
  87. if (selectedPermanent != null)
  88. {
  89. yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddDigivolutionCardsBottom(
  90. new List<CardSource>() { selectedCard },
  91. activateClass));
  92. }
  93. }
  94. }
  95. }
  96. }
  97. }
  98. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlaceDelayOptionCards(card: card, cardEffect: activateClass));
  99. }
  100. }
  101. if (timing == EffectTiming.OnDeclaration)
  102. {
  103. ActivateClass activateClass = new ActivateClass();
  104. activateClass.SetUpICardEffect("Play 1 Digimon from breeding area", CanUseCondition, card);
  105. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  106. cardEffects.Add(activateClass);
  107. string EffectDiscription()
  108. {
  109. return "[Main] <Delay> - Play 1 [Royal Knight] trait card from the digivolution cards of your Digimon in the breeding area without paying the cost. [On Play] effects on Digimon played by this effect don't activate, and they gain <Rush> for the turn.";
  110. }
  111. bool CanSelectPermanentCondition(Permanent permanent)
  112. {
  113. if (CardEffectCommons.IsPermanentExistsOnOwnerBreedingArea(permanent, card))
  114. {
  115. if (permanent.IsDigimon)
  116. {
  117. if (permanent.DigivolutionCards.Count(CanSelectCardCondition) >= 1)
  118. {
  119. return true;
  120. }
  121. }
  122. }
  123. return false;
  124. }
  125. bool CanSelectCardCondition(CardSource cardSource)
  126. {
  127. if (cardSource.HasRoyalKnightTraits)
  128. {
  129. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  130. {
  131. return true;
  132. }
  133. }
  134. return false;
  135. }
  136. bool CanUseCondition(Hashtable hashtable)
  137. {
  138. return CardEffectCommons.CanDeclareOptionDelayEffect(card);
  139. }
  140. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  141. {
  142. bool deleted = false;
  143. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(
  144. targetPermanents: new List<Permanent>() { card.PermanentOfThisCard() },
  145. activateClass: activateClass,
  146. successProcess: permanents => SuccessProcess(),
  147. failureProcess: null));
  148. IEnumerator SuccessProcess()
  149. {
  150. deleted = true;
  151. yield return null;
  152. }
  153. if (deleted)
  154. {
  155. if (card.Owner.GetBreedingAreaPermanents().Count(CanSelectPermanentCondition) >= 1)
  156. {
  157. Permanent selectedPermanent = card.Owner.GetBreedingAreaPermanents()[0];
  158. if (CanSelectPermanentCondition(selectedPermanent))
  159. {
  160. if (selectedPermanent != null)
  161. {
  162. if (selectedPermanent.DigivolutionCards.Count(CanSelectCardCondition) >= 1)
  163. {
  164. int maxCount = Math.Min(1, selectedPermanent.DigivolutionCards.Count(CanSelectCardCondition));
  165. List<CardSource> selectedCards = new List<CardSource>();
  166. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  167. selectCardEffect.SetUp(
  168. canTargetCondition: CanSelectCardCondition,
  169. canTargetCondition_ByPreSelecetedList: null,
  170. canEndSelectCondition: null,
  171. canNoSelect: () => false,
  172. selectCardCoroutine: SelectCardCoroutine,
  173. afterSelectCardCoroutine: null,
  174. message: "Select 1 digivolution card to play.",
  175. maxCount: maxCount,
  176. canEndNotMax: false,
  177. isShowOpponent: true,
  178. mode: SelectCardEffect.Mode.Custom,
  179. root: SelectCardEffect.Root.Custom,
  180. customRootCardList: selectedPermanent.DigivolutionCards,
  181. canLookReverseCard: true,
  182. selectPlayer: card.Owner,
  183. cardEffect: activateClass);
  184. selectCardEffect.SetUpCustomMessage(
  185. "Select 1 digivolution card to play.",
  186. "The opponent is selecting 1 digivolution card to play.");
  187. selectCardEffect.SetUpCustomMessage_ShowCard("Played Card");
  188. yield return StartCoroutine(selectCardEffect.Activate());
  189. IEnumerator SelectCardCoroutine(CardSource cardSource)
  190. {
  191. selectedCards.Add(cardSource);
  192. yield return null;
  193. }
  194. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  195. cardSources: selectedCards,
  196. activateClass: activateClass,
  197. payCost: false,
  198. isTapped: false,
  199. root: SelectCardEffect.Root.DigivolutionCards,
  200. activateETB: false));
  201. foreach (CardSource selectedCard in selectedCards)
  202. {
  203. if (CardEffectCommons.IsExistOnBattleArea(selectedCard))
  204. {
  205. selectedPermanent = selectedCard.PermanentOfThisCard();
  206. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainRush(
  207. targetPermanent: selectedPermanent,
  208. effectDuration: EffectDuration.UntilEachTurnEnd,
  209. activateClass: activateClass));
  210. }
  211. }
  212. }
  213. }
  214. }
  215. }
  216. }
  217. }
  218. }
  219. if (timing == EffectTiming.SecuritySkill)
  220. {
  221. cardEffects.Add(CardEffectFactory.PlaceSelfDelayOptionSecurityEffect(card));
  222. }
  223. return cardEffects;
  224. }
  225. }
  226. }