BT11_011.cs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT11
  5. {
  6. public class BT11_011 : 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.None)
  12. {
  13. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  14. }
  15. if (timing == EffectTiming.OnDestroyedAnyone)
  16. {
  17. ActivateClass activateClass = new ActivateClass();
  18. activateClass.SetUpICardEffect("Play 1 red Tamer from hand", CanUseCondition, card);
  19. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  20. activateClass.SetIsInheritedEffect(true);
  21. cardEffects.Add(activateClass);
  22. string EffectDiscription()
  23. {
  24. return "[On Deletion] You may play 1 red Tamer card with a play cost of 4 or less from your hand without paying the cost.";
  25. }
  26. bool CanSelectCardCondition(CardSource cardSource)
  27. {
  28. if (cardSource.HasCardColor(CardColor.Red))
  29. {
  30. if (cardSource.IsTamer)
  31. {
  32. if (cardSource.GetCostItself <= 4)
  33. {
  34. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  35. {
  36. return true;
  37. }
  38. }
  39. }
  40. }
  41. return false;
  42. }
  43. bool CanUseCondition(Hashtable hashtable)
  44. {
  45. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  46. }
  47. bool CanActivateCondition(Hashtable hashtable)
  48. {
  49. if (CardEffectCommons.CanActivateOnDeletion(card, activateClass))
  50. {
  51. if (card.Owner.HandCards.Count >= 1)
  52. {
  53. return true;
  54. }
  55. }
  56. return false;
  57. }
  58. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  59. {
  60. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  61. {
  62. List<CardSource> selectedCards = new List<CardSource>();
  63. int maxCount = 1;
  64. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  65. selectHandEffect.SetUp(
  66. selectPlayer: card.Owner,
  67. canTargetCondition: CanSelectCardCondition,
  68. canTargetCondition_ByPreSelecetedList: null,
  69. canEndSelectCondition: null,
  70. maxCount: maxCount,
  71. canNoSelect: true,
  72. canEndNotMax: false,
  73. isShowOpponent: true,
  74. selectCardCoroutine: SelectCardCoroutine,
  75. afterSelectCardCoroutine: null,
  76. mode: SelectHandEffect.Mode.Custom,
  77. cardEffect: activateClass);
  78. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  79. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  80. yield return StartCoroutine(selectHandEffect.Activate());
  81. IEnumerator SelectCardCoroutine(CardSource cardSource)
  82. {
  83. selectedCards.Add(cardSource);
  84. yield return null;
  85. }
  86. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  87. cardSources: selectedCards,
  88. activateClass: activateClass,
  89. payCost: false,
  90. isTapped: false,
  91. root: SelectCardEffect.Root.Hand,
  92. activateETB: true));
  93. }
  94. }
  95. }
  96. return cardEffects;
  97. }
  98. }
  99. }