BT19_014.cs 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT19
  5. {
  6. public class BT19_014 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alliance
  12. if (timing == EffectTiming.OnAllyAttack)
  13. {
  14. cardEffects.Add(CardEffectFactory.AllianceSelfEffect(
  15. isInheritedEffect: false,
  16. card: card,
  17. condition: null));
  18. }
  19. #endregion
  20. #region Reboot
  21. if (timing == EffectTiming.None)
  22. {
  23. cardEffects.Add(CardEffectFactory.RebootSelfStaticEffect(
  24. isInheritedEffect: false,
  25. card: card,
  26. condition: null));
  27. }
  28. #endregion
  29. #region Material Save
  30. if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
  31. {
  32. cardEffects.Add(CardEffectFactory.MaterialSaveEffect(card: card, materialSaveCount: 4));
  33. }
  34. #endregion
  35. #region On Play
  36. if (timing == EffectTiming.OnEnterFieldAnyone)
  37. {
  38. ActivateClass activateClass = new ActivateClass();
  39. activateClass.SetUpICardEffect(
  40. "All of your opponent's Digimon get -DP for the turn then, play 1 [ShootingStarmon] from under your Tamers",
  41. CanUseCondition, card);
  42. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  43. cardEffects.Add(activateClass);
  44. string EffectDescription()
  45. {
  46. return
  47. "[On Play] For each color in this Digimon's digivolution cards, all of your opponent's Digimon get -1000 DP for the turn. Then, you may play 1 [ShootingStarmon] from under your Tamers without paying the cost.";
  48. }
  49. bool CanUseCondition(Hashtable hashtable)
  50. {
  51. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  52. }
  53. bool OpponentPermanentCondition(Permanent permanent)
  54. {
  55. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  56. }
  57. bool PlayCardCondition(CardSource cardSource)
  58. {
  59. return cardSource.IsDigimon && cardSource.EqualsCardName("ShootingStarmon") &&
  60. CardEffectCommons.CanPlayAsNewPermanent(cardSource, false, activateClass, SelectCardEffect.Root.DigivolutionCards);
  61. }
  62. bool TamerHasDigimonCondition(Permanent permanent)
  63. {
  64. return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card) &&
  65. permanent.IsTamer && permanent.DigivolutionCards.Count(PlayCardCondition) >= 1;
  66. }
  67. bool CanActivateCondition(Hashtable hashtable)
  68. {
  69. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  70. }
  71. IEnumerator ActivateCoroutine(Hashtable hashtable)
  72. {
  73. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDPPlayerEffect(
  74. permanentCondition: OpponentPermanentCondition,
  75. changeValue: -1000 * card.PermanentOfThisCard().DigivolutionCardsColors.Count,
  76. effectDuration: EffectDuration.UntilEachTurnEnd,
  77. activateClass: activateClass));
  78. if (CardEffectCommons.HasMatchConditionPermanent(TamerHasDigimonCondition))
  79. {
  80. Permanent selectedPermanent = null;
  81. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  82. selectPermanentEffect.SetUp(
  83. selectPlayer: card.Owner,
  84. canTargetCondition: TamerHasDigimonCondition,
  85. canTargetCondition_ByPreSelecetedList: null,
  86. canEndSelectCondition: null,
  87. maxCount: 1,
  88. canNoSelect: true,
  89. canEndNotMax: false,
  90. selectPermanentCoroutine: SelectPermanentCoroutine,
  91. afterSelectPermanentCoroutine: null,
  92. mode: SelectPermanentEffect.Mode.Custom,
  93. cardEffect: activateClass);
  94. selectPermanentEffect.SetUpCustomMessage("Select a Tamer.", "The opponent is selecting a Tamer.");
  95. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  96. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  97. {
  98. selectedPermanent = permanent;
  99. yield return null;
  100. }
  101. if (selectedPermanent != null)
  102. {
  103. List<CardSource> selectedCards = new List<CardSource>();
  104. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  105. selectCardEffect.SetUp(
  106. canTargetCondition: PlayCardCondition,
  107. canTargetCondition_ByPreSelecetedList: null,
  108. canEndSelectCondition: null,
  109. canNoSelect: () => true,
  110. selectCardCoroutine: SelectCardCoroutine,
  111. afterSelectCardCoroutine: null,
  112. message: "Select 1 digivolution card to play.",
  113. maxCount: 1,
  114. canEndNotMax: false,
  115. isShowOpponent: true,
  116. mode: SelectCardEffect.Mode.Custom,
  117. root: SelectCardEffect.Root.Custom,
  118. customRootCardList: selectedPermanent.DigivolutionCards,
  119. canLookReverseCard: true,
  120. selectPlayer: card.Owner,
  121. cardEffect: activateClass);
  122. selectCardEffect.SetUpCustomMessage("Select 1 digivolution card to play.",
  123. "The opponent is selecting 1 digivolution card to play.");
  124. selectCardEffect.SetUpCustomMessage_ShowCard("Played Card");
  125. yield return StartCoroutine(selectCardEffect.Activate());
  126. IEnumerator SelectCardCoroutine(CardSource cardSource)
  127. {
  128. selectedCards.Add(cardSource);
  129. yield return null;
  130. }
  131. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  132. cardSources: selectedCards,
  133. activateClass: activateClass,
  134. payCost: false,
  135. isTapped: false,
  136. root: SelectCardEffect.Root.DigivolutionCards,
  137. activateETB: true));
  138. }
  139. }
  140. }
  141. }
  142. #endregion
  143. #region When Attacking
  144. if (timing == EffectTiming.OnAllyAttack)
  145. {
  146. ActivateClass activateClass = new ActivateClass();
  147. activateClass.SetUpICardEffect("Delete 1 Digimon", CanUseCondition, card);
  148. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  149. cardEffects.Add(activateClass);
  150. string EffectDescription()
  151. {
  152. return
  153. "[When Attacking] Delete 1 of your opponent's Digimon with as much or less DP than this Digimon.";
  154. }
  155. bool CanUseCondition(Hashtable hashtable)
  156. {
  157. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  158. }
  159. bool IsEnemyPermanentWithAsMuchOrLessDpSharedCondition(Permanent permanent)
  160. {
  161. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) &&
  162. permanent.DP <= card.PermanentOfThisCard().DP;
  163. }
  164. bool CanActivateCondition(Hashtable hashtable)
  165. {
  166. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  167. CardEffectCommons.HasMatchConditionPermanent(IsEnemyPermanentWithAsMuchOrLessDpSharedCondition);
  168. }
  169. IEnumerator ActivateCoroutine(Hashtable hashtable)
  170. {
  171. if (CardEffectCommons.HasMatchConditionPermanent(IsEnemyPermanentWithAsMuchOrLessDpSharedCondition))
  172. {
  173. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  174. selectPermanentEffect.SetUp(
  175. selectPlayer: card.Owner,
  176. canTargetCondition: IsEnemyPermanentWithAsMuchOrLessDpSharedCondition,
  177. canTargetCondition_ByPreSelecetedList: null,
  178. canEndSelectCondition: null,
  179. maxCount: 1,
  180. canNoSelect: false,
  181. canEndNotMax: false,
  182. selectPermanentCoroutine: null,
  183. afterSelectPermanentCoroutine: null,
  184. mode: SelectPermanentEffect.Mode.Destroy,
  185. cardEffect: activateClass);
  186. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  187. }
  188. }
  189. }
  190. #endregion
  191. #region DigiXros
  192. if (timing == EffectTiming.None)
  193. {
  194. AddDigiXrosConditionClass addDigiXrosConditionClass = new AddDigiXrosConditionClass();
  195. addDigiXrosConditionClass.SetUpICardEffect($"DigiXros -2", CanUseCondition, card);
  196. addDigiXrosConditionClass.SetUpAddDigiXrosConditionClass(getDigiXrosCondition: GetDigiXros);
  197. addDigiXrosConditionClass.SetNotShowUI(true);
  198. cardEffects.Add(addDigiXrosConditionClass);
  199. bool CanUseCondition(Hashtable hashtable)
  200. {
  201. return true;
  202. }
  203. DigiXrosCondition GetDigiXros(CardSource cardSource)
  204. {
  205. if (cardSource == card)
  206. {
  207. DigiXrosConditionElement elementA = new DigiXrosConditionElement(CanSelectCardConditionA, "OmniShoutmon");
  208. bool CanSelectCardConditionA(CardSource conditionCardSource)
  209. {
  210. if (conditionCardSource)
  211. {
  212. if (conditionCardSource.Owner == card.Owner)
  213. {
  214. if (conditionCardSource.IsDigimon)
  215. {
  216. if (conditionCardSource.CardNames_DigiXros.Contains("OmniShoutmon"))
  217. {
  218. return true;
  219. }
  220. }
  221. }
  222. }
  223. return false;
  224. }
  225. DigiXrosConditionElement elementB = new DigiXrosConditionElement(CanSelectCardConditionB, "ZeigGreymon");
  226. bool CanSelectCardConditionB(CardSource conditionCardSource)
  227. {
  228. if (conditionCardSource)
  229. {
  230. if (conditionCardSource.Owner == card.Owner)
  231. {
  232. if (conditionCardSource.IsDigimon)
  233. {
  234. if (conditionCardSource.CardNames_DigiXros.Contains("ZeigGreymon"))
  235. {
  236. return true;
  237. }
  238. }
  239. }
  240. }
  241. return false;
  242. }
  243. DigiXrosConditionElement elementC = new DigiXrosConditionElement(CanSelectCardConditionC, "AtlurBallistamon");
  244. bool CanSelectCardConditionC(CardSource conditionCardSource)
  245. {
  246. if (conditionCardSource)
  247. {
  248. if (conditionCardSource.Owner == card.Owner)
  249. {
  250. if (conditionCardSource.IsDigimon)
  251. {
  252. if (conditionCardSource.CardNames_DigiXros.Contains("AtlurBallistamon"))
  253. {
  254. return true;
  255. }
  256. }
  257. }
  258. }
  259. return false;
  260. }
  261. DigiXrosConditionElement elementD = new DigiXrosConditionElement(CanSelectCardConditionD, "JaegerDorulumon");
  262. bool CanSelectCardConditionD(CardSource conditionCardSource)
  263. {
  264. if (conditionCardSource)
  265. {
  266. if (conditionCardSource.Owner == card.Owner)
  267. {
  268. if (conditionCardSource.IsDigimon)
  269. {
  270. if (conditionCardSource.CardNames_DigiXros.Contains("JaegerDorulumon"))
  271. {
  272. return true;
  273. }
  274. }
  275. }
  276. }
  277. return false;
  278. }
  279. DigiXrosConditionElement elementE = new DigiXrosConditionElement(CanSelectCardConditionE, "RaptorSparrowmon");
  280. bool CanSelectCardConditionE(CardSource conditionCardSource)
  281. {
  282. if (conditionCardSource)
  283. {
  284. if (conditionCardSource.Owner == card.Owner)
  285. {
  286. if (conditionCardSource.IsDigimon)
  287. {
  288. if (conditionCardSource.CardNames_DigiXros.Contains("RaptorSparrowmon"))
  289. {
  290. return true;
  291. }
  292. }
  293. }
  294. }
  295. return false;
  296. }
  297. List<DigiXrosConditionElement> elements = new List<DigiXrosConditionElement>()
  298. { elementA, elementB, elementC, elementD, elementE };
  299. DigiXrosCondition digiXrosCondition = new DigiXrosCondition(elements, null, 2);
  300. return digiXrosCondition;
  301. }
  302. return null;
  303. }
  304. }
  305. #endregion
  306. return cardEffects;
  307. }
  308. }
  309. }