BT23_030.cs 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Etemon
  5. namespace DCGO.CardEffects.BT23
  6. {
  7. public class BT23_030 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternative Digivolution Condition
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.IsLevel4
  18. && (targetPermanent.TopCard.ContainsCardName("Sukamon") || targetPermanent.TopCard.HasCSTraits);
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  21. permanentCondition: PermanentCondition,
  22. digivolutionCost: 3,
  23. ignoreDigivolutionRequirement: false,
  24. card: card,
  25. condition: null)
  26. );
  27. }
  28. #endregion
  29. #region Alliance
  30. if (timing == EffectTiming.OnAllyAttack)
  31. {
  32. cardEffects.Add(CardEffectFactory.AllianceSelfEffect(isInheritedEffect: false, card: card, condition: null));
  33. }
  34. #endregion
  35. #region Main - OPT
  36. if (timing == EffectTiming.OnDeclaration)
  37. {
  38. ActivateClass activateClass = new ActivateClass();
  39. activateClass.SetUpICardEffect("By paying 1 cost, play 3 cost or lower [Chuumon]/[Sukamon] in name /[CS] trait from your hand, then 1 level 3+ digimon gains <Reboot> and <Blocker>", CanUseCondition, card);
  40. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  41. activateClass.SetHashString("BT23_030_Main");
  42. cardEffects.Add(activateClass);
  43. string EffectDiscription()
  44. {
  45. return "[Main] [Once Per Turn] By paying 1 cost, you may play 1 play cost 3 or lower card with [Chuumon] or [Sukamon] in its name or the [CS] trait from your hand without paying the cost. Then, 1 of your level 3 or higher Digimon gains <Reboot> and <Blocker> until your opponent's turn ends.";
  46. }
  47. bool CanUseCondition(Hashtable hashtable)
  48. {
  49. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  50. }
  51. bool CanActivateCondition(Hashtable hashtable)
  52. {
  53. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  54. && CardEffectCommons.IsOwnerTurn(card);
  55. }
  56. bool CanSelectHandCardCondition(CardSource cardSource)
  57. {
  58. return cardSource.HasPlayCost && cardSource.BasePlayCostFromEntity <= 3
  59. && (cardSource.ContainsCardName("Chuumon") || cardSource.ContainsCardName("Sukamon") || cardSource.HasCSTraits)
  60. && CardEffectCommons.CanPlayAsNewPermanent(cardSource, false, activateClass);
  61. }
  62. bool CanSelectPermamentCondition(Permanent permanent)
  63. {
  64. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  65. && permanent.TopCard.HasLevel && permanent.TopCard.Level >= 3;
  66. }
  67. IEnumerator ActivateCoroutine(Hashtable hashtable)
  68. {
  69. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(-1, activateClass));
  70. if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectHandCardCondition))
  71. {
  72. CardSource selectedCard = null;
  73. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  74. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersCardCountInHand(card, CanSelectHandCardCondition));
  75. selectHandEffect.SetUp(
  76. selectPlayer: card.Owner,
  77. canTargetCondition: CanSelectHandCardCondition,
  78. canTargetCondition_ByPreSelecetedList: null,
  79. canEndSelectCondition: null,
  80. maxCount: maxCount,
  81. canNoSelect: true,
  82. canEndNotMax: false,
  83. isShowOpponent: true,
  84. selectCardCoroutine: SelectCardCoroutine,
  85. afterSelectCardCoroutine: null,
  86. mode: SelectHandEffect.Mode.Custom,
  87. cardEffect: activateClass);
  88. IEnumerator SelectCardCoroutine(CardSource cardSource)
  89. {
  90. selectedCard = cardSource;
  91. yield return null;
  92. }
  93. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  94. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  95. yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
  96. if (selectedCard != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  97. cardSources: new List<CardSource>() { selectedCard },
  98. activateClass: activateClass,
  99. payCost: false,
  100. isTapped: false, root: SelectCardEffect.Root.Hand,
  101. activateETB: true));
  102. }
  103. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermamentCondition))
  104. {
  105. Permanent selectedPermanent = null;
  106. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  107. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermamentCondition));
  108. selectPermanentEffect.SetUp(
  109. selectPlayer: card.Owner,
  110. canTargetCondition: CanSelectPermamentCondition,
  111. canTargetCondition_ByPreSelecetedList: null,
  112. canEndSelectCondition: null,
  113. maxCount: maxCount,
  114. canNoSelect: false,
  115. canEndNotMax: false,
  116. selectPermanentCoroutine: SelectedPermanent,
  117. afterSelectPermanentCoroutine: null,
  118. mode: SelectPermanentEffect.Mode.Custom,
  119. cardEffect: activateClass);
  120. IEnumerator SelectedPermanent(Permanent target)
  121. {
  122. selectedPermanent = target;
  123. yield return null;
  124. }
  125. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will gain <Reboot> & <Blocker>.", "Your opponent is selecting 1 Digimon that will gain <Reboot> & <Blocker>.");
  126. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  127. if (selectedPermanent != null)
  128. {
  129. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainReboot(
  130. targetPermanent: selectedPermanent,
  131. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  132. activateClass: activateClass));
  133. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainBlocker(
  134. targetPermanent: selectedPermanent,
  135. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  136. activateClass: activateClass));
  137. }
  138. }
  139. }
  140. }
  141. #endregion
  142. #region Alliance - ESS
  143. if (timing == EffectTiming.OnAllyAttack)
  144. {
  145. cardEffects.Add(CardEffectFactory.AllianceSelfEffect(isInheritedEffect: true, card: card, null));
  146. }
  147. #endregion
  148. return cardEffects;
  149. }
  150. }
  151. }