BT21_019.cs 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. //BetelGammamon
  5. namespace DCGO.CardEffects.BT21
  6. {
  7. public class BT21_019 : 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. if (targetPermanent.TopCard.EqualsCardName("Gammamon"))
  18. {
  19. return true;
  20. }
  21. return false;
  22. }
  23. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  24. permanentCondition: PermanentCondition,
  25. digivolutionCost: 2,
  26. ignoreDigivolutionRequirement: false,
  27. card: card,
  28. condition: null)
  29. );
  30. }
  31. #endregion
  32. #region When Digivolving
  33. if (timing == EffectTiming.OnEnterFieldAnyone)
  34. {
  35. ActivateClass activateClass = new ActivateClass();
  36. activateClass.SetUpICardEffect("Play 1 [Hiro Amanokawa] from hand", CanUseCondition, card);
  37. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  38. cardEffects.Add(activateClass);
  39. string EffectDiscription()
  40. => "[When Digivolving] If you have 1 or fewer Tamers, you may play 1 [Hiro Amanokawa] from your hand without paying the cost.";
  41. bool CanUseCondition(Hashtable hashtable)
  42. {
  43. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  44. {
  45. if (CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card))
  46. {
  47. return true;
  48. }
  49. }
  50. return false;
  51. }
  52. bool CanActivateCondition(Hashtable hashtable)
  53. {
  54. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  55. {
  56. if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition))
  57. {
  58. if (card.Owner.GetBattleAreaPermanents().Count(permanent => permanent.IsTamer) <= 1)
  59. {
  60. return true;
  61. }
  62. }
  63. }
  64. return false;
  65. }
  66. bool CanSelectCardCondition(CardSource source)
  67. {
  68. if (source.IsTamer)
  69. {
  70. if (source.EqualsCardName("Hiro Amanokawa"))
  71. {
  72. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: source, payCost: false, cardEffect: activateClass))
  73. {
  74. return true;
  75. }
  76. }
  77. }
  78. return false;
  79. }
  80. IEnumerator ActivateCoroutine(Hashtable hashtable)
  81. {
  82. CardSource selectedCard = null;
  83. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  84. selectHandEffect.SetUp(
  85. selectPlayer: card.Owner,
  86. canTargetCondition: CanSelectCardCondition,
  87. canTargetCondition_ByPreSelecetedList: null,
  88. canEndSelectCondition: null,
  89. maxCount: 1,
  90. canNoSelect: true,
  91. canEndNotMax: false,
  92. isShowOpponent: true,
  93. selectCardCoroutine: SelectCardCoroutine,
  94. afterSelectCardCoroutine: null,
  95. mode: SelectHandEffect.Mode.Custom,
  96. cardEffect: activateClass);
  97. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  98. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  99. yield return StartCoroutine(selectHandEffect.Activate());
  100. IEnumerator SelectCardCoroutine(CardSource cardSource)
  101. {
  102. selectedCard = cardSource;
  103. yield return null;
  104. }
  105. if (selectedCard != null)
  106. {
  107. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: new List<CardSource>() { selectedCard }, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  108. }
  109. }
  110. }
  111. #endregion
  112. #region ESS
  113. if (timing == EffectTiming.None)
  114. {
  115. bool Condition()
  116. {
  117. if (CardEffectCommons.IsOwnerTurn(card))
  118. {
  119. return true;
  120. }
  121. return false;
  122. }
  123. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(changeValue: 2000, isInheritedEffect: true, card: card, condition: Condition));
  124. }
  125. #endregion
  126. return cardEffects;
  127. }
  128. }
  129. }