BT21_026.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT21
  5. {
  6. public class BT21_026 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Play Cost Reduction
  12. if (timing == EffectTiming.None)
  13. {
  14. int count()
  15. {
  16. return 2 * card.Owner.Enemy.GetBattleAreaPermanents().Count((permanent) => permanent.IsDigimon);
  17. }
  18. ChangeCostClass changeCostClass = new ChangeCostClass();
  19. changeCostClass.SetUpICardEffect($"Reduce Play Cost", CanUseCondition, card);
  20. changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
  21. changeCostClass.SetNotShowUI(true);
  22. cardEffects.Add(changeCostClass);
  23. bool CanUseCondition(Hashtable hashtable)
  24. {
  25. return true;
  26. }
  27. int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
  28. {
  29. if (CardSourceCondition(cardSource) && RootCondition(root) && PermanentsCondition(targetPermanents))
  30. {
  31. Cost -= count();
  32. }
  33. return Cost;
  34. }
  35. bool PermanentsCondition(List<Permanent> targetPermanents)
  36. {
  37. return targetPermanents == null ||
  38. targetPermanents.Count((targetPermanent) => targetPermanent != null) == 0;
  39. }
  40. bool CardSourceCondition(CardSource cardSource)
  41. {
  42. return cardSource == card;
  43. }
  44. bool RootCondition(SelectCardEffect.Root root)
  45. {
  46. return true;
  47. }
  48. bool isUpDown()
  49. {
  50. return true;
  51. }
  52. }
  53. #endregion
  54. #region Rush/Raid/Blocker
  55. if (timing == EffectTiming.None)
  56. {
  57. cardEffects.Add(CardEffectFactory.RushSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  58. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  59. }
  60. if (timing == EffectTiming.OnAllyAttack)
  61. {
  62. cardEffects.Add(CardEffectFactory.RaidSelfEffect(isInheritedEffect: false, card: card, condition: null));
  63. }
  64. #endregion
  65. #region All Turns
  66. if (timing == EffectTiming.OnDestroyedAnyone)
  67. {
  68. ActivateClass activateClass = new ActivateClass();
  69. activateClass.SetUpICardEffect("Unsuspend", CanUseCondition, card);
  70. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  71. activateClass.SetHashString("Unsuspend_BT21-026");
  72. cardEffects.Add(activateClass);
  73. string EffectDiscription()
  74. {
  75. return "[All Turns] [Once Per Turn] When any of your opponent's Digimon are deleted, this Digimon may unsuspend.";
  76. }
  77. bool IsOpponentsDigimon(Permanent permanent)
  78. {
  79. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  80. }
  81. bool CanUseCondition(Hashtable hashtable)
  82. {
  83. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  84. CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable, IsOpponentsDigimon, activateClass);
  85. }
  86. bool CanActivateCondition(Hashtable hashtable)
  87. {
  88. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  89. }
  90. IEnumerator ActivateCoroutine(Hashtable hashtable)
  91. {
  92. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { card.PermanentOfThisCard() }, activateClass).Unsuspend());
  93. }
  94. }
  95. #endregion
  96. return cardEffects;
  97. }
  98. }
  99. }