BT21_094.cs 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT21
  5. {
  6. public class BT21_094 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Main Effect
  12. if (timing == EffectTiming.OptionSkill)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  16. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
  17. cardEffects.Add(activateClass);
  18. string EffectDescription()
  19. {
  20. return
  21. "[Main] Reveal the top 3 cards of your deck. Add 1 card with [Davis Motomiya] in its name in its name and 1 card with the [Free] trait among them to the hand. Trash the rest. Then, place this card in the battle area.";
  22. }
  23. bool CanSelectDavisCardCondition(CardSource cardSource)
  24. {
  25. return cardSource.ContainsCardName("Davis Motomiya");
  26. }
  27. bool CanSelectFreeCardCondition(CardSource cardSource)
  28. {
  29. return cardSource.EqualsTraits("Free");
  30. }
  31. bool CanUseCondition(Hashtable hashtable)
  32. {
  33. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  34. }
  35. IEnumerator ActivateCoroutine(Hashtable hashtable)
  36. {
  37. yield return ContinuousController.instance.StartCoroutine(
  38. CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  39. revealCount: 3,
  40. simplifiedSelectCardConditions:
  41. new SimplifiedSelectCardConditionClass[]
  42. {
  43. new(
  44. canTargetCondition: CanSelectDavisCardCondition,
  45. message: "Select 1 card with [Davis Motomiya] in its name in its name.",
  46. mode: SelectCardEffect.Mode.AddHand,
  47. maxCount: 1,
  48. selectCardCoroutine: null),
  49. new(
  50. canTargetCondition: CanSelectFreeCardCondition,
  51. message: "Select 1 card with the [Free] trait.",
  52. mode: SelectCardEffect.Mode.AddHand,
  53. maxCount: 1,
  54. selectCardCoroutine: null),
  55. },
  56. remainingCardsPlace: RemainingCardsPlace.Trash,
  57. activateClass: activateClass
  58. ));
  59. yield return ContinuousController.instance.StartCoroutine(
  60. CardEffectCommons.PlaceDelayOptionCards(card: card, cardEffect: activateClass));
  61. }
  62. }
  63. #endregion
  64. #region Delay Effect
  65. if (timing == EffectTiming.WhenTopCardTrashed)
  66. {
  67. ActivateClass activateClass = new ActivateClass();
  68. activateClass.SetUpICardEffect("Digivolve into a Digimon card with [Armor Form] trait in your hand", CanUseCondition, card);
  69. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, true, EffectDescription());
  70. activateClass.SetHashString("DigivolveIntoArmorForm_BT21_094");
  71. cardEffects.Add(activateClass);
  72. string EffectDescription()
  73. {
  74. return
  75. "[All Turns] When the top stacked card of any your [Armor Form] trait Digimon is trashed, [Delay] • 1 of your Digimon may digivolve into a Digimon card with the [Armor Form] in the hand without paying the cost.";
  76. }
  77. bool TrashedCardCondition(CardSource cardSource)
  78. {
  79. return cardSource.EqualsTraits("Armor Form");
  80. }
  81. bool CanUseCondition(Hashtable hashtable)
  82. {
  83. return CardEffectCommons.CanDeclareOptionDelayEffect(card) &&
  84. CardEffectCommons.CanTriggerWhenTopCardTrashed(hashtable, TrashedCardCondition);
  85. }
  86. bool CanSelectHandCardCondition(CardSource cardSource)
  87. {
  88. return cardSource.IsDigimon &&
  89. cardSource.EqualsTraits("Armor Form");
  90. }
  91. bool CanSelectPermanentCondition(Permanent permanent)
  92. {
  93. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  94. card.Owner.HandCards.Where(CanSelectHandCardCondition).Any(cardSource =>
  95. cardSource.CanPlayCardTargetFrame(permanent.PermanentFrame, false, activateClass));
  96. }
  97. IEnumerator ActivateCoroutine(Hashtable hashtable)
  98. {
  99. yield return ContinuousController.instance.StartCoroutine(
  100. CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(
  101. targetPermanents: new List<Permanent>() { card.PermanentOfThisCard() },
  102. activateClass: activateClass, successProcess: permanents => SuccessProcess(),
  103. failureProcess: null));
  104. }
  105. IEnumerator SuccessProcess()
  106. {
  107. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  108. {
  109. Permanent selectedPermanent = null;
  110. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  111. selectPermanentEffect.SetUp(
  112. selectPlayer: card.Owner,
  113. canTargetCondition: CanSelectPermanentCondition,
  114. canTargetCondition_ByPreSelecetedList: null,
  115. canEndSelectCondition: null,
  116. maxCount: 1,
  117. canNoSelect: true,
  118. canEndNotMax: false,
  119. selectPermanentCoroutine: SelectPermanentCoroutine,
  120. afterSelectPermanentCoroutine: null,
  121. mode: SelectPermanentEffect.Mode.Custom,
  122. cardEffect: activateClass);
  123. selectPermanentEffect.SetUpCustomMessage(
  124. "Select 1 Digimon to digivolve.",
  125. "The opponent is selecting 1 Digimon to digivolve.");
  126. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  127. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  128. {
  129. selectedPermanent = permanent;
  130. yield return null;
  131. }
  132. if (selectedPermanent != null)
  133. {
  134. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  135. targetPermanent: selectedPermanent,
  136. cardCondition: CanSelectHandCardCondition,
  137. payCost: false,
  138. reduceCostTuple: null,
  139. fixedCostTuple: null,
  140. ignoreDigivolutionRequirementFixedCost: -1,
  141. isHand: true,
  142. activateClass: activateClass,
  143. successProcess: null));
  144. }
  145. }
  146. }
  147. }
  148. #endregion
  149. #region Security Effect
  150. if (timing == EffectTiming.SecuritySkill)
  151. {
  152. CardEffectCommons.AddActivateMainOptionSecurityEffect(
  153. card: card,
  154. cardEffects: ref cardEffects,
  155. effectName: "Reveal the top 3 cards of your deck");
  156. }
  157. #endregion
  158. return cardEffects;
  159. }
  160. }
  161. }