BT19_019.cs 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT19
  5. {
  6. public class BT19_019 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region When Digivolving
  12. if (timing == EffectTiming.OnEnterFieldAnyone)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("Play 1 Tamer with [Yao Qinglan] in its name from hand", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  17. cardEffects.Add(activateClass);
  18. string EffectDescription()
  19. {
  20. return
  21. "[When Digivolving] If you have 1 or fewer Tamers, you may play 1 [Yao Qinglan] from your hand without paying the cost.";
  22. }
  23. bool CanUseCondition(Hashtable hashtable)
  24. {
  25. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  26. }
  27. bool IsTamerCardCondition(CardSource cardSource)
  28. {
  29. return cardSource.IsTamer &&
  30. cardSource.EqualsCardName("Yao Qinglan") &&
  31. CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass);
  32. }
  33. bool CanActivateCondition(Hashtable hashtable)
  34. {
  35. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  36. CardEffectCommons.HasMatchConditionOwnersHand(card, IsTamerCardCondition) &&
  37. card.Owner.GetBattleAreaPermanents().Count(permanent => permanent.IsTamer) <= 1;
  38. }
  39. IEnumerator ActivateCoroutine(Hashtable hashtable)
  40. {
  41. List<CardSource> selectedCards = new List<CardSource>();
  42. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  43. selectHandEffect.SetUp(
  44. selectPlayer: card.Owner,
  45. canTargetCondition: IsTamerCardCondition,
  46. canTargetCondition_ByPreSelecetedList: null,
  47. canEndSelectCondition: null,
  48. maxCount: 1,
  49. canNoSelect: true,
  50. canEndNotMax: false,
  51. isShowOpponent: true,
  52. selectCardCoroutine: SelectCardCoroutine,
  53. afterSelectCardCoroutine: null,
  54. mode: SelectHandEffect.Mode.Custom,
  55. cardEffect: activateClass);
  56. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  57. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  58. yield return StartCoroutine(selectHandEffect.Activate());
  59. IEnumerator SelectCardCoroutine(CardSource cardSource)
  60. {
  61. selectedCards.Add(cardSource);
  62. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  63. cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false,
  64. root: SelectCardEffect.Root.Hand, activateETB: true));
  65. }
  66. }
  67. }
  68. #endregion
  69. #region End of Attack - ESS
  70. if (timing == EffectTiming.OnEndAttack)
  71. {
  72. ActivateClass activateClass = new ActivateClass();
  73. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  74. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  75. activateClass.SetIsInheritedEffect(true);
  76. activateClass.SetHashString("Memory+1_BT19_017");
  77. cardEffects.Add(activateClass);
  78. string EffectDescription()
  79. {
  80. return "[End of Attack] (Once Per Turn) Gain 1 memory.";
  81. }
  82. bool CanUseCondition(Hashtable hashtable)
  83. {
  84. return CardEffectCommons.CanTriggerOnEndAttack(hashtable, card);
  85. }
  86. bool CanActivateCondition(Hashtable hashtable)
  87. {
  88. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && card.Owner.LibraryCards.Count >= 1;
  89. }
  90. IEnumerator ActivateCoroutine(Hashtable hashtable)
  91. {
  92. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  93. }
  94. }
  95. #endregion
  96. return cardEffects;
  97. }
  98. }
  99. }