BT13_054.cs 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT13
  5. {
  6. public class BT13_054 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. if (timing == EffectTiming.OnEnterFieldAnyone)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Play 1 [Yoshino Fujieda] from hand", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[When Digivolving] You may play 1 [Yoshino Fujieda] from your hand without paying the cost.";
  20. }
  21. bool CanSelectCardCondition(CardSource cardSource)
  22. {
  23. if (cardSource != null)
  24. {
  25. if (cardSource.CardNames.Contains("Yoshino Fujieda") || cardSource.CardNames.Contains("YoshinoFujieda"))
  26. {
  27. if (cardSource.Owner == card.Owner)
  28. {
  29. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  30. {
  31. return true;
  32. }
  33. }
  34. }
  35. }
  36. return false;
  37. }
  38. bool CanUseCondition(Hashtable hashtable)
  39. {
  40. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  41. }
  42. bool CanActivateCondition(Hashtable hashtable)
  43. {
  44. if (CardEffectCommons.IsExistOnBattleArea(card))
  45. {
  46. if (card.Owner.HandCards.Count >= 1)
  47. {
  48. return true;
  49. }
  50. }
  51. return false;
  52. }
  53. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  54. {
  55. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  56. {
  57. List<CardSource> selectedCards = new List<CardSource>();
  58. int maxCount = 1;
  59. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  60. selectHandEffect.SetUp(
  61. selectPlayer: card.Owner,
  62. canTargetCondition: CanSelectCardCondition,
  63. canTargetCondition_ByPreSelecetedList: null,
  64. canEndSelectCondition: null,
  65. maxCount: maxCount,
  66. canNoSelect: true,
  67. canEndNotMax: false,
  68. isShowOpponent: true,
  69. selectCardCoroutine: SelectCardCoroutine,
  70. afterSelectCardCoroutine: null,
  71. mode: SelectHandEffect.Mode.Custom,
  72. cardEffect: activateClass);
  73. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  74. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  75. yield return StartCoroutine(selectHandEffect.Activate());
  76. IEnumerator SelectCardCoroutine(CardSource cardSource)
  77. {
  78. selectedCards.Add(cardSource);
  79. yield return null;
  80. }
  81. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  82. }
  83. }
  84. }
  85. if (timing == EffectTiming.None)
  86. {
  87. bool Condition()
  88. {
  89. if (CardEffectCommons.IsExistOnBattleArea(card))
  90. {
  91. if (CardEffectCommons.IsOwnerTurn(card))
  92. {
  93. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, (permanent) => permanent.IsDigimon && permanent.IsSuspended))
  94. {
  95. return true;
  96. }
  97. }
  98. }
  99. return false;
  100. }
  101. cardEffects.Add(CardEffectFactory.ChangeSelfSAttackStaticEffect(changeValue: 1, isInheritedEffect: true, card: card, condition: Condition));
  102. }
  103. return cardEffects;
  104. }
  105. }
  106. }