BT17_066.cs 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT17
  4. {
  5. public class BT17_066 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Alternate Digivolution
  11. if (timing == EffectTiming.None)
  12. {
  13. bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. return targetPermanent.TopCard.EqualsCardName("Darcmon");
  16. }
  17. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  18. permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false,
  19. card: card, condition: null));
  20. }
  21. #endregion
  22. #region Blocker
  23. if (timing == EffectTiming.None)
  24. {
  25. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  26. }
  27. #endregion
  28. #region When Digivolving
  29. if (timing == EffectTiming.OnEnterFieldAnyone)
  30. {
  31. ActivateClass activateClass = new ActivateClass();
  32. activateClass.SetUpICardEffect("Play 1 level 3 Purple or Yellow Digimon card from your hand",
  33. CanUseCondition, card);
  34. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  35. cardEffects.Add(activateClass);
  36. string EffectDescription()
  37. {
  38. return
  39. "[When Digivolving] You may play 1 level 3 Purple or Yellow Digimon card from your hand without paying the cost.";
  40. }
  41. bool CanUseCondition(Hashtable hashtable)
  42. {
  43. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  44. }
  45. bool CanSelectCardCondition(CardSource cardSource)
  46. {
  47. return CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass) &&
  48. cardSource.IsDigimon &&
  49. cardSource.IsLevel3 &&
  50. (cardSource.HasCardColor(CardColor.Purple) || cardSource.HasCardColor(CardColor.Yellow));
  51. }
  52. bool CanActivateCondition(Hashtable hashtable)
  53. {
  54. return CardEffectCommons.IsExistOnBattleArea(card) &&
  55. card.Owner.HandCards.Some(CanSelectCardCondition);
  56. }
  57. IEnumerator ActivateCoroutine(Hashtable hashtable)
  58. {
  59. if (card.Owner.HandCards.Some(CanSelectCardCondition))
  60. {
  61. List<CardSource> selectedCards = new List<CardSource>();
  62. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  63. selectHandEffect.SetUp(
  64. selectPlayer: card.Owner,
  65. canTargetCondition: CanSelectCardCondition,
  66. canTargetCondition_ByPreSelecetedList: null,
  67. canEndSelectCondition: null,
  68. maxCount: 1,
  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 Digimon card to play.",
  77. "The opponent is selecting 1 Digimon card to play.");
  78. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  79. yield return StartCoroutine(selectHandEffect.Activate());
  80. IEnumerator SelectCardCoroutine(CardSource cardSource)
  81. {
  82. selectedCards.Add(cardSource);
  83. yield return null;
  84. }
  85. yield return ContinuousController.instance.StartCoroutine(
  86. CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass,
  87. payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  88. }
  89. }
  90. }
  91. #endregion
  92. #region Blocker - ESS
  93. if (timing == EffectTiming.None)
  94. {
  95. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: true, card: card, condition: null));
  96. }
  97. #endregion
  98. return cardEffects;
  99. }
  100. }
  101. }