BT16_061.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  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.IsDigiEgg)
  131. {
  132. if (cardSource.ContainsTraits("X Antibody") || cardSource.CardTraits.Contains("X-Antibody"))
  133. {
  134. return true;
  135. }
  136. if (cardSource.ContainsTraits("SoC"))
  137. {
  138. return true;
  139. }
  140. }
  141. }
  142. return false;
  143. }
  144. bool DeletionCardEffect(ICardEffect cardEffect)
  145. {
  146. return (cardEffect.EffectSourceCard.PermanentOfThisCard() == card.PermanentOfThisCard());
  147. }
  148. bool CanUseCondition(Hashtable hashtable)
  149. {
  150. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  151. {
  152. if (CardEffectCommons.IsByEffect(hashtable, DeletionCardEffect))
  153. {
  154. // Other Digimon
  155. bool DeletionCardEffect(ICardEffect cardEffect) =>
  156. cardEffect.EffectSourceCard.PermanentOfThisCard() == card.PermanentOfThisCard();
  157. bool DeletedPermanentCondition(Permanent permanent) =>
  158. permanent != card.PermanentOfThisCard() && permanent.IsDigimon;
  159. if (CardEffectCommons.IsByEffect(hashtable, DeletionCardEffect))
  160. {
  161. if (CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable, DeletedPermanentCondition, activateClass))
  162. return true;
  163. }
  164. }
  165. }
  166. return false;
  167. }
  168. bool CanActivateCondition(Hashtable hashtable)
  169. {
  170. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  171. CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, SelectCardCondition);
  172. }
  173. IEnumerator ActivateCoroutine(Hashtable hashtable)
  174. {
  175. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  176. selectCardEffect.SetUp(
  177. canTargetCondition: SelectCardCondition,
  178. canTargetCondition_ByPreSelecetedList: null,
  179. canEndSelectCondition: null,
  180. canNoSelect: () => false,
  181. selectCardCoroutine: null,
  182. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  183. message: "Select 1 card to play",
  184. maxCount: 1,
  185. canEndNotMax: false,
  186. isShowOpponent: false,
  187. mode: SelectCardEffect.Mode.Custom,
  188. root: SelectCardEffect.Root.Trash,
  189. customRootCardList: null,
  190. canLookReverseCard: true,
  191. selectPlayer: card.Owner,
  192. cardEffect: activateClass
  193. );
  194. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  195. IEnumerator AfterSelectCardCoroutine(List<CardSource> selectedCardSources)
  196. {
  197. if (selectedCardSources.Count >= 1)
  198. {
  199. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  200. cardSources: selectedCardSources,
  201. activateClass: activateClass,
  202. payCost: false,
  203. isTapped: false,
  204. root: SelectCardEffect.Root.Trash,
  205. activateETB: true));
  206. }
  207. }
  208. }
  209. }
  210. #endregion
  211. #region All Turns - ESS Battle
  212. if (timing == EffectTiming.OnEndBattle)
  213. {
  214. ActivateClass activateClass = new ActivateClass();
  215. activateClass.SetUpICardEffect("Play 1 card with 5 cost or less", CanUseCondition, card);
  216. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  217. activateClass.SetIsInheritedEffect(true);
  218. activateClass.SetHashString("PlayCard_BT16_061");
  219. cardEffects.Add(activateClass);
  220. string EffectDiscription()
  221. {
  222. return
  223. "[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.";
  224. }
  225. bool SelectCardCondition(CardSource cardSource)
  226. {
  227. if (cardSource.HasPlayCost && cardSource.GetCostItself <= 5)
  228. {
  229. if (cardSource.ContainsTraits("X Antibody") || cardSource.CardTraits.Contains("X-Antibody"))
  230. {
  231. return true;
  232. }
  233. if (cardSource.ContainsTraits("SoC"))
  234. {
  235. return true;
  236. }
  237. }
  238. return false;
  239. }
  240. bool WinnerCondition(Permanent permanent) => permanent.cardSources.Contains(card);
  241. bool LoserCondition(Permanent permanent) => CardEffectCommons.IsOpponentPermanent(permanent, card);
  242. bool CanUseCondition(Hashtable hashtable)
  243. {
  244. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  245. CardEffectCommons.CanTriggerWhenDeleteOpponentDigimonByBattle(hashtable: hashtable,
  246. winnerCondition: WinnerCondition, loserCondition: LoserCondition, isOnlyWinnerSurvive: false);
  247. }
  248. bool CanActivateCondition(Hashtable hashtable)
  249. {
  250. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  251. CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, SelectCardCondition);
  252. }
  253. IEnumerator ActivateCoroutine(Hashtable hashtable)
  254. {
  255. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  256. selectCardEffect.SetUp(
  257. canTargetCondition: SelectCardCondition,
  258. canTargetCondition_ByPreSelecetedList: null,
  259. canEndSelectCondition: null,
  260. canNoSelect: () => false,
  261. selectCardCoroutine: null,
  262. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  263. message: "Select 1 card to play",
  264. maxCount: 1,
  265. canEndNotMax: false,
  266. isShowOpponent: false,
  267. mode: SelectCardEffect.Mode.Custom,
  268. root: SelectCardEffect.Root.Trash,
  269. customRootCardList: null,
  270. canLookReverseCard: true,
  271. selectPlayer: card.Owner,
  272. cardEffect: activateClass
  273. );
  274. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  275. IEnumerator AfterSelectCardCoroutine(List<CardSource> selectedCardSources)
  276. {
  277. if (selectedCardSources.Count >= 1)
  278. {
  279. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  280. cardSources: selectedCardSources,
  281. activateClass: activateClass,
  282. payCost: false,
  283. isTapped: false,
  284. root: SelectCardEffect.Root.Trash,
  285. activateETB: true));
  286. }
  287. }
  288. }
  289. }
  290. #endregion
  291. return cardEffects;
  292. }
  293. }
  294. }