BT11_109.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  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_109 : 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] You may place up to 3 Digimon cards with [Bagra Army] in their traits from your trash under 1 of your Digimon as its bottom digivolution cards or under 1 of your Tamers. Then, if you have a Digimon or Tamer with [Bagra Army] in its traits in play, place 1 of your opponent's Digimon under 1 of your opponent's other Digimon as its bottom digivolution card.";
  21. }
  22. bool CanSelectCardCondition(CardSource cardSource)
  23. {
  24. if (cardSource.CardTraits.Contains("Bagra Army") || cardSource.CardTraits.Contains("BagraArmy"))
  25. {
  26. if (cardSource.IsDigimon)
  27. {
  28. return true;
  29. }
  30. }
  31. return false;
  32. }
  33. bool CanSelectPermanentCondition(Permanent permanent)
  34. {
  35. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  36. {
  37. if (!permanent.IsToken)
  38. {
  39. if (permanent.IsTamer)
  40. {
  41. return true;
  42. }
  43. if (permanent.IsDigimon)
  44. {
  45. return true;
  46. }
  47. }
  48. }
  49. return false;
  50. }
  51. bool CanSelectPermanentCondition1(Permanent permanent)
  52. {
  53. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  54. }
  55. bool CanUseCondition(Hashtable hashtable)
  56. {
  57. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  58. }
  59. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  60. {
  61. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  62. {
  63. List<CardSource> selectedCards = new List<CardSource>();
  64. int maxCount = Math.Min(3, card.Owner.TrashCards.Count(CanSelectCardCondition));
  65. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  66. selectCardEffect.SetUp(
  67. canTargetCondition: CanSelectCardCondition,
  68. canTargetCondition_ByPreSelecetedList: null,
  69. canEndSelectCondition: CanEndSelectCondition,
  70. canNoSelect: () => true,
  71. selectCardCoroutine: SelectCardCoroutine,
  72. afterSelectCardCoroutine: null,
  73. message: "Select Digimon cards with [Bagra Army] in their traits\n(cards will be placed so that cards with lower numbers are on top).",
  74. maxCount: maxCount,
  75. canEndNotMax: true,
  76. isShowOpponent: true,
  77. mode: SelectCardEffect.Mode.Custom,
  78. root: SelectCardEffect.Root.Trash,
  79. customRootCardList: null,
  80. canLookReverseCard: true,
  81. selectPlayer: card.Owner,
  82. cardEffect: activateClass);
  83. selectCardEffect.SetUpCustomMessage("Select Digimon cards with [Bagra Army] in their traits to place at the bottom of digivolution cards.", "The opponent is selecting Digimon cards with [Bagra Army] in their traits to place at the bottom of digivolution cards.");
  84. yield return StartCoroutine(selectCardEffect.Activate());
  85. bool CanEndSelectCondition(List<CardSource> cardSources)
  86. {
  87. if (CardEffectCommons.HasNoElement(cardSources))
  88. {
  89. return false;
  90. }
  91. return true;
  92. }
  93. IEnumerator SelectCardCoroutine(CardSource cardSource)
  94. {
  95. selectedCards.Add(cardSource);
  96. yield return null;
  97. }
  98. if (selectedCards.Count >= 1)
  99. {
  100. maxCount = 1;
  101. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  102. selectPermanentEffect.SetUp(
  103. selectPlayer: card.Owner,
  104. canTargetCondition: CanSelectPermanentCondition,
  105. canTargetCondition_ByPreSelecetedList: null,
  106. canEndSelectCondition: null,
  107. maxCount: maxCount,
  108. canNoSelect: true,
  109. canEndNotMax: false,
  110. selectPermanentCoroutine: SelectPermanentCoroutine,
  111. afterSelectPermanentCoroutine: null,
  112. mode: SelectPermanentEffect.Mode.Custom,
  113. cardEffect: activateClass);
  114. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon or Tamer that will get a digivolution card.", "The opponent is selecting 1 Digimon or Tamer that will get a digivolution card.");
  115. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  116. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  117. {
  118. Permanent selectedPermanent = permanent;
  119. if (selectedPermanent != null)
  120. {
  121. yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddDigivolutionCardsBottom(selectedCards, activateClass));
  122. }
  123. }
  124. }
  125. }
  126. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => (permanent.TopCard.CardTraits.Contains("Bagra Army") || permanent.TopCard.CardTraits.Contains("BagraArmy")) && (permanent.IsTamer || permanent.IsDigimon)))
  127. {
  128. if (card.Owner.Enemy.GetBattleAreaDigimons().Count >= 2)
  129. {
  130. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  131. {
  132. Permanent selectedPermanent = null;
  133. int maxCount = 1;
  134. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  135. selectPermanentEffect.SetUp(
  136. selectPlayer: card.Owner,
  137. canTargetCondition: CanSelectPermanentCondition1,
  138. canTargetCondition_ByPreSelecetedList: null,
  139. canEndSelectCondition: null,
  140. maxCount: maxCount,
  141. canNoSelect: false,
  142. canEndNotMax: false,
  143. selectPermanentCoroutine: SelectPermanentCoroutine,
  144. afterSelectPermanentCoroutine: null,
  145. mode: SelectPermanentEffect.Mode.Custom,
  146. cardEffect: activateClass);
  147. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that place under other Digimon's digivolution cards.", "The opponent is selecting 1 Digimon that place under other Digimon's digivolution cards.");
  148. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  149. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  150. {
  151. selectedPermanent = permanent;
  152. yield return null;
  153. }
  154. if (selectedPermanent != null)
  155. {
  156. bool CanSelectPermanentCondition2(Permanent permanent)
  157. {
  158. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  159. {
  160. if (permanent != selectedPermanent)
  161. {
  162. if (!permanent.IsToken)
  163. {
  164. return true;
  165. }
  166. }
  167. }
  168. return false;
  169. }
  170. maxCount = 1;
  171. selectPermanentEffect.SetUp(
  172. selectPlayer: card.Owner,
  173. canTargetCondition: CanSelectPermanentCondition2,
  174. canTargetCondition_ByPreSelecetedList: null,
  175. canEndSelectCondition: null,
  176. maxCount: maxCount,
  177. canNoSelect: false,
  178. canEndNotMax: false,
  179. selectPermanentCoroutine: SelectPermanentCoroutine1,
  180. afterSelectPermanentCoroutine: null,
  181. mode: SelectPermanentEffect.Mode.Custom,
  182. cardEffect: activateClass);
  183. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get digivolution cards.", "The opponent is selecting 1 Digimon that will get digivolution cards.");
  184. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  185. IEnumerator SelectPermanentCoroutine1(Permanent permanent)
  186. {
  187. yield return ContinuousController.instance.StartCoroutine(new IPlacePermanentToDigivolutionCards(new List<Permanent[]>() { new Permanent[] { selectedPermanent, permanent } }, false, activateClass).PlacePermanentToDigivolutionCards());
  188. }
  189. }
  190. }
  191. }
  192. }
  193. }
  194. }
  195. if (timing == EffectTiming.SecuritySkill)
  196. {
  197. CardEffectCommons.AddActivateMainOptionSecurityEffect(
  198. card: card,
  199. cardEffects: ref cardEffects,
  200. effectName: $"Place cards under your Digimon or Tamer from trash and place opponent's 1 Digimon under other Digimon as its bottom digivolution card");
  201. }
  202. return cardEffects;
  203. }
  204. }
  205. }