BT18_037.cs 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT18
  4. {
  5. public class BT18_037 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Alternate Digivolution
  11. // Any yellow or blue tamer
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.IsTamer && (targetPermanent.TopCard.CardColors.Contains(CardColor.Yellow) ||
  17. targetPermanent.TopCard.CardColors.Contains(CardColor.Blue));
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  20. permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false,
  21. card: card, condition: null));
  22. }
  23. // Koji Minamoto
  24. if (timing == EffectTiming.None)
  25. {
  26. bool Condition()
  27. {
  28. return true;
  29. }
  30. bool PermanentCondition(Permanent targetPermanent)
  31. {
  32. return targetPermanent.TopCard.EqualsCardName("Koji Minamoto");
  33. }
  34. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  35. permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false,
  36. card: card, condition: Condition));
  37. }
  38. // KendoGarurumon
  39. if (timing == EffectTiming.None)
  40. {
  41. bool PermanentCondition(Permanent targetPermanent)
  42. {
  43. return targetPermanent.TopCard.EqualsCardName("KendoGarurumon");
  44. }
  45. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  46. permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false,
  47. card: card, condition: null));
  48. }
  49. #endregion
  50. #region When Digivolving
  51. if (timing == EffectTiming.OnEnterFieldAnyone)
  52. {
  53. ActivateClass activateClass = new ActivateClass();
  54. activateClass.SetUpICardEffect("Add 1 card from security to hand", CanUseCondition, card);
  55. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  56. cardEffects.Add(activateClass);
  57. string EffectDescription()
  58. {
  59. return
  60. "[When Digivolving] Search your security stack. You may add 1 card with the [Hybrid]/[Ten Warriors] trait among them to your hand. If you added a card, <Recovery +1 (Deck)> (Place the top card of your deck on top of your security stack). Then, shuffle your security stack.";
  61. }
  62. bool CanUseCondition(Hashtable hashtable)
  63. {
  64. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  65. }
  66. bool CanSelectCardCondition(CardSource cardSource)
  67. {
  68. return cardSource.HasHybridTenWarriorsTraits;
  69. }
  70. bool CanActivateCondition(Hashtable hashtable)
  71. {
  72. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  73. card.Owner.SecurityCards.Count >= 1;
  74. }
  75. IEnumerator ActivateCoroutine(Hashtable hashtable)
  76. {
  77. CardSource selectedCard = null;
  78. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  79. selectCardEffect.SetUp(
  80. canTargetCondition: CanSelectCardCondition,
  81. canTargetCondition_ByPreSelecetedList: null,
  82. canEndSelectCondition: null,
  83. canNoSelect: () => true,
  84. selectCardCoroutine: null,
  85. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  86. message: "Select 1 card to add to your hand.",
  87. maxCount: 1,
  88. canEndNotMax: false,
  89. isShowOpponent: true,
  90. mode: SelectCardEffect.Mode.AddHand,
  91. root: SelectCardEffect.Root.Security,
  92. customRootCardList: null,
  93. canLookReverseCard: true,
  94. selectPlayer: card.Owner,
  95. cardEffect: activateClass);
  96. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  97. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  98. {
  99. foreach (CardSource cardSource in cardSources)
  100. {
  101. selectedCard = cardSource;
  102. }
  103. if (cardSources.Count >= 1)
  104. {
  105. yield return ContinuousController.instance.StartCoroutine(new IReduceSecurity(
  106. player: card.Owner,
  107. refSkillInfos: ref ContinuousController.instance.nullSkillInfos,
  108. activateClass).ReduceSecurity());
  109. }
  110. yield return null;
  111. }
  112. if (selectedCard)
  113. {
  114. yield return ContinuousController.instance.StartCoroutine(new IRecovery(card.Owner, 1, activateClass).Recovery());
  115. }
  116. ContinuousController.instance.PlaySE(GManager.instance.ShuffleSE);
  117. card.Owner.SecurityCards = RandomUtility.ShuffledDeckCards(card.Owner.SecurityCards);
  118. }
  119. }
  120. #endregion
  121. #region When Attacking - ESS
  122. if (timing == EffectTiming.OnAllyAttack)
  123. {
  124. ActivateClass activateClass = new ActivateClass();
  125. activateClass.SetUpICardEffect("Draw 1", CanUseCondition, card);
  126. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false,
  127. EffectDescription());
  128. activateClass.SetIsInheritedEffect(true);
  129. cardEffects.Add(activateClass);
  130. string EffectDescription()
  131. {
  132. return
  133. "[When Attacking] If you have 7 or fewer cards in your hand, [Draw 1].";
  134. }
  135. bool CanUseCondition(Hashtable hashtable)
  136. {
  137. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  138. }
  139. bool CanActivateCondition(Hashtable hashtable)
  140. {
  141. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  142. {
  143. if (card.Owner.HandCards.Count <= 7)
  144. {
  145. if (card.Owner.LibraryCards.Count >= 1)
  146. {
  147. return true;
  148. }
  149. }
  150. }
  151. return false;
  152. }
  153. IEnumerator ActivateCoroutine(Hashtable hashtable)
  154. {
  155. yield return ContinuousController.instance.StartCoroutine(
  156. new DrawClass(card.Owner, 1, activateClass).Draw());
  157. }
  158. }
  159. #endregion
  160. return cardEffects;
  161. }
  162. }
  163. }