BT22_053.cs 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // Keramon
  4. namespace DCGO.CardEffects.BT22
  5. {
  6. public class BT22_053 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alternative Digivolution Condition
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.IsLevel2 && targetPermanent.TopCard.HasCSTraits;
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  19. permanentCondition: PermanentCondition,
  20. digivolutionCost: 0,
  21. ignoreDigivolutionRequirement: false,
  22. card: card,
  23. condition: null)
  24. );
  25. }
  26. #endregion
  27. #region On Play
  28. if (timing == EffectTiming.OnEnterFieldAnyone)
  29. {
  30. ActivateClass activateClass = new ActivateClass();
  31. activateClass.SetUpICardEffect("Reveal top 3, Add 1 [Arata Sanada] and 1 [Unidentified]/[CS] to hand.", CanUseCondition, card);
  32. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  33. cardEffects.Add(activateClass);
  34. string EffectDiscription()
  35. {
  36. return "[On Play] Reveal the top 3 cards of your deck. Add 1 [Arata Sanada] and 1 card with the [Unidentified] or [CS] trait among them to the hand. Return the rest to the bottom of the deck.";
  37. }
  38. bool CanUseCondition(Hashtable hashtable)
  39. {
  40. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  41. }
  42. bool CanActivateCondition(Hashtable hashtable)
  43. {
  44. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  45. }
  46. bool SelectArata(CardSource source)
  47. {
  48. return source.CardNames.Contains("Arata Sanada");
  49. }
  50. bool SelectUnidentifiedOrCS(CardSource source)
  51. {
  52. return source.HasUnidentifiedTraits || source.HasCSTraits;
  53. }
  54. IEnumerator ActivateCoroutine(Hashtable hashtable)
  55. {
  56. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  57. revealCount: 3,
  58. simplifiedSelectCardConditions:
  59. new SimplifiedSelectCardConditionClass[]
  60. {
  61. new SimplifiedSelectCardConditionClass(
  62. canTargetCondition:SelectArata,
  63. message: "Select 1 [Arata Sanada] to add to hand.",
  64. mode: SelectCardEffect.Mode.AddHand,
  65. maxCount: 1,
  66. selectCardCoroutine: null),
  67. new SimplifiedSelectCardConditionClass(
  68. canTargetCondition:SelectUnidentifiedOrCS,
  69. message: "Select 1 card with the [Unidentified] or [CS] trait to add to hand.",
  70. mode: SelectCardEffect.Mode.AddHand,
  71. maxCount: 1,
  72. selectCardCoroutine: null),
  73. },
  74. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  75. activateClass: activateClass));
  76. }
  77. }
  78. #endregion
  79. #region ESS
  80. if (timing == EffectTiming.WhenRemoveField)
  81. {
  82. ActivateClass activateClass = new ActivateClass();
  83. activateClass.SetUpICardEffect("Delete 1 of your other [Diaboromon] to prevent this Digimon from leaving", CanUseCondition, card);
  84. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  85. activateClass.SetHashString("Substitute_BT22_053");
  86. activateClass.SetIsInheritedEffect(true);
  87. cardEffects.Add(activateClass);
  88. string EffectDiscription()
  89. {
  90. return "[All Turns] [Once Per Turn] When this Digimon with [Diaboromon] in its text would leave the battle area, by deleting 1 of your other [Diaboromon], it doesn't leave.";
  91. }
  92. bool CanUseCondition(Hashtable hashtable)
  93. {
  94. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  95. CardEffectCommons.CanTriggerWhenRemoveField(hashtable, card);
  96. }
  97. bool CanActivateCondition(Hashtable hashtable)
  98. {
  99. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  100. card.PermanentOfThisCard().TopCard.HasText("Diaboromon") &&
  101. CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition);
  102. }
  103. bool CanSelectPermanentCondition(Permanent permanent)
  104. {
  105. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  106. permanent != card.PermanentOfThisCard() &&
  107. permanent.TopCard.EqualsCardName("Diaboromon");
  108. }
  109. IEnumerator ActivateCoroutine(Hashtable hashtable)
  110. {
  111. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  112. {
  113. Permanent thisCardPermanent = card.PermanentOfThisCard();
  114. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  115. selectPermanentEffect.SetUp(
  116. selectPlayer: card.Owner,
  117. canTargetCondition: CanSelectPermanentCondition,
  118. canTargetCondition_ByPreSelecetedList: null,
  119. canEndSelectCondition: null,
  120. maxCount: 1,
  121. canNoSelect: true,
  122. canEndNotMax: false,
  123. selectPermanentCoroutine: SelectPermanentCoroutine,
  124. afterSelectPermanentCoroutine: null,
  125. mode: SelectPermanentEffect.Mode.Custom,
  126. cardEffect: activateClass);
  127. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
  128. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  129. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  130. {
  131. yield return ContinuousController.instance.StartCoroutine(
  132. CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(
  133. targetPermanents: new List<Permanent>() { permanent },
  134. activateClass: activateClass,
  135. successProcess: _ => SuccessProcess(),
  136. failureProcess: null));
  137. IEnumerator SuccessProcess()
  138. {
  139. thisCardPermanent.willBeRemoveField = false;
  140. thisCardPermanent.HideDeleteEffect();
  141. thisCardPermanent.HideHandBounceEffect();
  142. thisCardPermanent.HideDeckBounceEffect();
  143. thisCardPermanent.HideWillRemoveFieldEffect();
  144. yield return null;
  145. }
  146. }
  147. }
  148. }
  149. }
  150. #endregion
  151. return cardEffects;
  152. }
  153. }
  154. }