BT10_028.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System.Linq;
  5. using Photon;
  6. using System;
  7. using Photon.Pun;
  8. namespace DCGO.CardEffects.BT10
  9. {
  10. public class BT10_028 : CEntity_Effect
  11. {
  12. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  13. {
  14. List<ICardEffect> cardEffects = new List<ICardEffect>();
  15. if (timing == EffectTiming.None)
  16. {
  17. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  18. }
  19. if (timing == EffectTiming.OnEnterFieldAnyone)
  20. {
  21. ActivateClass activateClass = new ActivateClass();
  22. activateClass.SetUpICardEffect("Unsuspend this Digimon", CanUseCondition, card);
  23. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  24. cardEffects.Add(activateClass);
  25. string EffectDiscription()
  26. {
  27. return "[When Digivolving] Unsuspend this Digimon.";
  28. }
  29. bool CanUseCondition(Hashtable hashtable)
  30. {
  31. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  32. }
  33. bool CanActivateCondition(Hashtable hashtable)
  34. {
  35. if (CardEffectCommons.IsExistOnBattleArea(card))
  36. {
  37. if (CardEffectCommons.CanUnsuspend(card.PermanentOfThisCard()))
  38. {
  39. return true;
  40. }
  41. }
  42. return false;
  43. }
  44. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  45. {
  46. Permanent selectedPermanent = card.PermanentOfThisCard();
  47. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { selectedPermanent }, activateClass).Unsuspend());
  48. }
  49. }
  50. if (timing == EffectTiming.OnEndBattle)
  51. {
  52. ActivateClass activateClass = new ActivateClass();
  53. activateClass.SetUpICardEffect("Unsuspend this Digimon", CanUseCondition, card);
  54. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  55. activateClass.SetHashString("Unsuspend_BT10_028");
  56. cardEffects.Add(activateClass);
  57. string EffectDiscription()
  58. {
  59. return "[Opponent's Turn][Once Per Turn] When this Digimon deletes an opponent's Digimon in battle, unsuspend this Digimon.";
  60. }
  61. bool CanUseCondition(Hashtable hashtable)
  62. {
  63. if (CardEffectCommons.IsExistOnBattleArea(card))
  64. {
  65. if (CardEffectCommons.IsOpponentTurn(card))
  66. {
  67. bool WinnerCondition(Permanent permanent) => permanent.cardSources.Contains(card);
  68. bool LoserCondition(Permanent permanent) => CardEffectCommons.IsOpponentPermanent(permanent, card);
  69. if (CardEffectCommons.CanTriggerWhenDeleteOpponentDigimonByBattle(hashtable: hashtable, winnerCondition: WinnerCondition, loserCondition: LoserCondition, isOnlyWinnerSurvive: false))
  70. {
  71. return true;
  72. }
  73. }
  74. }
  75. return false;
  76. }
  77. bool CanActivateCondition(Hashtable hashtable)
  78. {
  79. if (CardEffectCommons.IsExistOnBattleArea(card))
  80. {
  81. return true;
  82. }
  83. return false;
  84. }
  85. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  86. {
  87. Permanent selectedPermanent = card.PermanentOfThisCard();
  88. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { selectedPermanent }, activateClass).Unsuspend());
  89. }
  90. }
  91. return cardEffects;
  92. }
  93. }
  94. }