BT22_046.cs 5.2 KB

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