BT25_015.cs 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // Garudamon
  4. namespace DCGO.CardEffects.BT25
  5. {
  6. public class BT25_015 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alternative Digivolve Condition
  12. if (timing == EffectTiming.None)
  13. {
  14. static bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.EqualsTraits("Giant Bird")
  17. || targetPermanent.TopCard.HasTSTraits;
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(PermanentCondition, 3, false, card, null, level: 4));
  20. }
  21. #endregion
  22. #region Raid
  23. if (timing == EffectTiming.OnAllyAttack)
  24. {
  25. cardEffects.Add(CardEffectFactory.RaidSelfEffect(isInheritedEffect: false, card: card, condition: null));
  26. }
  27. #endregion
  28. #region Fortitude
  29. if (timing == EffectTiming.OnDestroyedAnyone)
  30. {
  31. cardEffects.Add(CardEffectFactory.FortitudeSelfEffect(isInheritedEffect: false, card: card, condition: null));
  32. }
  33. #endregion
  34. #region OP/WD Shared
  35. string SharedEffectName = "Delete 1 enemy Digimon with 6K DP or less";
  36. CardEffectFactory.ActivateClassesForSharedEffects
  37. (ref cardEffects, timing, card,
  38. SharedEffectName,
  39. SharedActivateCoroutine,
  40. SharedEffectDescription,
  41. optional: false,
  42. onPlay: true,
  43. whenDigivolving: true);
  44. string SharedEffectDescription(string tag)
  45. {
  46. return $"[{tag}] Delete 1 of your opponent's Digimon with 6000 DP or less.";
  47. }
  48. IEnumerator SharedActivateCoroutine(Hashtable _hashtable, ActivateClass activateClass)
  49. {
  50. bool CanSelectPermanentCondition(Permanent permanent)
  51. {
  52. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
  53. && permanent.HasDP
  54. && permanent.DP <= card.Owner.MaxDP_DeleteEffect(6000, activateClass);
  55. }
  56. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  57. {
  58. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  59. selectPermanentEffect.SetUp(
  60. selectPlayer: card.Owner,
  61. canTargetCondition: CanSelectPermanentCondition,
  62. canTargetCondition_ByPreSelecetedList: null,
  63. canEndSelectCondition: null,
  64. maxCount: 1,
  65. canNoSelect: false,
  66. canEndNotMax: false,
  67. selectPermanentCoroutine: null,
  68. afterSelectPermanentCoroutine: null,
  69. mode: SelectPermanentEffect.Mode.Destroy,
  70. cardEffect: activateClass);
  71. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  72. }
  73. }
  74. #endregion
  75. #region ESS
  76. if (timing == EffectTiming.OnEndBattle)
  77. {
  78. ActivateClass activateClass = new ActivateClass();
  79. activateClass.SetUpICardEffect("Trash top security", CanUseCondition, card);
  80. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  81. activateClass.SetHashString("BT25_015_Inherited");
  82. activateClass.SetIsInheritedEffect(true);
  83. cardEffects.Add(activateClass);
  84. string EffectDescription()
  85. {
  86. return "[All Turns] [Once Per Turn] When this Digimon deletes your opponent's Digimon in battle, trash their top security card.";
  87. }
  88. bool WinnerCondition(Permanent permanent) => permanent.cardSources.Contains(card);
  89. bool LoserCondition(Permanent permanent) => CardEffectCommons.IsOpponentPermanent(permanent, card);
  90. bool CanUseCondition(Hashtable hashtable)
  91. {
  92. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  93. CardEffectCommons.CanTriggerWhenDeleteOpponentDigimonByBattle(hashtable: hashtable,
  94. winnerCondition: WinnerCondition, loserCondition: LoserCondition, isOnlyWinnerSurvive: false);
  95. }
  96. bool CanActivateCondition(Hashtable hashtable)
  97. {
  98. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  99. }
  100. IEnumerator ActivateCoroutine(Hashtable hashtable)
  101. {
  102. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  103. player: card.Owner.Enemy,
  104. destroySecurityCount: 1,
  105. cardEffect: activateClass,
  106. fromTop: true).DestroySecurity());
  107. }
  108. }
  109. #endregion
  110. return cardEffects;
  111. }
  112. }
  113. }