BT24_015.cs 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. //MetalGreymon
  4. namespace DCGO.CardEffects.BT24
  5. {
  6. public class BT24_015 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Blocker
  12. if (timing == EffectTiming.None)
  13. {
  14. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(
  15. isInheritedEffect: false,
  16. card: card,
  17. condition: null));
  18. }
  19. #endregion
  20. #region Alternative Digivolution Condition
  21. if (timing == EffectTiming.None)
  22. {
  23. bool PermanentCondition(Permanent targetPermanent)
  24. {
  25. return targetPermanent.TopCard.HasLevel &&
  26. targetPermanent.TopCard.IsLevel4 &&
  27. (targetPermanent.TopCard.ContainsCardName("Greymon") ||
  28. targetPermanent.TopCard.HasTSTraits);
  29. }
  30. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  31. permanentCondition: PermanentCondition,
  32. digivolutionCost: 3,
  33. ignoreDigivolutionRequirement: false,
  34. card: card,
  35. condition: null)
  36. );
  37. }
  38. #endregion
  39. #region Security
  40. if (timing == EffectTiming.SecuritySkill)
  41. {
  42. ActivateClass activateClass = new ActivateClass();
  43. activateClass.SetUpICardEffect("Play this card without battling", CanUseCondition, card);
  44. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  45. activateClass.SetIsSecurityEffect(true);
  46. cardEffects.Add(activateClass);
  47. string EffectDescription()
  48. {
  49. return "[Security] If your opponent has a level 6 or higher Digimon, play this card without battling and without paying the cost.";
  50. }
  51. bool CanUseCondition(Hashtable hashtable)
  52. {
  53. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  54. }
  55. bool PermamentCondition(Permanent permanent)
  56. {
  57. return permanent.IsDigimon &&
  58. permanent.TopCard.HasLevel &&
  59. permanent.Level >= 6;
  60. }
  61. bool CanActivateCondition(Hashtable hashtable)
  62. {
  63. return card.Owner.ExecutingCards.Contains(card) &&
  64. CardEffectCommons.HasMatchConditionOpponentsPermanent(card, PermamentCondition) &&
  65. CardEffectCommons.CanPlayAsNewPermanent(cardSource: card, payCost: false, cardEffect: activateClass);
  66. }
  67. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  68. {
  69. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: new List<CardSource>() { card }, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Execution, activateETB: true));
  70. }
  71. }
  72. #endregion
  73. #region All Turns
  74. if (timing == EffectTiming.OnAttackTargetChanged)
  75. {
  76. ActivateClass activateClass = new ActivateClass();
  77. activateClass.SetUpICardEffect("Delete lowest DP", CanUseCondition, card);
  78. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  79. activateClass.SetHashString("AT_BT24-015");
  80. cardEffects.Add(activateClass);
  81. string EffectDescription()
  82. {
  83. return "[All Turns] [Once Per Turn] When attack targets change, delete 1 of your opponent's Digimon with the lowest DP.";
  84. }
  85. bool CanSelectPermanentCondition1(Permanent permanent)
  86. {
  87. return CardEffectCommons.IsMinDP(permanent, card.Owner.Enemy);
  88. }
  89. bool CanUseCondition(Hashtable hashtable)
  90. {
  91. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  92. CardEffectCommons.CanTriggerOnPermanentAttackTargetSwitch(hashtable, _ => true);
  93. }
  94. bool CanActivateCondition(Hashtable hashtable)
  95. {
  96. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  97. }
  98. IEnumerator ActivateCoroutine(Hashtable hashtable)
  99. {
  100. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  101. {
  102. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  103. selectPermanentEffect.SetUp(
  104. selectPlayer: card.Owner,
  105. canTargetCondition: CanSelectPermanentCondition1,
  106. canTargetCondition_ByPreSelecetedList: null,
  107. canEndSelectCondition: null,
  108. maxCount: 1,
  109. canNoSelect: false,
  110. canEndNotMax: false,
  111. selectPermanentCoroutine: null,
  112. afterSelectPermanentCoroutine: null,
  113. mode: SelectPermanentEffect.Mode.Destroy,
  114. cardEffect: activateClass);
  115. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  116. }
  117. }
  118. }
  119. #endregion
  120. #region WA ESS
  121. if (timing == EffectTiming.OnAllyAttack)
  122. {
  123. ActivateClass activateClass = new ActivateClass();
  124. activateClass.SetUpICardEffect("Delete 1 <Blocker>", CanUseCondition, card);
  125. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  126. activateClass.SetHashString("WAESS_BT24-015");
  127. activateClass.SetIsInheritedEffect(true);
  128. cardEffects.Add(activateClass);
  129. string EffectDescription()
  130. {
  131. return "[When Attacking] [Once Per Turn] Delete 1 of your opponent's Digimon with <Blocker>";
  132. }
  133. bool CanSelectPermanentCondition(Permanent permanent)
  134. {
  135. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) &&
  136. permanent.HasBlocker;
  137. }
  138. bool CanUseCondition(Hashtable hashtable)
  139. {
  140. return CardEffectCommons.CanTriggerOnAttack(hashtable, card) ;
  141. }
  142. bool CanActivateCondition(Hashtable hashtable)
  143. {
  144. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  145. }
  146. IEnumerator ActivateCoroutine(Hashtable hashtable)
  147. {
  148. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  149. {
  150. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  151. selectPermanentEffect.SetUp(
  152. selectPlayer: card.Owner,
  153. canTargetCondition: CanSelectPermanentCondition,
  154. canTargetCondition_ByPreSelecetedList: null,
  155. canEndSelectCondition: null,
  156. maxCount: 1,
  157. canNoSelect: false,
  158. canEndNotMax: false,
  159. selectPermanentCoroutine: null,
  160. afterSelectPermanentCoroutine: null,
  161. mode: SelectPermanentEffect.Mode.Destroy,
  162. cardEffect: activateClass);
  163. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  164. }
  165. }
  166. }
  167. #endregion
  168. return cardEffects;
  169. }
  170. }
  171. }