BT16_061.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT16
  5. {
  6. public class BT16_061 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alternate Digivolution Requirement
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. if (targetPermanent.TopCard.ContainsCardName("Dorugamon"))
  17. {
  18. return true;
  19. }
  20. if (targetPermanent.TopCard.Level == 4 && targetPermanent.TopCard.ContainsTraits("SoC"))
  21. {
  22. return true;
  23. }
  24. return false;
  25. }
  26. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  27. permanentCondition: PermanentCondition,
  28. digivolutionCost: 3,
  29. ignoreDigivolutionRequirement: false,
  30. card: card,
  31. condition: null));
  32. }
  33. #endregion
  34. #region Collision
  35. if (timing == EffectTiming.OnCounterTiming)
  36. {
  37. cardEffects.Add(CardEffectFactory.CollisionSelfStaticEffect(false, card, null));
  38. }
  39. #endregion
  40. #region All Turns
  41. if (timing == EffectTiming.OnAttackTargetChanged)
  42. {
  43. ActivateClass activateClass = new ActivateClass();
  44. activateClass.SetUpICardEffect("Digivolve this digimon", CanUseCondition, card);
  45. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  46. cardEffects.Add(activateClass);
  47. string EffectDiscription()
  48. {
  49. return
  50. "[All Turns] When an attack target is switched, this Digimon with a Tamer card with the [SoC] trait in its digivolution cards may digivolve into a Digimon card with the [Beast Dragon], [Undead] or [SoC] trait in your hand without paying the cost.";
  51. }
  52. bool HasTamerCardCondition(CardSource cardSource)
  53. {
  54. if (cardSource.CardTraits.Contains("SoC"))
  55. {
  56. if (cardSource.IsTamer)
  57. {
  58. return true;
  59. }
  60. }
  61. return false;
  62. }
  63. bool CanSelectCardCondition(CardSource cardSource)
  64. {
  65. if (cardSource.HasBeastDragonTraits || cardSource.CardTraits.Contains("Undead") ||
  66. cardSource.CardTraits.Contains("SoC"))
  67. {
  68. if (cardSource.IsDigimon)
  69. {
  70. return true;
  71. }
  72. }
  73. return false;
  74. }
  75. bool CanUseCondition(Hashtable hashtable)
  76. {
  77. if (CardEffectCommons.IsExistOnBattleArea(card))
  78. {
  79. if (card.PermanentOfThisCard().DigivolutionCards.Count(HasTamerCardCondition) >= 1)
  80. {
  81. return true;
  82. }
  83. }
  84. return false;
  85. }
  86. bool CanActivateCondition(Hashtable hashtable)
  87. {
  88. if (CardEffectCommons.IsExistOnBattleArea(card))
  89. {
  90. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  91. {
  92. return true;
  93. }
  94. }
  95. return false;
  96. }
  97. IEnumerator ActivateCoroutine(Hashtable hashtable)
  98. {
  99. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  100. targetPermanent: card.PermanentOfThisCard(),
  101. cardCondition: CanSelectCardCondition,
  102. payCost: false,
  103. reduceCostTuple: null,
  104. fixedCostTuple: null,
  105. ignoreDigivolutionRequirementFixedCost: -1,
  106. isHand: true,
  107. activateClass: activateClass,
  108. successProcess: null));
  109. }
  110. }
  111. #endregion
  112. #region All Turns - ESS Effect
  113. if (timing == EffectTiming.OnDestroyedAnyone)
  114. {
  115. ActivateClass activateClass = new ActivateClass();
  116. activateClass.SetUpICardEffect("Play 1 card with 5 cost or less", CanUseCondition, card);
  117. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  118. activateClass.SetIsInheritedEffect(true);
  119. activateClass.SetHashString("PlayCard_BT16_061");
  120. cardEffects.Add(activateClass);
  121. string EffectDiscription()
  122. {
  123. return
  124. "[All Turns] (Once Per Turn) When this Digimon deletes another Digimon, you may play 1 card with the [X Antibody] or [SoC] trait and a play cost of 5 or less from your trash without paying the cost.";
  125. }
  126. bool SelectCardCondition(CardSource cardSource)
  127. {
  128. if (cardSource.HasPlayCost && cardSource.GetCostItself <= 5)
  129. {
  130. if (cardSource.ContainsTraits("X Antibody") || cardSource.CardTraits.Contains("X-Antibody"))
  131. {
  132. return true;
  133. }
  134. if (cardSource.ContainsTraits("SoC"))
  135. {
  136. return true;
  137. }
  138. }
  139. return false;
  140. }
  141. bool DeletionCardEffect(ICardEffect cardEffect)
  142. {
  143. return (cardEffect.EffectSourceCard.PermanentOfThisCard() == card.PermanentOfThisCard());
  144. }
  145. bool CanUseCondition(Hashtable hashtable)
  146. {
  147. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  148. {
  149. if (CardEffectCommons.IsByEffect(hashtable, DeletionCardEffect))
  150. {
  151. // Other Digimon
  152. bool DeletionCardEffect(ICardEffect cardEffect) =>
  153. cardEffect.EffectSourceCard.PermanentOfThisCard() == card.PermanentOfThisCard();
  154. bool DeletedPermanentCondition(Permanent permanent) =>
  155. permanent != card.PermanentOfThisCard() && permanent.IsDigimon;
  156. if (CardEffectCommons.IsByEffect(hashtable, DeletionCardEffect))
  157. {
  158. if (CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable, DeletedPermanentCondition))
  159. return true;
  160. }
  161. }
  162. }
  163. return false;
  164. }
  165. bool CanActivateCondition(Hashtable hashtable)
  166. {
  167. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  168. CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, SelectCardCondition);
  169. }
  170. IEnumerator ActivateCoroutine(Hashtable hashtable)
  171. {
  172. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  173. selectCardEffect.SetUp(
  174. canTargetCondition: SelectCardCondition,
  175. canTargetCondition_ByPreSelecetedList: null,
  176. canEndSelectCondition: null,
  177. canNoSelect: () => false,
  178. selectCardCoroutine: null,
  179. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  180. message: "Select 1 card to play",
  181. maxCount: 1,
  182. canEndNotMax: false,
  183. isShowOpponent: false,
  184. mode: SelectCardEffect.Mode.Custom,
  185. root: SelectCardEffect.Root.Trash,
  186. customRootCardList: null,
  187. canLookReverseCard: true,
  188. selectPlayer: card.Owner,
  189. cardEffect: activateClass
  190. );
  191. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  192. IEnumerator AfterSelectCardCoroutine(List<CardSource> selectedCardSources)
  193. {
  194. if (selectedCardSources.Count >= 1)
  195. {
  196. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  197. cardSources: selectedCardSources,
  198. activateClass: activateClass,
  199. payCost: false,
  200. isTapped: false,
  201. root: SelectCardEffect.Root.Trash,
  202. activateETB: true));
  203. }
  204. }
  205. }
  206. }
  207. #endregion
  208. #region All Turns - ESS Battle
  209. if (timing == EffectTiming.OnEndBattle)
  210. {
  211. ActivateClass activateClass = new ActivateClass();
  212. activateClass.SetUpICardEffect("Play 1 card with 5 cost or less", CanUseCondition, card);
  213. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  214. activateClass.SetIsInheritedEffect(true);
  215. activateClass.SetHashString("PlayCard_BT16_061");
  216. cardEffects.Add(activateClass);
  217. string EffectDiscription()
  218. {
  219. return
  220. "[All Turns] (Once Per Turn) When this Digimon deletes another Digimon, you may play 1 card with the [X Antibody] or [SoC] trait and a play cost of 5 or less from your trash without paying the cost.";
  221. }
  222. bool SelectCardCondition(CardSource cardSource)
  223. {
  224. if (cardSource.HasPlayCost && cardSource.GetCostItself <= 5)
  225. {
  226. if (cardSource.ContainsTraits("X Antibody") || cardSource.CardTraits.Contains("X-Antibody"))
  227. {
  228. return true;
  229. }
  230. if (cardSource.ContainsTraits("SoC"))
  231. {
  232. return true;
  233. }
  234. }
  235. return false;
  236. }
  237. bool WinnerCondition(Permanent permanent) => permanent.cardSources.Contains(card);
  238. bool LoserCondition(Permanent permanent) => CardEffectCommons.IsOpponentPermanent(permanent, card);
  239. bool CanUseCondition(Hashtable hashtable)
  240. {
  241. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  242. CardEffectCommons.CanTriggerWhenDeleteOpponentDigimonByBattle(hashtable: hashtable,
  243. winnerCondition: WinnerCondition, loserCondition: LoserCondition, isOnlyWinnerSurvive: false);
  244. }
  245. bool CanActivateCondition(Hashtable hashtable)
  246. {
  247. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  248. CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, SelectCardCondition);
  249. }
  250. IEnumerator ActivateCoroutine(Hashtable hashtable)
  251. {
  252. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  253. selectCardEffect.SetUp(
  254. canTargetCondition: SelectCardCondition,
  255. canTargetCondition_ByPreSelecetedList: null,
  256. canEndSelectCondition: null,
  257. canNoSelect: () => false,
  258. selectCardCoroutine: null,
  259. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  260. message: "Select 1 card to play",
  261. maxCount: 1,
  262. canEndNotMax: false,
  263. isShowOpponent: false,
  264. mode: SelectCardEffect.Mode.Custom,
  265. root: SelectCardEffect.Root.Trash,
  266. customRootCardList: null,
  267. canLookReverseCard: true,
  268. selectPlayer: card.Owner,
  269. cardEffect: activateClass
  270. );
  271. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  272. IEnumerator AfterSelectCardCoroutine(List<CardSource> selectedCardSources)
  273. {
  274. if (selectedCardSources.Count >= 1)
  275. {
  276. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  277. cardSources: selectedCardSources,
  278. activateClass: activateClass,
  279. payCost: false,
  280. isTapped: false,
  281. root: SelectCardEffect.Root.Trash,
  282. activateETB: true));
  283. }
  284. }
  285. }
  286. }
  287. #endregion
  288. return cardEffects;
  289. }
  290. }
  291. }