BT23_016.cs 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Dokamon
  5. namespace DCGO.CardEffects.BT23
  6. {
  7. public class BT23_016 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Static Effects
  13. #region Alternative Digivolution Condition
  14. if (timing == EffectTiming.None)
  15. {
  16. bool PermanentCondition(Permanent targetPermanent)
  17. {
  18. return targetPermanent.TopCard.HasAppmonTraits
  19. && targetPermanent.TopCard.HasLevel
  20. && targetPermanent.TopCard.IsLevel2;
  21. }
  22. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  23. permanentCondition: PermanentCondition,
  24. digivolutionCost: 0,
  25. ignoreDigivolutionRequirement: false,
  26. card: card,
  27. condition: null)
  28. );
  29. }
  30. #endregion
  31. #region Link Condition
  32. if (timing == EffectTiming.None)
  33. {
  34. static bool PermanentCondition(Permanent targetPermanent)
  35. {
  36. return targetPermanent.TopCard.HasAppmonTraits;
  37. }
  38. cardEffects.Add(CardEffectFactory.AddSelfLinkConditionStaticEffect(permanentCondition: PermanentCondition, linkCost: 1, card: card));
  39. }
  40. #endregion
  41. #region Link
  42. if (timing == EffectTiming.OnDeclaration)
  43. {
  44. cardEffects.Add(CardEffectFactory.LinkEffect(card));
  45. }
  46. #endregion
  47. #endregion
  48. #region Your Turn
  49. if (timing == EffectTiming.WhenLinked)
  50. {
  51. ActivateClass activateClass = new ActivateClass();
  52. activateClass.SetUpICardEffect("Play [Eri Karan] from hand", CanUseCondition, card);
  53. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  54. activateClass.SetHashString("BT23_016_WL");
  55. cardEffects.Add(activateClass);
  56. string EffectDiscription()
  57. {
  58. return "[Your Turn] [Once Per Turn] When this Digimon gets linked, if you have 1 or fewer Tamers, you may play 1 [Eri Karan] from your hand without paying the cost.";
  59. }
  60. bool CanUseCondition(Hashtable hashtable)
  61. {
  62. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  63. && CardEffectCommons.CanTriggerWhenLinked(hashtable, perm => perm == card.PermanentOfThisCard(), _ => true);
  64. }
  65. bool CanActivateCondition(Hashtable hashtable)
  66. {
  67. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  68. && CardEffectCommons.IsOwnerTurn(card)
  69. && CardEffectCommons.OwnerHas1OrLessTamers(card)
  70. && CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition);
  71. }
  72. bool CanSelectCardCondition(CardSource cardSource)
  73. {
  74. return cardSource.IsTamer
  75. && cardSource.EqualsCardName("Eri Karan")
  76. && CardEffectCommons.CanPlayAsNewPermanent(cardSource, false, activateClass);
  77. }
  78. IEnumerator ActivateCoroutine(Hashtable hashtable)
  79. {
  80. if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition))
  81. {
  82. CardSource selectedCard = null;
  83. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersCardCountInHand(card, CanSelectCardCondition));
  84. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  85. selectHandEffect.SetUp(
  86. selectPlayer: card.Owner,
  87. canTargetCondition: CanSelectCardCondition,
  88. canTargetCondition_ByPreSelecetedList: null,
  89. canEndSelectCondition: null,
  90. maxCount: maxCount,
  91. canNoSelect: true,
  92. canEndNotMax: false,
  93. isShowOpponent: true,
  94. selectCardCoroutine: SelectCardCoroutine,
  95. afterSelectCardCoroutine: null,
  96. mode: SelectHandEffect.Mode.Custom,
  97. cardEffect: activateClass);
  98. IEnumerator SelectCardCoroutine(CardSource cardSource)
  99. {
  100. selectedCard = cardSource;
  101. yield return null;
  102. }
  103. selectHandEffect.SetUpCustomMessage("Select 1 [Eri Karan] to play.", "The opponent is selecting 1 card to play.");
  104. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  105. yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
  106. if (selectedCard != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  107. cardSources: new List<CardSource>() { selectedCard },
  108. activateClass: activateClass,
  109. payCost: false,
  110. isTapped: false,
  111. root: SelectCardEffect.Root.Hand,
  112. activateETB: true));
  113. }
  114. }
  115. }
  116. #endregion
  117. #region Link Effect - When Linking
  118. if (timing == EffectTiming.WhenLinked)
  119. {
  120. ActivateClass activateClass = new ActivateClass();
  121. activateClass.SetUpICardEffect("Draw 1", CanUseCondition, card);
  122. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  123. cardEffects.Add(activateClass);
  124. string EffectDiscription()
  125. {
  126. return "[When Linking] <Draw 1>";
  127. }
  128. bool CanUseCondition(Hashtable hashtable)
  129. {
  130. return CardEffectCommons.IsExistOnField(card)
  131. && CardEffectCommons.CanTriggerWhenLinking(hashtable, null, card);
  132. }
  133. bool CanActivateCondition(Hashtable hashtable)
  134. {
  135. return CardEffectCommons.IsExistOnField(card);
  136. }
  137. IEnumerator ActivateCoroutine(Hashtable hashtable)
  138. {
  139. yield return ContinuousController.instance.StartCoroutine(new DrawClass(
  140. player: card.Owner,
  141. drawCount: 1,
  142. cardEffect: activateClass).Draw());
  143. }
  144. }
  145. #endregion
  146. return cardEffects;
  147. }
  148. }
  149. }