BT21_068.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. //BT21_068 growlmon
  5. namespace DCGO.CardEffects.BT21
  6. {
  7. public class BT21_068 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region alternative digivolution requirement
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent permanent)
  16. {
  17. return permanent.Level == 3 && permanent.TopCard.ContainsCardName("Guilmon");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  20. permanentCondition: PermanentCondition,
  21. digivolutionCost: 2,
  22. ignoreDigivolutionRequirement: false,
  23. card: card,
  24. condition: null));
  25. }
  26. #endregion
  27. #region on-play/when-digivolving shared
  28. bool CanActivateConditionShared(Hashtable hashtable)
  29. {
  30. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  31. }
  32. #endregion
  33. #region On Play
  34. if(timing == EffectTiming.OnEnterFieldAnyone)
  35. {
  36. ActivateClass activateClass = new ActivateClass();
  37. activateClass.SetUpICardEffect("Delete 3k or mill 2", CanUseCondition, card);
  38. activateClass.SetUpActivateClass(CanActivateConditionShared, ActivateCoroutine, -1, false, EffectDescription());
  39. cardEffects.Add(activateClass);
  40. string EffectDescription()
  41. {
  42. return "[On Play] Delete 1 of your opponent's Digimon with 4000 DP or less. If this effect didn't delete, trash the top 2 cards of your deck.";
  43. }
  44. bool CanUseCondition(Hashtable hashtable)
  45. {
  46. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  47. }
  48. bool CanTarget(Permanent permanent)
  49. {
  50. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  51. {
  52. return permanent.DP <= card.Owner.MaxDP_DeleteEffect(4000, activateClass);
  53. }
  54. return false;
  55. }
  56. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  57. {
  58. List<Permanent> deleteTargetPermanents = new List<Permanent>();
  59. if (CardEffectCommons.HasMatchConditionPermanent(CanTarget))
  60. {
  61. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanTarget));
  62. SelectPermanentEffect selectPermanentEffect =
  63. GManager.instance.GetComponent<SelectPermanentEffect>();
  64. selectPermanentEffect.SetUp(
  65. selectPlayer: card.Owner,
  66. canTargetCondition: CanTarget,
  67. canTargetCondition_ByPreSelecetedList: null,
  68. canEndSelectCondition: null,
  69. maxCount: maxCount,
  70. canNoSelect: false,
  71. canEndNotMax: false,
  72. selectPermanentCoroutine: null,
  73. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
  74. mode: SelectPermanentEffect.Mode.Custom,
  75. cardEffect: activateClass);
  76. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
  77. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  78. IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
  79. {
  80. deleteTargetPermanents = permanents.Clone();
  81. yield return null;
  82. }
  83. }
  84. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: deleteTargetPermanents, activateClass: activateClass, successProcess: null, failureProcess: FailureProcess));
  85. IEnumerator FailureProcess()
  86. {
  87. if (card.Owner.LibraryCards.Count >= 1)
  88. {
  89. yield return ContinuousController.instance.StartCoroutine(new IAddTrashCardsFromLibraryTop(2, card.Owner, activateClass).AddTrashCardsFromLibraryTop());
  90. }
  91. }
  92. }
  93. }
  94. #endregion
  95. #region When Digivolving
  96. if (timing == EffectTiming.OnEnterFieldAnyone)
  97. {
  98. ActivateClass activateClass = new ActivateClass();
  99. activateClass.SetUpICardEffect("Delete 3k or mill 2", CanUseCondition, card);
  100. activateClass.SetUpActivateClass(CanActivateConditionShared, ActivateCoroutine, -1, false, EffectDescription());
  101. cardEffects.Add(activateClass);
  102. string EffectDescription()
  103. {
  104. return "[On Play] Delete 1 of your opponent's Digimon with 4000 DP or less. If this effect didn't delete, trash the top 2 cards of your deck.";
  105. }
  106. bool CanUseCondition(Hashtable hashtable)
  107. {
  108. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  109. }
  110. bool CanTarget(Permanent permanent)
  111. {
  112. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  113. {
  114. return permanent.DP <= card.Owner.MaxDP_DeleteEffect(4000, activateClass);
  115. }
  116. return false;
  117. }
  118. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  119. {
  120. List<Permanent> deleteTargetPermanents = new List<Permanent>();
  121. if (CardEffectCommons.HasMatchConditionPermanent(CanTarget))
  122. {
  123. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanTarget));
  124. SelectPermanentEffect selectPermanentEffect =
  125. GManager.instance.GetComponent<SelectPermanentEffect>();
  126. selectPermanentEffect.SetUp(
  127. selectPlayer: card.Owner,
  128. canTargetCondition: CanTarget,
  129. canTargetCondition_ByPreSelecetedList: null,
  130. canEndSelectCondition: null,
  131. maxCount: maxCount,
  132. canNoSelect: false,
  133. canEndNotMax: false,
  134. selectPermanentCoroutine: null,
  135. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
  136. mode: SelectPermanentEffect.Mode.Custom,
  137. cardEffect: activateClass);
  138. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
  139. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  140. IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
  141. {
  142. deleteTargetPermanents = permanents.Clone();
  143. yield return null;
  144. }
  145. }
  146. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: deleteTargetPermanents, activateClass: activateClass, successProcess: null, failureProcess: FailureProcess));
  147. IEnumerator FailureProcess()
  148. {
  149. if (card.Owner.LibraryCards.Count >= 1)
  150. {
  151. yield return ContinuousController.instance.StartCoroutine(new IAddTrashCardsFromLibraryTop(2, card.Owner, activateClass).AddTrashCardsFromLibraryTop());
  152. }
  153. }
  154. }
  155. }
  156. #endregion
  157. #region On Deletion inherit
  158. if (timing == EffectTiming.OnDestroyedAnyone)
  159. {
  160. ActivateClass activateClass = new ActivateClass();
  161. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  162. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  163. activateClass.SetIsInheritedEffect(true);
  164. cardEffects.Add(activateClass);
  165. string EffectDescription()
  166. {
  167. return "[On Deletion] Gain 1 memory.";
  168. }
  169. bool CanUseCondition(Hashtable hashtable)
  170. {
  171. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card);
  172. }
  173. bool CanActivateCondition(Hashtable hashtable)
  174. {
  175. if (CardEffectCommons.CanActivateOnDeletionInherited(hashtable, card))
  176. {
  177. if (card.Owner.CanAddMemory(activateClass))
  178. {
  179. return true;
  180. }
  181. }
  182. return false;
  183. }
  184. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  185. {
  186. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  187. }
  188. }
  189. #endregion
  190. return cardEffects;
  191. }
  192. }
  193. }