EX8_049.cs 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.EX8
  4. {
  5. public class EX8_049 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Shared Conditions
  11. bool SelectableOpponentsDigimon(Permanent permanent)
  12. {
  13. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  14. }
  15. #endregion
  16. #region On Play
  17. if (timing == EffectTiming.OnEnterFieldAnyone)
  18. {
  19. ActivateClass activateClass = new ActivateClass();
  20. activateClass.SetUpICardEffect("De-Digivolve 1 of your opponents digimon", CanUseCondition, card);
  21. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  22. cardEffects.Add(activateClass);
  23. string EffectDiscription()
  24. {
  25. return "[On Play] <De-Digivolve 1> 1 of your opponent's Digimon.";
  26. }
  27. bool CanUseCondition(Hashtable hashtable)
  28. {
  29. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  30. }
  31. bool CanActivateCondition(Hashtable hashtable)
  32. {
  33. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  34. CardEffectCommons.HasMatchConditionPermanent(SelectableOpponentsDigimon);
  35. }
  36. IEnumerator ActivateCoroutine(Hashtable hashtable)
  37. {
  38. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  39. selectPermanentEffect.SetUp(
  40. selectPlayer: card.Owner,
  41. canTargetCondition: SelectableOpponentsDigimon,
  42. canTargetCondition_ByPreSelecetedList: null,
  43. canEndSelectCondition: null,
  44. maxCount: 1,
  45. canNoSelect: false,
  46. canEndNotMax: false,
  47. selectPermanentCoroutine: SelectPermanentCoroutine,
  48. afterSelectPermanentCoroutine: null,
  49. mode: SelectPermanentEffect.Mode.Custom,
  50. cardEffect: activateClass);
  51. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to De-Digivolve.", "The opponent is selecting 1 Digimon to De-Digivolve.");
  52. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  53. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  54. {
  55. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(permanent, 1, activateClass).Degeneration());
  56. }
  57. }
  58. }
  59. #endregion
  60. #region On Deletion
  61. if (timing == EffectTiming.OnDestroyedAnyone)
  62. {
  63. ActivateClass activateClass = new ActivateClass();
  64. activateClass.SetUpICardEffect("De-Digivolve 1 of your opponents digimon", CanUseCondition, card);
  65. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  66. cardEffects.Add(activateClass);
  67. string EffectDiscription()
  68. {
  69. return "[On Deletion] <De-Digivolve 1> 1 of your opponent's Digimon.";
  70. }
  71. bool CanUseCondition(Hashtable hashtable)
  72. {
  73. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  74. }
  75. bool CanActivateCondition(Hashtable hashtable)
  76. {
  77. return CardEffectCommons.CanActivateOnDeletion(card, activateClass) &&
  78. CardEffectCommons.HasMatchConditionPermanent(SelectableOpponentsDigimon);
  79. }
  80. IEnumerator ActivateCoroutine(Hashtable hashtable)
  81. {
  82. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  83. selectPermanentEffect.SetUp(
  84. selectPlayer: card.Owner,
  85. canTargetCondition: SelectableOpponentsDigimon,
  86. canTargetCondition_ByPreSelecetedList: null,
  87. canEndSelectCondition: null,
  88. maxCount: 1,
  89. canNoSelect: false,
  90. canEndNotMax: false,
  91. selectPermanentCoroutine: SelectPermanentCoroutine,
  92. afterSelectPermanentCoroutine: null,
  93. mode: SelectPermanentEffect.Mode.Custom,
  94. cardEffect: activateClass);
  95. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to De-Digivolve.", "The opponent is selecting 1 Digimon to De-Digivolve.");
  96. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  97. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  98. {
  99. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(permanent, 1, activateClass).Degeneration());
  100. }
  101. }
  102. }
  103. #endregion
  104. #region Blocker - ESS
  105. if (timing == EffectTiming.None)
  106. {
  107. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(
  108. isInheritedEffect: true,
  109. card: card,
  110. condition: null));
  111. }
  112. #endregion
  113. return cardEffects;
  114. }
  115. }
  116. }