BT11_059.cs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT11
  5. {
  6. public class BT11_059 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. if (timing == EffectTiming.None)
  12. {
  13. bool Condition()
  14. {
  15. return !CardEffectCommons.IsExistOnField(card);
  16. }
  17. bool PermanentCondition(Permanent targetPermanent)
  18. {
  19. return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(targetPermanent, card);
  20. }
  21. bool CardSourceCondition(CardSource cardSource)
  22. {
  23. return cardSource == card;
  24. }
  25. bool RootCondition(SelectCardEffect.Root root)
  26. {
  27. return true;
  28. }
  29. int ReduceCost()
  30. {
  31. return CardEffectCommons.MatchConditionOwnersPermanentCount(card, (permanent) => (permanent.TopCard.CardColors.Contains(CardColor.Green) || permanent.TopCard.CardColors.Contains(CardColor.Black)) && permanent.IsTamer);
  32. }
  33. cardEffects.Add(CardEffectFactory.ChangeDigivolutionCostStaticEffect<Func<int>>(
  34. changeValue: () => -ReduceCost(),
  35. permanentCondition: PermanentCondition,
  36. cardCondition: CardSourceCondition,
  37. rootCondition: RootCondition,
  38. isInheritedEffect: false,
  39. card: card,
  40. condition: Condition,
  41. setFixedCost: false));
  42. }
  43. if (timing == EffectTiming.OnEndBattle)
  44. {
  45. ActivateClass activateClass = new ActivateClass();
  46. activateClass.SetUpICardEffect("Unsuspend this Digimon", CanUseCondition, card);
  47. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  48. activateClass.SetHashString("Unsuspend_BT11_059");
  49. cardEffects.Add(activateClass);
  50. string EffectDiscription()
  51. {
  52. return "[All Turns][Once Per Turn] When this Digimon deletes an opponent's Digimon in battle, unsuspend this Digimon.";
  53. }
  54. bool CanUseCondition(Hashtable hashtable)
  55. {
  56. if (CardEffectCommons.IsExistOnBattleArea(card))
  57. {
  58. bool WinnerCondition(Permanent permanent) => permanent.cardSources.Contains(card);
  59. bool LoserCondition(Permanent permanent) => CardEffectCommons.IsOpponentPermanent(permanent, card);
  60. if (CardEffectCommons.CanTriggerWhenDeleteOpponentDigimonByBattle(hashtable: hashtable, winnerCondition: WinnerCondition, loserCondition: LoserCondition, isOnlyWinnerSurvive: false))
  61. {
  62. return true;
  63. }
  64. }
  65. return false;
  66. }
  67. bool CanActivateCondition(Hashtable hashtable)
  68. {
  69. if (CardEffectCommons.IsExistOnBattleArea(card))
  70. {
  71. return true;
  72. }
  73. return false;
  74. }
  75. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  76. {
  77. Permanent selectedPermanent = card.PermanentOfThisCard();
  78. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { selectedPermanent }, activateClass).Unsuspend());
  79. }
  80. }
  81. return cardEffects;
  82. }
  83. }
  84. }