EX1_043.cs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.EX1
  6. {
  7. public class EX1_043 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. if (timing == EffectTiming.OnEndBattle)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("Unsuspend this Digimon", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  17. activateClass.SetHashString("Unsuspend_EX1_043");
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[Your Turn][Once Per Turn] When one of your Digimon with [Insectoid] or [Ancient Insect] in its traits deletes an opponent's Digimon in battle and survives, you may unsuspend this Digimon.";
  22. }
  23. bool PermanentCondition(Permanent permanent)
  24. {
  25. if (permanent.TopCard.Owner == card.Owner)
  26. {
  27. if (permanent.TopCard.CardTraits.Contains("Insectoid"))
  28. {
  29. return true;
  30. }
  31. if (permanent.TopCard.CardTraits.Contains("Ancient Insect"))
  32. {
  33. return true;
  34. }
  35. if (permanent.TopCard.CardTraits.Contains("AncientInsect"))
  36. {
  37. return true;
  38. }
  39. }
  40. return false;
  41. }
  42. bool CanUseCondition(Hashtable hashtable)
  43. {
  44. if (CardEffectCommons.IsExistOnBattleArea(card))
  45. {
  46. if (CardEffectCommons.IsOwnerTurn(card))
  47. {
  48. bool WinnerCondition(Permanent permanent) => PermanentCondition(permanent);
  49. bool LoserCondition(Permanent permanent) => CardEffectCommons.IsOpponentPermanent(permanent, card);
  50. if (CardEffectCommons.CanTriggerWhenDeleteOpponentDigimonByBattle(hashtable: hashtable, winnerCondition: WinnerCondition, loserCondition: LoserCondition, isOnlyWinnerSurvive: true))
  51. {
  52. return true;
  53. }
  54. }
  55. }
  56. return false;
  57. }
  58. bool CanActivateCondition(Hashtable hashtable)
  59. {
  60. if (CardEffectCommons.IsExistOnBattleArea(card))
  61. {
  62. if (CardEffectCommons.CanUnsuspend(card.PermanentOfThisCard()))
  63. {
  64. return true;
  65. }
  66. }
  67. return false;
  68. }
  69. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  70. {
  71. Permanent selectedPermanent = card.PermanentOfThisCard();
  72. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { selectedPermanent }, activateClass).Unsuspend());
  73. }
  74. }
  75. if (timing == EffectTiming.None)
  76. {
  77. int count()
  78. {
  79. if (CardEffectCommons.IsExistOnBattleArea(card))
  80. {
  81. return card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => cardSource.IsDigimon && cardSource.CardTraits.Contains("Insectoid"));
  82. }
  83. return 0;
  84. }
  85. bool Condition()
  86. {
  87. if (CardEffectCommons.IsExistOnBattleArea(card))
  88. {
  89. if (CardEffectCommons.IsOwnerTurn(card))
  90. {
  91. if (count() >= 1)
  92. {
  93. return true;
  94. }
  95. }
  96. }
  97. return false;
  98. }
  99. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect<Func<int>>(changeValue: () => 1000 * count(), isInheritedEffect: false, card: card, condition: Condition));
  100. }
  101. return cardEffects;
  102. }
  103. }
  104. }