EX5_044.cs 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.EX5
  5. {
  6. public class EX5_044 : 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("Frimon");
  16. }
  17. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false, card: card, condition: null));
  18. }
  19. if (timing == EffectTiming.OnEnterFieldAnyone)
  20. {
  21. ActivateClass activateClass = new ActivateClass();
  22. activateClass.SetUpICardEffect("Reveal the top 5 cards of deck", CanUseCondition, card);
  23. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  24. cardEffects.Add(activateClass);
  25. string EffectDiscription()
  26. {
  27. return "[On Play] Reveal the top 5 cards of your deck. Add 1 card with [Leomon] in its name among them to the hand. Return the rest to the bottom of the deck.";
  28. }
  29. bool CanSelectCardCondition(CardSource cardSource)
  30. {
  31. return cardSource.ContainsCardName("Leomon");
  32. }
  33. bool CanUseCondition(Hashtable hashtable)
  34. {
  35. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  36. }
  37. bool CanActivateCondition(Hashtable hashtable)
  38. {
  39. if (CardEffectCommons.IsExistOnBattleArea(card))
  40. {
  41. if (card.Owner.LibraryCards.Count >= 1)
  42. {
  43. return true;
  44. }
  45. }
  46. return false;
  47. }
  48. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  49. {
  50. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  51. revealCount: 5,
  52. simplifiedSelectCardConditions:
  53. new SimplifiedSelectCardConditionClass[]
  54. {
  55. new SimplifiedSelectCardConditionClass(
  56. canTargetCondition:CanSelectCardCondition,
  57. message: "Select 1 card with [Leomon] in its name.",
  58. mode: SelectCardEffect.Mode.AddHand,
  59. maxCount: 1,
  60. selectCardCoroutine: null),
  61. },
  62. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  63. activateClass: activateClass
  64. ));
  65. }
  66. }
  67. if (timing == EffectTiming.OnDestroyedAnyone)
  68. {
  69. ActivateClass activateClass = new ActivateClass();
  70. activateClass.SetUpICardEffect("De-Digivolve 1 on 1 Digimon", CanUseCondition, card);
  71. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  72. activateClass.SetIsInheritedEffect(true);
  73. cardEffects.Add(activateClass);
  74. string EffectDiscription()
  75. {
  76. return "[On Deletion] <De-Digivolve 1> 1 of your opponent's Digimon (Trash up to 1 card from the top of one of your opponent's Digimon. If it has no digivolution cards, or becomes a level 3 Digimon, you can't trash any more cards).";
  77. }
  78. bool CanSelectPermanentCondition(Permanent permanent)
  79. {
  80. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  81. }
  82. bool CanUseCondition(Hashtable hashtable)
  83. {
  84. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card);
  85. }
  86. bool CanActivateCondition(Hashtable hashtable)
  87. {
  88. if (CardEffectCommons.CanActivateOnDeletionInherited(hashtable, card))
  89. {
  90. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  91. {
  92. return true;
  93. }
  94. }
  95. return false;
  96. }
  97. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  98. {
  99. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  100. {
  101. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  102. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  103. selectPermanentEffect.SetUp(
  104. selectPlayer: card.Owner,
  105. canTargetCondition: CanSelectPermanentCondition,
  106. canTargetCondition_ByPreSelecetedList: null,
  107. canEndSelectCondition: null,
  108. maxCount: maxCount,
  109. canNoSelect: false,
  110. canEndNotMax: false,
  111. selectPermanentCoroutine: SelectPermanentCoroutine,
  112. afterSelectPermanentCoroutine: null,
  113. mode: SelectPermanentEffect.Mode.Custom,
  114. cardEffect: activateClass);
  115. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to De-Digivolve.", "The opponent is selecting 1 Digimon to De-Digivolve.");
  116. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  117. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  118. {
  119. Permanent selectedPermanent = permanent;
  120. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(selectedPermanent, 1, activateClass).Degeneration());
  121. }
  122. }
  123. }
  124. }
  125. return cardEffects;
  126. }
  127. }
  128. }