BT19_010.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT19
  6. {
  7. public class BT19_010 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region All Turns
  13. if (timing == EffectTiming.WhenRemoveField)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Save up to 3 Digimon cards with the [Xros Heart] trait.", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  18. cardEffects.Add(activateClass);
  19. string EffectDescription()
  20. {
  21. return
  22. "[All Turns] When this Digimon would leave the battle area, you may place up to 3 Digimon cards with the [Xros Heart] trait from this Digimon's digivolution cards under 1 of your Tamers.";
  23. }
  24. bool CanUseCondition(Hashtable hashtable)
  25. {
  26. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  27. CardEffectCommons.CanTriggerWhenRemoveField(hashtable, card);
  28. }
  29. bool CanSelectCardCondition(CardSource cardSource)
  30. {
  31. return cardSource.IsDigimon && cardSource.EqualsTraits("Xros Heart");
  32. }
  33. bool CanSelectSaveTamerPermanentCondition(Permanent permanent)
  34. {
  35. return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card)
  36. && permanent.IsTamer;
  37. }
  38. bool CanActivateCondition(Hashtable hashtable)
  39. {
  40. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  41. card.PermanentOfThisCard().DigivolutionCards.Some(CanSelectCardCondition);
  42. }
  43. IEnumerator ActivateCoroutine(Hashtable hashtable)
  44. {
  45. List<CardSource> selectedCards = new List<CardSource>();
  46. int maxCount = Math.Min(3, card.PermanentOfThisCard().DigivolutionCards.Count(CanSelectCardCondition));
  47. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  48. selectCardEffect.SetUp(
  49. canTargetCondition: CanSelectCardCondition,
  50. canTargetCondition_ByPreSelecetedList: null,
  51. canEndSelectCondition: null,
  52. canNoSelect: () => true,
  53. selectCardCoroutine: SelectCardCoroutine,
  54. afterSelectCardCoroutine: null,
  55. message: "Select digivolution cards to place under 1 of your Tamers.",
  56. maxCount: maxCount,
  57. canEndNotMax: false,
  58. isShowOpponent: true,
  59. mode: SelectCardEffect.Mode.Custom,
  60. root: SelectCardEffect.Root.Custom,
  61. customRootCardList: card.PermanentOfThisCard().DigivolutionCards,
  62. canLookReverseCard: true,
  63. selectPlayer: card.Owner,
  64. cardEffect: activateClass);
  65. selectCardEffect.SetUpCustomMessage(
  66. "Select digivolution cards to place under 1 of your Tamers.",
  67. "The opponent is selecting digivolution cards to place under 1 of your Tamers.");
  68. selectCardEffect.SetUpCustomMessage_ShowCard("Played Card");
  69. yield return StartCoroutine(selectCardEffect.Activate());
  70. IEnumerator SelectCardCoroutine(CardSource cardSource)
  71. {
  72. selectedCards.Add(cardSource);
  73. yield return null;
  74. }
  75. if (selectedCards.Count >= 1)
  76. {
  77. Permanent selectedPermanent = null;
  78. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  79. selectPermanentEffect.SetUp(
  80. selectPlayer: card.Owner,
  81. canTargetCondition: CanSelectSaveTamerPermanentCondition,
  82. canTargetCondition_ByPreSelecetedList: null,
  83. canEndSelectCondition: null,
  84. maxCount: 1,
  85. canNoSelect: true,
  86. canEndNotMax: false,
  87. selectPermanentCoroutine: SelectPermanentCoroutine,
  88. afterSelectPermanentCoroutine: null,
  89. mode: SelectPermanentEffect.Mode.Custom,
  90. cardEffect: activateClass);
  91. selectPermanentEffect.SetUpCustomMessage("Select 1 Tamer to place the chosen cards under.",
  92. "The opponent is selecting 1 Tamer to place the chosen cards under.");
  93. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  94. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  95. {
  96. selectedPermanent = permanent;
  97. yield return null;
  98. }
  99. if (selectedPermanent != null)
  100. {
  101. yield return ContinuousController.instance.StartCoroutine(
  102. selectedPermanent.AddDigivolutionCardsBottom(selectedCards, activateClass));
  103. }
  104. }
  105. }
  106. }
  107. #endregion
  108. #region DigiXros
  109. if (timing == EffectTiming.None)
  110. {
  111. AddDigiXrosConditionClass addDigiXrosConditionClass = new AddDigiXrosConditionClass();
  112. addDigiXrosConditionClass.SetUpICardEffect($"DigiXros -2", CanUseCondition, card);
  113. addDigiXrosConditionClass.SetUpAddDigiXrosConditionClass(getDigiXrosCondition: GetDigiXros);
  114. addDigiXrosConditionClass.SetNotShowUI(true);
  115. cardEffects.Add(addDigiXrosConditionClass);
  116. bool CanUseCondition(Hashtable hashtable)
  117. {
  118. return true;
  119. }
  120. DigiXrosCondition GetDigiXros(CardSource cardSource)
  121. {
  122. if (cardSource == card)
  123. {
  124. DigiXrosConditionElement elementA = new DigiXrosConditionElement(CanSelectCardConditionA, "Shoutmon");
  125. bool CanSelectCardConditionA(CardSource conditionCardSource)
  126. {
  127. if (conditionCardSource)
  128. {
  129. if (conditionCardSource.Owner == card.Owner)
  130. {
  131. if (conditionCardSource.IsDigimon)
  132. {
  133. if (conditionCardSource.CardNames_DigiXros.Contains("Shoutmon"))
  134. {
  135. return true;
  136. }
  137. }
  138. }
  139. }
  140. return false;
  141. }
  142. DigiXrosConditionElement elementB = new DigiXrosConditionElement(CanSelectCardConditionB, "Ballistamon");
  143. bool CanSelectCardConditionB(CardSource conditionCardSource)
  144. {
  145. if (conditionCardSource)
  146. {
  147. if (conditionCardSource.Owner == card.Owner)
  148. {
  149. if (conditionCardSource.IsDigimon)
  150. {
  151. if (conditionCardSource.CardNames_DigiXros.Contains("Ballistamon"))
  152. {
  153. return true;
  154. }
  155. }
  156. }
  157. }
  158. return false;
  159. }
  160. DigiXrosConditionElement elementC = new DigiXrosConditionElement(CanSelectCardConditionC, "Dorulumon");
  161. bool CanSelectCardConditionC(CardSource conditionCardSource)
  162. {
  163. if (conditionCardSource)
  164. {
  165. if (conditionCardSource.Owner == card.Owner)
  166. {
  167. if (conditionCardSource.IsDigimon)
  168. {
  169. if (conditionCardSource.CardNames_DigiXros.Contains("Dorulumon"))
  170. {
  171. return true;
  172. }
  173. }
  174. }
  175. }
  176. return false;
  177. }
  178. DigiXrosConditionElement elementD = new DigiXrosConditionElement(CanSelectCardConditionD, "Starmons");
  179. bool CanSelectCardConditionD(CardSource conditionCardSource)
  180. {
  181. if (conditionCardSource)
  182. {
  183. if (conditionCardSource.Owner == card.Owner)
  184. {
  185. if (conditionCardSource.IsDigimon)
  186. {
  187. if (conditionCardSource.CardNames_DigiXros.Contains("Starmons"))
  188. {
  189. return true;
  190. }
  191. }
  192. }
  193. }
  194. return false;
  195. }
  196. List<DigiXrosConditionElement> elements = new List<DigiXrosConditionElement>()
  197. { elementA, elementB, elementC, elementD };
  198. DigiXrosCondition digiXrosCondition = new DigiXrosCondition(elements, null, 2);
  199. return digiXrosCondition;
  200. }
  201. return null;
  202. }
  203. }
  204. #endregion
  205. return cardEffects;
  206. }
  207. }
  208. }