EX4_029.cs 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.EX4
  5. {
  6. public class EX4_029 : 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.CardColors.Contains(CardColor.Green) && targetPermanent.TopCard.CardColors.Count == 2 && targetPermanent.TopCard.HasLevel && targetPermanent.Level == 4;
  16. }
  17. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  18. }
  19. if (timing == EffectTiming.OnAllyAttack)
  20. {
  21. cardEffects.Add(CardEffectFactory.AllianceSelfEffect(isInheritedEffect: false, card: card, condition: null));
  22. }
  23. if (timing == EffectTiming.OnEndAttack)
  24. {
  25. ActivateClass activateClass = new ActivateClass();
  26. activateClass.SetUpICardEffect("Recovery +1 (Deck)", CanUseCondition, card);
  27. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  28. cardEffects.Add(activateClass);
  29. string EffectDiscription()
  30. {
  31. return "[End of Attack] If you have 3 or fewer security cards, <Recovery +1 (Deck)>. (Place the top card of your deck on top of your security stack.)";
  32. }
  33. bool CanUseCondition(Hashtable hashtable)
  34. {
  35. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  36. }
  37. bool CanActivateCondition(Hashtable hashtable)
  38. {
  39. if (CardEffectCommons.IsExistOnBattleArea(card))
  40. {
  41. if (card.Owner.LibraryCards.Count >= 1)
  42. {
  43. if (card.Owner.CanAddSecurity(activateClass))
  44. {
  45. if (card.Owner.SecurityCards.Count <= 3)
  46. {
  47. return true;
  48. }
  49. }
  50. }
  51. }
  52. return false;
  53. }
  54. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  55. {
  56. if (CardEffectCommons.IsExistOnBattleArea(card))
  57. {
  58. yield return ContinuousController.instance.StartCoroutine(new IRecovery(card.Owner, 1, activateClass).Recovery());
  59. }
  60. }
  61. }
  62. if (timing == EffectTiming.OnEndAttack)
  63. {
  64. ActivateClass activateClass = new ActivateClass();
  65. activateClass.SetUpICardEffect("DP -2000", CanUseCondition, card);
  66. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  67. activateClass.SetIsInheritedEffect(true);
  68. activateClass.SetHashString("DP-2000_EX4_029");
  69. cardEffects.Add(activateClass);
  70. string EffectDiscription()
  71. {
  72. return "[End of Attack][Once Per Turn] If you have another suspended Digimon in play, 1 of your opponent's Digimon gets -2000 DP for the turn.";
  73. }
  74. bool CanSelectPermanentCondition(Permanent permanent)
  75. {
  76. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  77. }
  78. bool CanUseCondition(Hashtable hashtable)
  79. {
  80. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  81. }
  82. bool CanActivateCondition(Hashtable hashtable)
  83. {
  84. if (CardEffectCommons.IsExistOnBattleArea(card))
  85. {
  86. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsDigimon && permanent != card.PermanentOfThisCard() && permanent.IsSuspended))
  87. {
  88. return true;
  89. }
  90. }
  91. return false;
  92. }
  93. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  94. {
  95. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  96. {
  97. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  98. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  99. selectPermanentEffect.SetUp(
  100. selectPlayer: card.Owner,
  101. canTargetCondition: CanSelectPermanentCondition,
  102. canTargetCondition_ByPreSelecetedList: null,
  103. canEndSelectCondition: null,
  104. maxCount: maxCount,
  105. canNoSelect: false,
  106. canEndNotMax: false,
  107. selectPermanentCoroutine: SelectPermanentCoroutine,
  108. afterSelectPermanentCoroutine: null,
  109. mode: SelectPermanentEffect.Mode.Custom,
  110. cardEffect: activateClass);
  111. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -2000.", "The opponent is selecting 1 Digimon that will get DP -2000.");
  112. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  113. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  114. {
  115. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -2000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  116. }
  117. }
  118. }
  119. }
  120. return cardEffects;
  121. }
  122. }
  123. }