EX2_037.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.EX2
  5. {
  6. public class EX2_037 : 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. cardEffects.Add(CardEffectFactory.RebootSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  14. }
  15. if (timing == EffectTiming.OnUnTappedAnyone)
  16. {
  17. ActivateClass activateClass = new ActivateClass();
  18. activateClass.SetUpICardEffect("De-Digivolve 1 to an unsuspended Digimon", CanUseCondition, card);
  19. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  20. activateClass.SetHashString("De-digivolve_EX2_037");
  21. cardEffects.Add(activateClass);
  22. string EffectDiscription()
  23. {
  24. return "[Opponent's Turn][Once Per Turn] When an opponent's Digimon becomes unsuspended, <De-Digivolve 1> that Digimon.";
  25. }
  26. bool PermanentCondition(Permanent permanent)
  27. {
  28. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  29. }
  30. bool CanUseCondition(Hashtable hashtable)
  31. {
  32. if (CardEffectCommons.IsExistOnBattleArea(card))
  33. {
  34. if (CardEffectCommons.IsOpponentTurn(card))
  35. {
  36. if (CardEffectCommons.CanTriggerWhenPermanentUnsuspends(hashtable, PermanentCondition))
  37. {
  38. return true;
  39. }
  40. }
  41. }
  42. return false;
  43. }
  44. bool CanActivateCondition(Hashtable hashtable)
  45. {
  46. if (CardEffectCommons.IsExistOnBattleArea(card))
  47. {
  48. return true;
  49. }
  50. return false;
  51. }
  52. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  53. {
  54. List<Permanent> permanents = CardEffectCommons.GetPermanentsFromHashtable(_hashtable);
  55. bool CanSelectPermanentCondition(Permanent permanent)
  56. {
  57. if (permanents != null)
  58. {
  59. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  60. {
  61. if (permanents.Contains(permanent))
  62. {
  63. return true;
  64. }
  65. }
  66. }
  67. return false;
  68. }
  69. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  70. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  71. selectPermanentEffect.SetUp(
  72. selectPlayer: card.Owner,
  73. canTargetCondition: CanSelectPermanentCondition,
  74. canTargetCondition_ByPreSelecetedList: null,
  75. canEndSelectCondition: null,
  76. maxCount: maxCount,
  77. canNoSelect: false,
  78. canEndNotMax: false,
  79. selectPermanentCoroutine: SelectPermanentCoroutine,
  80. afterSelectPermanentCoroutine: null,
  81. mode: SelectPermanentEffect.Mode.Custom,
  82. cardEffect: activateClass);
  83. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to De-Digivolve.", "The opponent is selecting 1 Digimon to De-Digivolve.");
  84. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  85. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  86. {
  87. Permanent selectedPermanent = permanent;
  88. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(selectedPermanent, 1, activateClass).Degeneration());
  89. }
  90. }
  91. }
  92. return cardEffects;
  93. }
  94. }
  95. }