EX4_074.cs 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.EX4
  5. {
  6. public class EX4_074 : 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 PermanentCondition(Permanent targetPermanent)
  14. {
  15. return targetPermanent.TopCard.CardNames.Contains("ShineGreymon");
  16. }
  17. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 4, ignoreDigivolutionRequirement: false, card: card, condition: null));
  18. }
  19. if (timing == EffectTiming.OnEnterFieldAnyone)
  20. {
  21. ActivateClass activateClass = new ActivateClass();
  22. activateClass.SetUpICardEffect("DP -5000 to opponent's all Digimon", CanUseCondition, card);
  23. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  24. cardEffects.Add(activateClass);
  25. string EffectDiscription()
  26. {
  27. return "[When Digivolving] Until the end of your opponent's next turn, all of your opponent's Digimon get -5000DP.";
  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. return true;
  38. }
  39. return false;
  40. }
  41. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  42. {
  43. bool PermanentCondition(Permanent permanent)
  44. {
  45. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  46. }
  47. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDPPlayerEffect(
  48. permanentCondition: PermanentCondition,
  49. changeValue: -5000,
  50. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  51. activateClass: activateClass));
  52. }
  53. }
  54. if (timing == EffectTiming.OnDestroyedAnyone)
  55. {
  56. ActivateClass activateClass = new ActivateClass();
  57. activateClass.SetUpICardEffect("DP -5000 to opponent's all Digimon", CanUseCondition, card);
  58. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  59. cardEffects.Add(activateClass);
  60. string EffectDiscription()
  61. {
  62. return "[[On Deletion] Until the end of your opponent's next turn, all of your opponent's Digimon get -5000DP.";
  63. }
  64. bool CanUseCondition(Hashtable hashtable)
  65. {
  66. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  67. }
  68. bool CanActivateCondition(Hashtable hashtable)
  69. {
  70. if (CardEffectCommons.IsExistOnTrash(card))
  71. {
  72. return true;
  73. }
  74. return false;
  75. }
  76. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  77. {
  78. bool PermanentCondition(Permanent permanent)
  79. {
  80. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  81. }
  82. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDPPlayerEffect(
  83. permanentCondition: PermanentCondition,
  84. changeValue: -5000,
  85. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  86. activateClass: activateClass));
  87. }
  88. }
  89. if (timing == EffectTiming.OnEndAttack)
  90. {
  91. ActivateClass activateClass = new ActivateClass();
  92. activateClass.SetUpICardEffect("Delete Digimon, Recovery +1 (Deck) and hatch 1 Digiegg", CanUseCondition, card);
  93. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  94. cardEffects.Add(activateClass);
  95. string EffectDiscription()
  96. {
  97. return "[End of Attack] Delete this Digimon and 1 of your opponent's Digimon, and <Recovery +1 (Deck)>. Then, if you have a Tamer in play, hatch 1 Digi-Egg card to an empty space in your breeding area.";
  98. }
  99. bool CanSelectPermanentCondition(Permanent permanent)
  100. {
  101. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  102. }
  103. bool CanUseCondition(Hashtable hashtable)
  104. {
  105. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  106. }
  107. bool CanActivateCondition(Hashtable hashtable)
  108. {
  109. return CardEffectCommons.IsExistOnBattleArea(card);
  110. }
  111. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  112. {
  113. yield return ContinuousController.instance.StartCoroutine(new DestroyPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Destroy());
  114. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  115. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  116. selectPermanentEffect.SetUp(
  117. selectPlayer: card.Owner,
  118. canTargetCondition: CanSelectPermanentCondition,
  119. canTargetCondition_ByPreSelecetedList: null,
  120. canEndSelectCondition: null,
  121. maxCount: maxCount,
  122. canNoSelect: false,
  123. canEndNotMax: false,
  124. selectPermanentCoroutine: null,
  125. afterSelectPermanentCoroutine: null,
  126. mode: SelectPermanentEffect.Mode.Destroy,
  127. cardEffect: activateClass);
  128. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  129. yield return ContinuousController.instance.StartCoroutine(new IRecovery(card.Owner, 1, activateClass).Recovery());
  130. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsTamer))
  131. {
  132. if (card.Owner.CanHatch)
  133. {
  134. yield return ContinuousController.instance.StartCoroutine(new HatchDigiEggClass(player: card.Owner, hashtable: CardEffectCommons.CardEffectHashtable(activateClass)).Hatch());
  135. }
  136. }
  137. }
  138. }
  139. return cardEffects;
  140. }
  141. }
  142. }