Vespamon_BT19_052.cs 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT19
  5. {
  6. public class Vespamon_BT19_052 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alternate Digivolution
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.IsLevel4 &&
  17. targetPermanent.TopCard.EqualsTraits("Royal Base");
  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/When Digivolving Shared
  25. int maxCost()
  26. {
  27. return 2 + (card.Owner.SecurityCards.Count(cardSource => !cardSource.IsFlipped)*2);
  28. }
  29. bool IsOpponenetsDigimon(Permanent permanent)
  30. {
  31. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) &&
  32. permanent.TopCard.GetCostItself <= maxCost();
  33. }
  34. #endregion
  35. #region On Play
  36. if (timing == EffectTiming.OnEnterFieldAnyone)
  37. {
  38. ActivateClass activateClass = new ActivateClass();
  39. activateClass.SetUpICardEffect("Delete 1 Digimon with a play cost of 2 or less", CanUseCondition, card);
  40. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  41. cardEffects.Add(activateClass);
  42. string EffectDiscription()
  43. {
  44. return "[On Play] Delete 1 of your opponent's Digimon with a play cost of 2 or less. For each of your face up security cards, add 2 to this effect's play cost.";
  45. }
  46. bool CanUseCondition(Hashtable hashtable)
  47. {
  48. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  49. }
  50. bool CanActivateCondition(Hashtable hashtable)
  51. {
  52. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  53. }
  54. IEnumerator ActivateCoroutine(Hashtable hashtable)
  55. {
  56. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  57. selectPermanentEffect.SetUp(
  58. selectPlayer: card.Owner,
  59. canTargetCondition: IsOpponenetsDigimon,
  60. canTargetCondition_ByPreSelecetedList: null,
  61. canEndSelectCondition: null,
  62. maxCount: 1,
  63. canNoSelect: false,
  64. canEndNotMax: false,
  65. selectPermanentCoroutine: null,
  66. afterSelectPermanentCoroutine: null,
  67. mode: SelectPermanentEffect.Mode.Destroy,
  68. cardEffect: activateClass);
  69. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  70. }
  71. }
  72. #endregion
  73. #region When Digivolving
  74. if (timing == EffectTiming.OnEnterFieldAnyone)
  75. {
  76. ActivateClass activateClass = new ActivateClass();
  77. activateClass.SetUpICardEffect("Delete 1 Digimon with a play cost of 2 or less", CanUseCondition, card);
  78. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  79. cardEffects.Add(activateClass);
  80. string EffectDiscription()
  81. {
  82. return "[When Digivolving] Delete 1 of your opponent's Digimon with a play cost of 2 or less. For each of your face up security cards, add 2 to this effect's play cost.";
  83. }
  84. bool CanUseCondition(Hashtable hashtable)
  85. {
  86. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  87. }
  88. bool CanActivateCondition(Hashtable hashtable)
  89. {
  90. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  91. }
  92. IEnumerator ActivateCoroutine(Hashtable hashtable)
  93. {
  94. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  95. selectPermanentEffect.SetUp(
  96. selectPlayer: card.Owner,
  97. canTargetCondition: IsOpponenetsDigimon,
  98. canTargetCondition_ByPreSelecetedList: null,
  99. canEndSelectCondition: null,
  100. maxCount: 1,
  101. canNoSelect: false,
  102. canEndNotMax: false,
  103. selectPermanentCoroutine: null,
  104. afterSelectPermanentCoroutine: null,
  105. mode: SelectPermanentEffect.Mode.Destroy,
  106. cardEffect: activateClass);
  107. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  108. }
  109. }
  110. #endregion
  111. #region All Turns - ESS
  112. if (timing == EffectTiming.OnEndBattle)
  113. {
  114. ActivateClass activateClass = new ActivateClass();
  115. activateClass.SetUpICardEffect("Trash the top card of opponent's security", CanUseCondition, card);
  116. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  117. activateClass.SetIsInheritedEffect(true);
  118. activateClass.SetHashString("TrashSecurity_BT18_052");
  119. cardEffects.Add(activateClass);
  120. string EffectDiscription()
  121. {
  122. return "[All Turns] [Once Per Turn] When this Digimon deletes an opponent's Digimon in battle, trash the top card of your opponent's security stack.";
  123. }
  124. bool CanUseCondition(Hashtable hashtable)
  125. {
  126. if (CardEffectCommons.IsExistOnBattleArea(card))
  127. {
  128. bool WinnerCondition(Permanent permanent) => permanent.cardSources.Contains(card);
  129. bool LoserCondition(Permanent permanent) => CardEffectCommons.IsOpponentPermanent(permanent, card);
  130. if (CardEffectCommons.CanTriggerWhenDeleteOpponentDigimonByBattle(hashtable: hashtable, winnerCondition: WinnerCondition, loserCondition: LoserCondition, isOnlyWinnerSurvive: false))
  131. {
  132. return true;
  133. }
  134. }
  135. return false;
  136. }
  137. bool CanActivateCondition(Hashtable hashtable)
  138. {
  139. if (CardEffectCommons.IsExistOnBattleArea(card))
  140. {
  141. return true;
  142. }
  143. return false;
  144. }
  145. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  146. {
  147. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  148. player: card.Owner.Enemy,
  149. destroySecurityCount: 1,
  150. cardEffect: activateClass,
  151. fromTop: true).DestroySecurity());
  152. }
  153. }
  154. #endregion
  155. #region All Turns - Security
  156. if (timing == EffectTiming.None)
  157. {
  158. bool CanUseCondition()
  159. {
  160. if (CardEffectCommons.IsExistInSecurity(card, true))
  161. {
  162. if (CardEffectCommons.IsOpponentTurn(card))
  163. {
  164. return true;
  165. }
  166. }
  167. return false;
  168. }
  169. bool PermanentCondition(Permanent permanent)
  170. {
  171. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  172. {
  173. if (permanent.TopCard.EqualsTraits("Royal Base"))
  174. {
  175. return true;
  176. }
  177. }
  178. return false;
  179. }
  180. cardEffects.Add(CardEffectFactory.BlockerStaticEffect(
  181. permanentCondition: PermanentCondition,
  182. isInheritedEffect: false,
  183. card: card,
  184. condition: CanUseCondition));
  185. }
  186. #endregion
  187. return cardEffects;
  188. }
  189. }
  190. }