BT16_060.cs 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT16
  5. {
  6. public class BT16_060 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region On Play
  12. if (timing == EffectTiming.OnEnterFieldAnyone)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("Reduce opponent's Digimon cost, then delete a 6 cost or less Digimon", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[On Play] Reveal the top 3 cards of your deck. For each card with the [D-Brigade] or [DigiPolice] trait among them, reduce the play cost of all of your opponent's Digimon by 1 for the turn. Return the revealed cards to the top or bottom of the deck. Then, delete 1 of your opponent's Digimon with a play cost of 4 or less.";
  21. }
  22. bool PermanentCondition(Permanent permanent)
  23. {
  24. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  25. {
  26. if (permanent.TopCard.HasPlayCost && permanent.TopCard.GetCostItself <= 4)
  27. {
  28. return true;
  29. }
  30. }
  31. return false;
  32. }
  33. bool CardCondition(CardSource cardSource)
  34. {
  35. if (cardSource.CardTraits.Contains("D-Brigade") || cardSource.CardTraits.Contains("DigiPolice"))
  36. {
  37. return true;
  38. }
  39. return false;
  40. }
  41. bool CanUseCondition(Hashtable hashtable)
  42. {
  43. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  44. }
  45. bool CanActivateCondition(Hashtable hashtable)
  46. {
  47. return CardEffectCommons.IsExistOnBattleArea(card);
  48. }
  49. IEnumerator ActivateCoroutine(Hashtable hashtable)
  50. {
  51. int costReduction = 0;
  52. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.RevealDeckTopCardsAndProcessForAll(
  53. revealCount: 3,
  54. simplifiedSelectCardCondition:
  55. new SimplifiedSelectCardConditionClass(
  56. canTargetCondition: (cardSource) => false,
  57. message: "",
  58. mode: SelectCardEffect.Mode.Custom,
  59. maxCount: -1,
  60. selectCardCoroutine: null),
  61. remainingCardsPlace: RemainingCardsPlace.DeckTopOrBottom,
  62. activateClass: activateClass,
  63. revealedCardsCoroutine: RevealedCardsCoroutine
  64. ));
  65. IEnumerator RevealedCardsCoroutine(List<CardSource> revealedCards)
  66. {
  67. costReduction = revealedCards.Count(CardCondition);
  68. if (costReduction > 0)
  69. {
  70. bool PermanentCondition(Permanent permanent)
  71. {
  72. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  73. }
  74. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangePlayCostPlayerEffect(
  75. permanentCondition: PermanentCondition,
  76. changeValue: -costReduction,
  77. setFixedCost: false,
  78. effectDuration: EffectDuration.UntilEachTurnEnd,
  79. activateClass: activateClass));
  80. }
  81. yield return null;
  82. }
  83. if (CardEffectCommons.MatchConditionOpponentsPermanentCount(card, PermanentCondition) > 0)
  84. {
  85. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  86. selectPermanentEffect.SetUp(
  87. selectPlayer: card.Owner,
  88. canTargetCondition: PermanentCondition,
  89. canTargetCondition_ByPreSelecetedList: null,
  90. canEndSelectCondition: null,
  91. maxCount: 1,
  92. canNoSelect: false,
  93. canEndNotMax: false,
  94. selectPermanentCoroutine: null,
  95. afterSelectPermanentCoroutine: null,
  96. mode: SelectPermanentEffect.Mode.Destroy,
  97. cardEffect: activateClass);
  98. selectPermanentEffect.SetUpCustomMessage("Select 1 card to delete.", "The opponent is selecting 1 card to delete.");
  99. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  100. }
  101. }
  102. }
  103. #endregion
  104. #region When Digivolving
  105. if (timing == EffectTiming.OnEnterFieldAnyone)
  106. {
  107. ActivateClass activateClass = new ActivateClass();
  108. activateClass.SetUpICardEffect("Reduce opponent's Digimon cost, then delete a 4 cost or less Digimon", CanUseCondition, card);
  109. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  110. cardEffects.Add(activateClass);
  111. string EffectDiscription()
  112. {
  113. return "[When Digivolving] Reveal the top 3 cards of your deck. For each card with the [D-Brigade] or [DigiPolice] trait among them, reduce the play cost of all of your opponent's Digimon by 1 for the turn. Return the revealed cards to the top or bottom of the deck. Then, delete 1 of your opponent's Digimon with a play cost of 4 or less.";
  114. }
  115. bool PermanentCondition(Permanent permanent)
  116. {
  117. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  118. {
  119. if (permanent.TopCard.HasPlayCost && permanent.TopCard.GetCostItself <= 4)
  120. {
  121. return true;
  122. }
  123. }
  124. return false;
  125. }
  126. bool CardCondition(CardSource cardSource)
  127. {
  128. if (cardSource.CardTraits.Contains("D-Brigade") || cardSource.CardTraits.Contains("DigiPolice"))
  129. {
  130. return true;
  131. }
  132. return false;
  133. }
  134. bool CanUseCondition(Hashtable hashtable)
  135. {
  136. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  137. }
  138. bool CanActivateCondition(Hashtable hashtable)
  139. {
  140. return CardEffectCommons.IsExistOnBattleArea(card);
  141. }
  142. IEnumerator ActivateCoroutine(Hashtable hashtable)
  143. {
  144. int costReduction = 0;
  145. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.RevealDeckTopCardsAndProcessForAll(
  146. revealCount: 3,
  147. simplifiedSelectCardCondition:
  148. new SimplifiedSelectCardConditionClass(
  149. canTargetCondition: (cardSource) => false,
  150. message: "",
  151. mode: SelectCardEffect.Mode.Custom,
  152. maxCount: -1,
  153. selectCardCoroutine: null),
  154. remainingCardsPlace: RemainingCardsPlace.DeckTopOrBottom,
  155. activateClass: activateClass,
  156. revealedCardsCoroutine: RevealedCardsCoroutine
  157. ));
  158. IEnumerator RevealedCardsCoroutine(List<CardSource> revealedCards)
  159. {
  160. costReduction = revealedCards.Count(CardCondition);
  161. if (costReduction > 0)
  162. {
  163. bool PermanentCondition(Permanent permanent)
  164. {
  165. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  166. }
  167. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangePlayCostPlayerEffect(
  168. permanentCondition: PermanentCondition,
  169. changeValue: -costReduction,
  170. setFixedCost: false,
  171. effectDuration: EffectDuration.UntilEachTurnEnd,
  172. activateClass: activateClass));
  173. }
  174. yield return null;
  175. }
  176. if (CardEffectCommons.MatchConditionOpponentsPermanentCount(card, PermanentCondition) > 0)
  177. {
  178. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  179. selectPermanentEffect.SetUp(
  180. selectPlayer: card.Owner,
  181. canTargetCondition: PermanentCondition,
  182. canTargetCondition_ByPreSelecetedList: null,
  183. canEndSelectCondition: null,
  184. maxCount: 1,
  185. canNoSelect: false,
  186. canEndNotMax: false,
  187. selectPermanentCoroutine: null,
  188. afterSelectPermanentCoroutine: null,
  189. mode: SelectPermanentEffect.Mode.Destroy,
  190. cardEffect: activateClass);
  191. selectPermanentEffect.SetUpCustomMessage("Select 1 card to delete.", "The opponent is selecting 1 card to delete.");
  192. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  193. }
  194. }
  195. }
  196. #endregion
  197. #region All Turns - ESS
  198. if (timing == EffectTiming.OnEnterFieldAnyone)
  199. {
  200. ActivateClass activateClass = new ActivateClass();
  201. activateClass.SetUpICardEffect("De-Digivolve 1", CanUseCondition, card);
  202. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  203. activateClass.SetIsInheritedEffect(true);
  204. activateClass.SetHashString("De-Digivolve_BT16_060");
  205. cardEffects.Add(activateClass);
  206. string EffectDiscription()
  207. {
  208. return "[All Turns] [Once Per Turn] When one of your other Digimon with the [D-Brigade] or [DigiPolice] trait is played, <De-Digivolve 1> 1 of your opponent's Digimon.";
  209. }
  210. bool OpponentPermanentCondition(Permanent permanent)
  211. {
  212. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  213. {
  214. return true;
  215. }
  216. return false;
  217. }
  218. bool PermanentCondition(Permanent permanent)
  219. {
  220. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  221. {
  222. if (permanent.TopCard != card)
  223. {
  224. if (permanent.TopCard.IsDigimon)
  225. {
  226. if (permanent.TopCard.CardTraits.Contains("D-Brigade") || permanent.TopCard.CardTraits.Contains("DigiPolice"))
  227. {
  228. return true;
  229. }
  230. }
  231. }
  232. }
  233. return false;
  234. }
  235. bool CanUseCondition(Hashtable hashtable)
  236. {
  237. if (CardEffectCommons.IsExistOnBattleArea(card))
  238. {
  239. if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentCondition))
  240. {
  241. return true;
  242. }
  243. }
  244. return false;
  245. }
  246. bool CanActivateCondition(Hashtable hashtable)
  247. {
  248. return CardEffectCommons.IsExistOnBattleArea(card);
  249. }
  250. IEnumerator ActivateCoroutine(Hashtable hashtable)
  251. {
  252. if (CardEffectCommons.MatchConditionOpponentsPermanentCount(card, permanent => permanent.IsDigimon) > 0)
  253. {
  254. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  255. selectPermanentEffect.SetUp(
  256. selectPlayer: card.Owner,
  257. canTargetCondition: OpponentPermanentCondition,
  258. canTargetCondition_ByPreSelecetedList: null,
  259. canEndSelectCondition: null,
  260. maxCount: 1,
  261. canNoSelect: false,
  262. canEndNotMax: false,
  263. selectPermanentCoroutine: SelectCardCoroutine,
  264. afterSelectPermanentCoroutine: null,
  265. mode: SelectPermanentEffect.Mode.Custom,
  266. cardEffect: activateClass);
  267. selectPermanentEffect.SetUpCustomMessage("Select 1 card to de-digivolve.", "The opponent is selecting 1 card to de-digivolve.");
  268. yield return StartCoroutine(selectPermanentEffect.Activate());
  269. }
  270. IEnumerator SelectCardCoroutine(Permanent permanent)
  271. {
  272. if (permanent != null)
  273. {
  274. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(permanent, 1, activateClass).Degeneration());
  275. }
  276. }
  277. }
  278. }
  279. #endregion
  280. return cardEffects;
  281. }
  282. }
  283. }