BT20_051.cs 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT20
  5. {
  6. public class BT20_051 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alternate Digivolution
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return (targetPermanent.TopCard.EqualsCardName("Dorumon")) ||
  17. (targetPermanent.TopCard.IsLevel3 && targetPermanent.TopCard.EqualsTraits("Chronicle"));
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  20. permanentCondition: PermanentCondition,
  21. digivolutionCost: 2,
  22. ignoreDigivolutionRequirement: false,
  23. card: card,
  24. condition: null));
  25. }
  26. #endregion
  27. #region When Digivolving
  28. if (timing == EffectTiming.OnEnterFieldAnyone)
  29. {
  30. ActivateClass activateClass = new ActivateClass();
  31. activateClass.SetUpICardEffect("Play 1 Tamer with [Kota Domoto] in its name from hand", CanUseCondition, card);
  32. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  33. cardEffects.Add(activateClass);
  34. string EffectDescription()
  35. {
  36. return
  37. "[When Digivolving] If you have 1 or fewer Tamers, you may play 1 [Kota Domoto] from your hand without paying the cost.";
  38. }
  39. bool CanUseCondition(Hashtable hashtable)
  40. {
  41. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  42. }
  43. bool IsTamerCardCondition(CardSource cardSource)
  44. {
  45. return cardSource.IsTamer &&
  46. cardSource.EqualsCardName("Kota Domoto") &&
  47. CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass);
  48. }
  49. bool CanActivateCondition(Hashtable hashtable)
  50. {
  51. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  52. CardEffectCommons.HasMatchConditionOwnersHand(card, IsTamerCardCondition) &&
  53. card.Owner.GetBattleAreaPermanents().Count(permanent => permanent.IsTamer) <= 1;
  54. }
  55. IEnumerator ActivateCoroutine(Hashtable hashtable)
  56. {
  57. List<CardSource> selectedCards = new List<CardSource>();
  58. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  59. selectHandEffect.SetUp(
  60. selectPlayer: card.Owner,
  61. canTargetCondition: IsTamerCardCondition,
  62. canTargetCondition_ByPreSelecetedList: null,
  63. canEndSelectCondition: null,
  64. maxCount: 1,
  65. canNoSelect: true,
  66. canEndNotMax: false,
  67. isShowOpponent: true,
  68. selectCardCoroutine: SelectCardCoroutine,
  69. afterSelectCardCoroutine: null,
  70. mode: SelectHandEffect.Mode.Custom,
  71. cardEffect: activateClass);
  72. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  73. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  74. yield return StartCoroutine(selectHandEffect.Activate());
  75. IEnumerator SelectCardCoroutine(CardSource cardSource)
  76. {
  77. selectedCards.Add(cardSource);
  78. yield return null;
  79. }
  80. if (selectedCards.Count >= 1)
  81. {
  82. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  83. cardSources: selectedCards,
  84. activateClass: activateClass,
  85. payCost: false,
  86. isTapped: false,
  87. root: SelectCardEffect.Root.Hand,
  88. activateETB: true));
  89. }
  90. }
  91. }
  92. #endregion
  93. #region Opponent's Turn - ESS
  94. if (timing == EffectTiming.None)
  95. {
  96. bool Condition()
  97. {
  98. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  99. CardEffectCommons.IsOpponentTurn(card);
  100. }
  101. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(
  102. changeValue: 2000,
  103. isInheritedEffect: true,
  104. card: card,
  105. condition: Condition));
  106. }
  107. #endregion
  108. return cardEffects;
  109. }
  110. }
  111. }