BT20_071.cs 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT20
  4. {
  5. public class BT20_071 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Alt Digivolve Cost
  11. if (timing == EffectTiming.None)
  12. {
  13. bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. return targetPermanent.TopCard.EqualsCardName("Loogarmon") ||
  16. (targetPermanent.TopCard.IsLevel4 &&
  17. targetPermanent.TopCard.HasSeekersTraits);
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  20. permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false,
  21. card: card, condition: null));
  22. }
  23. #endregion
  24. #region On Play
  25. if (timing == EffectTiming.OnEnterFieldAnyone)
  26. {
  27. ActivateClass activateClass = new ActivateClass();
  28. activateClass.SetUpICardEffect("Raid, +3000 DP", CanUseCondition, card);
  29. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  30. cardEffects.Add(activateClass);
  31. string EffectDiscription()
  32. {
  33. return "[On Play] By trashing 1 card in your hand,for the turn, 1 of your Digimon gains <Raid> and gets +3000 DP.";
  34. }
  35. bool CanSelectPermanentCondition(Permanent permanent)
  36. {
  37. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  38. }
  39. bool CanUseCondition(Hashtable hashtable)
  40. {
  41. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  42. }
  43. bool CanActivateCondition(Hashtable hashtable)
  44. {
  45. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  46. card.Owner.HandCards.Count > 0;
  47. }
  48. IEnumerator ActivateCoroutine(Hashtable hashtable)
  49. {
  50. bool discarded = false;
  51. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  52. selectHandEffect.SetUp(
  53. selectPlayer: card.Owner,
  54. canTargetCondition: (cardSource) => true,
  55. canTargetCondition_ByPreSelecetedList: null,
  56. canEndSelectCondition: null,
  57. maxCount: 1,
  58. canNoSelect: true,
  59. canEndNotMax: false,
  60. isShowOpponent: true,
  61. selectCardCoroutine: null,
  62. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  63. mode: SelectHandEffect.Mode.Discard,
  64. cardEffect: activateClass);
  65. yield return StartCoroutine(selectHandEffect.Activate());
  66. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  67. {
  68. if (cardSources.Count >= 1)
  69. {
  70. discarded = true;
  71. yield return null;
  72. }
  73. }
  74. if (discarded)
  75. {
  76. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  77. {
  78. Permanent selectedPermanent = null;
  79. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  80. selectPermanentEffect.SetUp(
  81. selectPlayer: card.Owner,
  82. canTargetCondition: CanSelectPermanentCondition,
  83. canTargetCondition_ByPreSelecetedList: null,
  84. canEndSelectCondition: null,
  85. maxCount: 1,
  86. canNoSelect: false,
  87. canEndNotMax: false,
  88. selectPermanentCoroutine: SelectPermanentCoroutine,
  89. afterSelectPermanentCoroutine: null,
  90. mode: SelectPermanentEffect.Mode.Custom,
  91. cardEffect: activateClass);
  92. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to gain Raid and +3000 DP", "Opponent is select 1 Digimon to gain Raid and +3000 DP");
  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(CardEffectCommons.GainRaid(
  102. targetPermanent: selectedPermanent,
  103. effectDuration: EffectDuration.UntilEachTurnEnd,
  104. activateClass: activateClass));
  105. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  106. targetPermanent: selectedPermanent,
  107. changeValue: 3000,
  108. effectDuration: EffectDuration.UntilEachTurnEnd,
  109. activateClass: activateClass));
  110. }
  111. }
  112. }
  113. }
  114. }
  115. #endregion
  116. #region When Digivolving
  117. if (timing == EffectTiming.OnEnterFieldAnyone)
  118. {
  119. ActivateClass activateClass = new ActivateClass();
  120. activateClass.SetUpICardEffect("Raid, +3000 DP", CanUseCondition, card);
  121. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  122. cardEffects.Add(activateClass);
  123. string EffectDiscription()
  124. {
  125. return "[When Digivolving] By trashing 1 card in your hand,for the turn, 1 of your Digimon gains <Raid> and gets +3000 DP.";
  126. }
  127. bool CanSelectPermanentCondition(Permanent permanent)
  128. {
  129. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  130. }
  131. bool CanUseCondition(Hashtable hashtable)
  132. {
  133. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  134. CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  135. }
  136. bool CanActivateCondition(Hashtable hashtable)
  137. {
  138. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  139. card.Owner.HandCards.Count > 0;
  140. }
  141. IEnumerator ActivateCoroutine(Hashtable hashtable)
  142. {
  143. bool discarded = false;
  144. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  145. selectHandEffect.SetUp(
  146. selectPlayer: card.Owner,
  147. canTargetCondition: (cardSource) => true,
  148. canTargetCondition_ByPreSelecetedList: null,
  149. canEndSelectCondition: null,
  150. maxCount: 1,
  151. canNoSelect: true,
  152. canEndNotMax: false,
  153. isShowOpponent: true,
  154. selectCardCoroutine: null,
  155. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  156. mode: SelectHandEffect.Mode.Discard,
  157. cardEffect: activateClass);
  158. yield return StartCoroutine(selectHandEffect.Activate());
  159. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  160. {
  161. if (cardSources.Count >= 1)
  162. {
  163. discarded = true;
  164. yield return null;
  165. }
  166. }
  167. if (discarded)
  168. {
  169. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  170. {
  171. Permanent selectedPermanent = null;
  172. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  173. selectPermanentEffect.SetUp(
  174. selectPlayer: card.Owner,
  175. canTargetCondition: CanSelectPermanentCondition,
  176. canTargetCondition_ByPreSelecetedList: null,
  177. canEndSelectCondition: null,
  178. maxCount: 1,
  179. canNoSelect: false,
  180. canEndNotMax: false,
  181. selectPermanentCoroutine: SelectPermanentCoroutine,
  182. afterSelectPermanentCoroutine: null,
  183. mode: SelectPermanentEffect.Mode.Custom,
  184. cardEffect: activateClass);
  185. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to gain Raid and +3000 DP", "Opponent is select 1 Digimon to gain Raid and +3000 DP");
  186. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  187. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  188. {
  189. selectedPermanent = permanent;
  190. yield return null;
  191. }
  192. if (selectedPermanent != null)
  193. {
  194. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainRaid(
  195. targetPermanent: selectedPermanent,
  196. effectDuration: EffectDuration.UntilEachTurnEnd,
  197. activateClass: activateClass));
  198. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  199. targetPermanent: selectedPermanent,
  200. changeValue: 3000,
  201. effectDuration: EffectDuration.UntilEachTurnEnd,
  202. activateClass: activateClass));
  203. }
  204. }
  205. }
  206. }
  207. }
  208. #endregion
  209. #region All Turns
  210. if (timing == EffectTiming.OnAddDigivolutionCards)
  211. {
  212. ActivateClass activateClass = new ActivateClass();
  213. activateClass.SetUpICardEffect("delete 1 of your opponent's Digimon", CanUseCondition, card);
  214. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  215. cardEffects.Add(activateClass);
  216. string EffectDiscription()
  217. {
  218. return "[All Turns] When Tamer cards are placed in this Digimon's digivolution cards, delete 1 of your opponent's Digimon with 6000 DP or less.";
  219. }
  220. bool IsOpponentsDigimon(Permanent permanent)
  221. {
  222. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) &&
  223. permanent.DP <= card.Owner.MaxDP_DeleteEffect(6000, activateClass);
  224. }
  225. bool CanUseCondition(Hashtable hashtable)
  226. {
  227. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  228. CardEffectCommons.CanTriggerOnAddDigivolutionCard(
  229. hashtable: hashtable,
  230. permanentCondition: permanent => permanent == card.PermanentOfThisCard(),
  231. cardEffectCondition: null,
  232. cardCondition: cardSource =>
  233. cardSource.IsTamer);
  234. }
  235. bool CanActivateCondition(Hashtable hashtable)
  236. {
  237. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  238. CardEffectCommons.HasMatchConditionPermanent(IsOpponentsDigimon);
  239. }
  240. IEnumerator ActivateCoroutine(Hashtable hashtable)
  241. {
  242. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  243. selectPermanentEffect.SetUp(
  244. selectPlayer: card.Owner,
  245. canTargetCondition: IsOpponentsDigimon,
  246. canTargetCondition_ByPreSelecetedList: null,
  247. canEndSelectCondition: null,
  248. maxCount: 1,
  249. canNoSelect: false,
  250. canEndNotMax: false,
  251. selectPermanentCoroutine: null,
  252. afterSelectPermanentCoroutine: null,
  253. mode: SelectPermanentEffect.Mode.Destroy,
  254. cardEffect: activateClass);
  255. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
  256. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  257. }
  258. }
  259. #endregion
  260. #region Your Turn - ESS
  261. if (timing == EffectTiming.None)
  262. {
  263. DisableEffectClass invalidationClass = new DisableEffectClass();
  264. invalidationClass.SetUpICardEffect("Ignore Security Effect", CanUseCondition, card);
  265. invalidationClass.SetUpDisableEffectClass(DisableCondition: InvalidateCondition);
  266. invalidationClass.SetIsInheritedEffect(true);
  267. cardEffects.Add(invalidationClass);
  268. bool CanUseCondition(Hashtable hashtable)
  269. {
  270. return true;
  271. }
  272. bool InvalidateCondition(ICardEffect cardEffect)
  273. {
  274. if (CardEffectCommons.IsExistOnBattleArea(card))
  275. {
  276. if (CardEffectCommons.IsOwnerTurn(card))
  277. {
  278. if (card.PermanentOfThisCard().TopCard.HasSocTraits || card.PermanentOfThisCard().TopCard.HasSeekersTraits)
  279. {
  280. if (cardEffect != null)
  281. {
  282. if (cardEffect.EffectSourceCard != null)
  283. {
  284. if (cardEffect.EffectSourceCard.IsOption)
  285. {
  286. if (cardEffect.IsSecurityEffect)
  287. {
  288. if (GManager.instance.attackProcess.AttackingPermanent == card.PermanentOfThisCard())
  289. {
  290. return true;
  291. }
  292. }
  293. }
  294. }
  295. }
  296. }
  297. }
  298. }
  299. return false;
  300. }
  301. }
  302. #endregion
  303. return cardEffects;
  304. }
  305. }
  306. }