LM_026.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.LM
  4. {
  5. public class LM_026 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Alternate Digivolution
  11. if (timing == EffectTiming.None)
  12. {
  13. bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. return targetPermanent.TopCard.ContainsCardName("Growlmon") && targetPermanent.TopCard.HasLevel &&
  16. targetPermanent.TopCard.Level == 5;
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition,
  19. digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  20. }
  21. #endregion
  22. #region Ace - Blast Digivolve
  23. if (timing == EffectTiming.OnCounterTiming)
  24. {
  25. cardEffects.Add(CardEffectFactory.BlastDigivolveEffect(card: card, condition: null));
  26. }
  27. #endregion
  28. #region On Play
  29. if (timing == EffectTiming.OnEnterFieldAnyone)
  30. {
  31. ActivateClass activateClass = new ActivateClass();
  32. activateClass.SetUpICardEffect("Delete 1 of your opponent's Digimon with 11000 DP or less.", CanUseCondition, card);
  33. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  34. cardEffects.Add(activateClass);
  35. string EffectDescription()
  36. {
  37. return "[On Play] Delete 1 of your opponent's Digimon with 11000 DP or less.";
  38. }
  39. bool CanUseCondition(Hashtable hashtable)
  40. {
  41. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  42. }
  43. bool CanSelectPermanentCondition(Permanent permanent)
  44. {
  45. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) &&
  46. permanent.DP <= card.Owner.MaxDP_DeleteEffect(11000, activateClass);
  47. }
  48. bool CanActivateCondition(Hashtable hashtable)
  49. {
  50. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  51. CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition);
  52. }
  53. IEnumerator ActivateCoroutine(Hashtable hashtable)
  54. {
  55. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  56. selectPermanentEffect.SetUp(
  57. selectPlayer: card.Owner,
  58. canTargetCondition: CanSelectPermanentCondition,
  59. canTargetCondition_ByPreSelecetedList: null,
  60. canEndSelectCondition: null,
  61. maxCount: 1,
  62. canNoSelect: false,
  63. canEndNotMax: false,
  64. selectPermanentCoroutine: null,
  65. afterSelectPermanentCoroutine: null,
  66. mode: SelectPermanentEffect.Mode.Destroy,
  67. cardEffect: activateClass);
  68. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  69. }
  70. }
  71. #endregion
  72. #region When Digivolving
  73. if (timing == EffectTiming.OnEnterFieldAnyone)
  74. {
  75. ActivateClass activateClass = new ActivateClass();
  76. activateClass.SetUpICardEffect("Delete 1 of your opponent's Digimon with 11000 DP or less.", CanUseCondition, card);
  77. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  78. cardEffects.Add(activateClass);
  79. string EffectDescription()
  80. {
  81. return "[When Digivolving] Delete 1 of your opponent's Digimon with 11000 DP or less.";
  82. }
  83. bool CanUseCondition(Hashtable hashtable)
  84. {
  85. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  86. }
  87. bool CanSelectPermanentCondition(Permanent permanent)
  88. {
  89. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) &&
  90. permanent.DP <= card.Owner.MaxDP_DeleteEffect(11000, activateClass);
  91. }
  92. bool CanActivateCondition(Hashtable hashtable)
  93. {
  94. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  95. CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition);
  96. }
  97. IEnumerator ActivateCoroutine(Hashtable hashtable)
  98. {
  99. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  100. selectPermanentEffect.SetUp(
  101. selectPlayer: card.Owner,
  102. canTargetCondition: CanSelectPermanentCondition,
  103. canTargetCondition_ByPreSelecetedList: null,
  104. canEndSelectCondition: null,
  105. maxCount: 1,
  106. canNoSelect: false,
  107. canEndNotMax: false,
  108. selectPermanentCoroutine: null,
  109. afterSelectPermanentCoroutine: null,
  110. mode: SelectPermanentEffect.Mode.Destroy,
  111. cardEffect: activateClass);
  112. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  113. }
  114. }
  115. #endregion
  116. #region All Turns
  117. if (timing == EffectTiming.WhenRemoveField)
  118. {
  119. ActivateClass activateClass = new ActivateClass();
  120. activateClass.SetUpICardEffect("Play a [Guilmon] from digivolution cards or from trash.", CanUseCondition, card);
  121. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  122. cardEffects.Add(activateClass);
  123. string EffectDescription()
  124. {
  125. return
  126. "[All Turns] When this Digimon would leave the battle area, by playing 1 [Guilmon] from this Digimon's digivolution cards or from your trash, place this Digimon as that Digimon's bottom digivolution card.";
  127. }
  128. bool CanUseCondition(Hashtable hashtable)
  129. {
  130. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  131. CardEffectCommons.CanTriggerWhenRemoveField(hashtable, card) &&
  132. !activateClass.IsSameEffect(CardEffectCommons.GetCardEffectFromHashtable(hashtable));
  133. }
  134. bool CanSelectCardCondition(CardSource cardSource)
  135. {
  136. return cardSource.EqualsCardName("Guilmon") &&
  137. CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass);
  138. }
  139. bool CanActivateCondition(Hashtable hashtable)
  140. {
  141. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  142. (card.PermanentOfThisCard().DigivolutionCards.Some(CanSelectCardCondition) ||
  143. CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition));
  144. }
  145. IEnumerator ActivateCoroutine(Hashtable hashtable)
  146. {
  147. bool canSelectDigivolutionCards = card.PermanentOfThisCard().DigivolutionCards.Some(CanSelectCardCondition);
  148. bool canSelectTrash = CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition);
  149. if (canSelectTrash || canSelectDigivolutionCards)
  150. {
  151. if (canSelectTrash && canSelectDigivolutionCards)
  152. {
  153. List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
  154. {
  155. new(message: "From digivolution cards", value: true, spriteIndex: 0),
  156. new(message: "From trash", value: false, spriteIndex: 1),
  157. };
  158. string selectPlayerMessage = "From which area will you play a [Guilmon]?";
  159. string notSelectPlayerMessage = "The opponent is choosing from which area to play a [Lucemon].";
  160. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements,
  161. selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage,
  162. notSelectPlayerMessage: notSelectPlayerMessage);
  163. }
  164. else
  165. {
  166. GManager.instance.userSelectionManager.SetBool(canSelectDigivolutionCards);
  167. }
  168. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager
  169. .WaitForEndSelect());
  170. bool fromDigivolution = GManager.instance.userSelectionManager.SelectedBoolValue;
  171. CardSource selectedCard = null;
  172. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  173. selectCardEffect.SetUp(
  174. canTargetCondition: CanSelectCardCondition,
  175. canTargetCondition_ByPreSelecetedList: null,
  176. canEndSelectCondition: null,
  177. canNoSelect: () => false,
  178. selectCardCoroutine: SelectCardCoroutine,
  179. afterSelectCardCoroutine: null,
  180. message: "Select a [Guilmon] to play.",
  181. maxCount: 1,
  182. canEndNotMax: false,
  183. isShowOpponent: false,
  184. mode: SelectCardEffect.Mode.Custom,
  185. root: SelectCardEffect.Root.Custom,
  186. customRootCardList: fromDigivolution ? card.PermanentOfThisCard().DigivolutionCards : card.Owner.TrashCards,
  187. canLookReverseCard: true,
  188. selectPlayer: card.Owner,
  189. cardEffect: activateClass);
  190. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  191. IEnumerator SelectCardCoroutine(CardSource cardSource)
  192. {
  193. selectedCard = cardSource;
  194. yield return null;
  195. }
  196. if (selectedCard)
  197. {
  198. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  199. cardSources: new List<CardSource> { selectedCard },
  200. activateClass: activateClass,
  201. payCost: false,
  202. isTapped: false,
  203. root: fromDigivolution ? SelectCardEffect.Root.DigivolutionCards : SelectCardEffect.Root.Trash,
  204. activateETB: true));
  205. yield return ContinuousController.instance.StartCoroutine(selectedCard.PermanentOfThisCard()
  206. .AddDigivolutionCardsBottom(new List<CardSource> { card }, activateClass));
  207. }
  208. }
  209. }
  210. }
  211. #endregion
  212. #region Rule Text
  213. if (timing == EffectTiming.None)
  214. {
  215. ChangeCardNamesClass changeCardNamesClass = new ChangeCardNamesClass();
  216. changeCardNamesClass.SetUpICardEffect("Also treated as [ChaosGallantmon]", _ => true, card);
  217. changeCardNamesClass.SetUpChangeCardNamesClass(changeCardNames: ChangeCardNames);
  218. cardEffects.Add(changeCardNamesClass);
  219. List<string> ChangeCardNames(CardSource cardSource, List<string> cardNames)
  220. {
  221. if (cardSource == card)
  222. {
  223. cardNames.Add("ChaosGallantmon");
  224. }
  225. return cardNames;
  226. }
  227. }
  228. #endregion
  229. #region All Turns - ESS
  230. if (timing == EffectTiming.None)
  231. {
  232. ChangeDPDeleteEffectMaxDPClass changeDPDeleteEffectMaxDPClass = new ChangeDPDeleteEffectMaxDPClass();
  233. changeDPDeleteEffectMaxDPClass.SetUpICardEffect("Maximum DP of DP-based deletion effects gets +5000 DP",
  234. CanUseCondition, card);
  235. changeDPDeleteEffectMaxDPClass.SetUpChangeDPDeleteEffectMaxDPClass(changeMaxDP: ChangeMaxDP);
  236. changeDPDeleteEffectMaxDPClass.SetIsInheritedEffect(true);
  237. cardEffects.Add(changeDPDeleteEffectMaxDPClass);
  238. bool CanUseCondition(Hashtable hashtable)
  239. {
  240. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  241. card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard());
  242. }
  243. int ChangeMaxDP(int maxDP, ICardEffect cardEffect)
  244. {
  245. if (cardEffect != null &&
  246. cardEffect.EffectSourceCard &&
  247. cardEffect.EffectSourceCard.Owner == card.Owner &&
  248. cardEffect.EffectSourceCard.PermanentOfThisCard() == card.PermanentOfThisCard())
  249. {
  250. maxDP += 5000;
  251. }
  252. return maxDP;
  253. }
  254. }
  255. #endregion
  256. return cardEffects;
  257. }
  258. }
  259. }