EX9_058.cs 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.EX9
  5. {
  6. public class EX9_058 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alternate Digivolution Requirement
  12. if (timing == EffectTiming.None)
  13. {
  14. static bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.IsLevel2 &&
  17. targetPermanent.TopCard.EqualsTraits("DM");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false, card: card, condition: null));
  20. }
  21. #endregion
  22. #region On Play
  23. if (timing == EffectTiming.OnEnterFieldAnyone)
  24. {
  25. ActivateClass activateClass = new ActivateClass();
  26. activateClass.SetUpICardEffect("Reveal 3, Add 1 [DM] trait, and place 1 [Ver.5] trait under a [DM] digimon", CanUseCondition, card);
  27. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  28. cardEffects.Add(activateClass);
  29. string EffectDiscription()
  30. => "[On Play] Reveal the top 3 cards of your deck. Among them, add 1 card with the [DM] trait to the hand and place 1 card with the [Ver.5] trait face down as the bottom digivolution card of any of your Digimon with the [DM] trait . Return the rest to the bottom of the deck.";
  31. bool CanUseCondition(Hashtable hashtable)
  32. {
  33. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  34. CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  35. }
  36. bool CanActivateCondition(Hashtable hashtable)
  37. {
  38. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  39. card.Owner.LibraryCards.Count > 0;
  40. }
  41. bool HadDMTrait(CardSource source)
  42. {
  43. return source.EqualsTraits("DM");
  44. }
  45. bool HasVer5Trait(CardSource source)
  46. {
  47. return source.EqualsTraits("Ver.5");
  48. }
  49. bool CanSelectPermanentCondition(Permanent permanent)
  50. {
  51. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  52. permanent.TopCard.EqualsTraits("DM");
  53. }
  54. IEnumerator ActivateCoroutine(Hashtable hashtable)
  55. {
  56. CardSource selectedCard = null;
  57. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  58. revealCount: 3,
  59. simplifiedSelectCardConditions:
  60. new SimplifiedSelectCardConditionClass[]
  61. {
  62. new SimplifiedSelectCardConditionClass(
  63. canTargetCondition:HadDMTrait,
  64. message: "Select 1 [DM] card.",
  65. mode: SelectCardEffect.Mode.AddHand,
  66. maxCount: 1,
  67. selectCardCoroutine: null),
  68. new SimplifiedSelectCardConditionClass(
  69. canTargetCondition:HasVer5Trait,
  70. message: "Select 1 [Ver.5] card.",
  71. mode: SelectCardEffect.Mode.Custom,
  72. maxCount: 1,
  73. selectCardCoroutine: SelectCardCoroutine),
  74. },
  75. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  76. activateClass: activateClass));
  77. IEnumerator SelectCardCoroutine(CardSource cardSource)
  78. {
  79. selectedCard = cardSource;
  80. yield return null;
  81. }
  82. if (selectedCard != null && CardEffectCommons.HasMatchConditionOwnersPermanent(card, CanSelectPermanentCondition))
  83. {
  84. Permanent selectedPermanent = null;
  85. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  86. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  87. selectPermanentEffect.SetUp(
  88. selectPlayer: card.Owner,
  89. canTargetCondition: CanSelectPermanentCondition,
  90. canTargetCondition_ByPreSelecetedList: null,
  91. canEndSelectCondition: null,
  92. maxCount: maxCount,
  93. canNoSelect: false,
  94. canEndNotMax: false,
  95. selectPermanentCoroutine: SelectPermanentCoroutine,
  96. afterSelectPermanentCoroutine: null,
  97. mode: SelectPermanentEffect.Mode.Custom,
  98. cardEffect: activateClass);
  99. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  100. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  101. {
  102. selectedPermanent = permanent;
  103. yield return null;
  104. }
  105. if (selectedPermanent != null)
  106. {
  107. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddExecutingCard(selectedCard));
  108. yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddDigivolutionCardsBottom(new List<CardSource>() { selectedCard }, activateClass, isFacedown: true));
  109. }
  110. }
  111. }
  112. }
  113. #endregion
  114. #region Retaliation - ESS
  115. if (timing == EffectTiming.OnDestroyedAnyone)
  116. {
  117. cardEffects.Add(CardEffectFactory.RetaliationSelfEffect(isInheritedEffect: true, card: card, condition: null));
  118. }
  119. #endregion
  120. return cardEffects;
  121. }
  122. }
  123. }