BT23_008.cs 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Greymon
  5. namespace DCGO.CardEffects.BT23
  6. {
  7. public class BT23_008 : 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.IsLevel3
  18. && (targetPermanent.TopCard.ContainsCardName("Agumon") || targetPermanent.TopCard.HasCSTraits);
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  21. permanentCondition: PermanentCondition,
  22. digivolutionCost: 2,
  23. ignoreDigivolutionRequirement: false,
  24. card: card,
  25. condition: null)
  26. );
  27. }
  28. #endregion
  29. #region Raid
  30. if (timing == EffectTiming.OnAllyAttack)
  31. {
  32. cardEffects.Add(CardEffectFactory.RaidSelfEffect(
  33. isInheritedEffect: false,
  34. card: card,
  35. condition: null)
  36. );
  37. }
  38. #endregion
  39. #region Main - OPT
  40. if (timing == EffectTiming.OnDeclaration)
  41. {
  42. ActivateClass activateClass = new ActivateClass();
  43. activateClass.SetUpICardEffect("By placing the top card of this Digimon as bottom digivolution card, play 1 [Gabumon]/[Nokia Shiramine] from hand for 2 less", CanUseCondition, card);
  44. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  45. activateClass.SetHashString("BT23_008_Main");
  46. cardEffects.Add(activateClass);
  47. string EffectDiscription()
  48. {
  49. return "[Main] [Once Per Turn] By placing this Digimon's top stacked card as its bottom digivolution card, you may play 1 [Gabumon] or [Nokia Shiramine] from your hand with the play cost reduced by 2.";
  50. }
  51. bool CanUseCondition(Hashtable hashtable)
  52. {
  53. return CardEffectCommons.IsExistOnBattleArea(card);
  54. }
  55. bool CanActivateCondition(Hashtable hashtable)
  56. {
  57. return CardEffectCommons.IsExistOnBattleArea(card)
  58. && CardEffectCommons.IsOwnerTurn(card)
  59. && card.PermanentOfThisCard().DigivolutionCards.Count >= 1;
  60. }
  61. bool CanSelectCardCondition(CardSource cardSource)
  62. {
  63. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource, true, activateClass))
  64. {
  65. if (cardSource.IsDigimon && cardSource.EqualsCardName("Gabumon")) return true;
  66. if (cardSource.IsTamer && cardSource.EqualsCardName("Nokia Shiramine")) return true;
  67. }
  68. return false;
  69. }
  70. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  71. {
  72. if (CardEffectCommons.IsExistOnBattleArea(card) && card.PermanentOfThisCard().DigivolutionCards.Count >= 1)
  73. {
  74. CardSource topCard = card.PermanentOfThisCard().TopCard;
  75. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(
  76. new List<CardSource>() { topCard },
  77. activateClass));
  78. if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition))
  79. {
  80. CardSource selectCard = null;
  81. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  82. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersCardCountInHand(card, CanSelectCardCondition));
  83. selectHandEffect.SetUp(
  84. selectPlayer: card.Owner,
  85. canTargetCondition: CanSelectCardCondition,
  86. canTargetCondition_ByPreSelecetedList: null,
  87. canEndSelectCondition: null,
  88. maxCount: maxCount,
  89. canNoSelect: true,
  90. canEndNotMax: false,
  91. isShowOpponent: true,
  92. selectCardCoroutine: SelectCardCoroutine,
  93. afterSelectCardCoroutine: null,
  94. mode: SelectHandEffect.Mode.Custom,
  95. cardEffect: activateClass);
  96. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  97. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  98. IEnumerator SelectCardCoroutine(CardSource cardSource)
  99. {
  100. selectCard = cardSource;
  101. yield return null;
  102. }
  103. yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
  104. if (selectCard != null)
  105. {
  106. int cost = selectCard.BasePlayCostFromEntity - 2;
  107. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  108. new List<CardSource>() { selectCard },
  109. activateClass: activateClass,
  110. payCost: true,
  111. isTapped: false,
  112. root: SelectCardEffect.Root.Hand,
  113. activateETB: true,
  114. fixedCost: cost));
  115. }
  116. }
  117. }
  118. }
  119. }
  120. #endregion
  121. #region ESS
  122. if (timing == EffectTiming.None)
  123. {
  124. bool Condition()
  125. {
  126. return CardEffectCommons.IsExistOnBattleArea(card) && CardEffectCommons.IsOwnerTurn(card);
  127. }
  128. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(changeValue: 2000, isInheritedEffect: true, card: card, condition: Condition));
  129. }
  130. #endregion
  131. return cardEffects;
  132. }
  133. }
  134. }