EX4_036.cs 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.EX4
  5. {
  6. public class EX4_036 : 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. if (targetPermanent.TopCard.HasLevel && targetPermanent.Level == 4)
  16. {
  17. if (targetPermanent.TopCard.ContainsCardName("Gargomon"))
  18. return true;
  19. if (targetPermanent.TopCard.CardColors.Contains(CardColor.Green) && targetPermanent.TopCard.CardColors.Count == 2)
  20. return true;
  21. }
  22. return false;
  23. }
  24. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  25. }
  26. if (timing == EffectTiming.OnAllyAttack)
  27. {
  28. cardEffects.Add(CardEffectFactory.AllianceSelfEffect(isInheritedEffect: false, card: card, condition: null));
  29. }
  30. if (timing == EffectTiming.OnEndAttack)
  31. {
  32. ActivateClass activateClass = new ActivateClass();
  33. activateClass.SetUpICardEffect("De-Digivolve 1 on 1 Digimon", CanUseCondition, card);
  34. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  35. cardEffects.Add(activateClass);
  36. string EffectDiscription()
  37. {
  38. return "[End of Attack] <De-Digivolve 1> (Trash 1 card from the top of 1 of your opponent's Digimon. Stop trashing when you would trash a level 3 card or the Digimon's last card) 1 of your opponent's Digimon.";
  39. }
  40. bool CanSelectPermanentCondition(Permanent permanent)
  41. {
  42. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  43. }
  44. bool CanUseCondition(Hashtable hashtable)
  45. {
  46. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  47. }
  48. bool CanActivateCondition(Hashtable hashtable)
  49. {
  50. if (CardEffectCommons.IsExistOnBattleArea(card))
  51. {
  52. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  53. {
  54. return true;
  55. }
  56. }
  57. return false;
  58. }
  59. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  60. {
  61. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  62. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  63. selectPermanentEffect.SetUp(
  64. selectPlayer: card.Owner,
  65. canTargetCondition: CanSelectPermanentCondition,
  66. canTargetCondition_ByPreSelecetedList: null,
  67. canEndSelectCondition: null,
  68. maxCount: maxCount,
  69. canNoSelect: false,
  70. canEndNotMax: false,
  71. selectPermanentCoroutine: SelectPermanentCoroutine,
  72. afterSelectPermanentCoroutine: null,
  73. mode: SelectPermanentEffect.Mode.Custom,
  74. cardEffect: activateClass);
  75. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to De-Digivolve.", "The opponent is selecting 1 Digimon to De-Digivolve.");
  76. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  77. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  78. {
  79. Permanent selectedPermanent = permanent;
  80. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(selectedPermanent, 1, activateClass).Degeneration());
  81. }
  82. }
  83. }
  84. if (timing == EffectTiming.OnTappedAnyone)
  85. {
  86. ActivateClass activateClass = new ActivateClass();
  87. activateClass.SetUpICardEffect("This Digimon gains Pierce", CanUseCondition, card);
  88. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  89. activateClass.SetIsInheritedEffect(true);
  90. activateClass.SetHashString("Pierce_EX4_036");
  91. cardEffects.Add(activateClass);
  92. string EffectDiscription()
  93. {
  94. return "[Your Turn][Once Per Turn] When an effect suspends another Digimon, this Digimon gains <Piercing> for the turn.";
  95. }
  96. bool PermanentCondition(Permanent permanent)
  97. {
  98. if (CardEffectCommons.IsPermanentExistsOnBattleArea(permanent))
  99. {
  100. if (permanent.IsDigimon)
  101. {
  102. if (permanent != card.PermanentOfThisCard())
  103. {
  104. return true;
  105. }
  106. }
  107. }
  108. return false;
  109. }
  110. bool CanUseCondition(Hashtable hashtable)
  111. {
  112. if (CardEffectCommons.IsExistOnBattleArea(card))
  113. {
  114. if (CardEffectCommons.IsOwnerTurn(card))
  115. {
  116. if (CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, PermanentCondition))
  117. {
  118. if (CardEffectCommons.IsByEffect(hashtable, null))
  119. {
  120. return true;
  121. }
  122. }
  123. }
  124. }
  125. return false;
  126. }
  127. bool CanActivateCondition(Hashtable hashtable)
  128. {
  129. return CardEffectCommons.IsExistOnBattleArea(card);
  130. }
  131. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  132. {
  133. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainPierce(targetPermanent: card.PermanentOfThisCard(), effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  134. }
  135. }
  136. return cardEffects;
  137. }
  138. }
  139. }