ST18_09.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.ST18
  4. {
  5. public class ST18_09 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Blocker
  11. if (timing == EffectTiming.None)
  12. {
  13. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(
  14. isInheritedEffect: false,
  15. card: card,
  16. condition: null));
  17. }
  18. #endregion
  19. #region On Deletion
  20. if (timing == EffectTiming.OnDestroyedAnyone)
  21. {
  22. ActivateClass activateClass = new ActivateClass();
  23. activateClass.SetUpICardEffect("Suspend 1 Digimon", CanUseCondition, card);
  24. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  25. cardEffects.Add(activateClass);
  26. string EffectDescription()
  27. {
  28. return
  29. "[On Deletion] You may play 1 Digimon card with [Avian]/[Bird]/[Vegetation]/[Plant] in one of its traits and 3000 DP or less from your hand without paying the cost.";
  30. }
  31. bool CanUseCondition(Hashtable hashtable)
  32. {
  33. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  34. }
  35. bool CanSelectCardCondition(CardSource cardSource)
  36. {
  37. return cardSource.IsDigimon &&
  38. (cardSource.HasBirdTraits || cardSource.HasPlantTraits) &&
  39. cardSource.HasDP &&
  40. cardSource.CardDP <= 3000 &&
  41. CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass);
  42. }
  43. bool CanActivateCondition(Hashtable hashtable)
  44. {
  45. return CardEffectCommons.CanActivateOnDeletion(card, activateClass) &&
  46. CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition);
  47. }
  48. IEnumerator ActivateCoroutine(Hashtable hashtable)
  49. {
  50. List<CardSource> selectedCards = new List<CardSource>();
  51. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  52. selectHandEffect.SetUp(
  53. selectPlayer: card.Owner,
  54. canTargetCondition: CanSelectCardCondition,
  55. canTargetCondition_ByPreSelecetedList: null,
  56. canEndSelectCondition: null,
  57. maxCount: 1,
  58. canNoSelect: true,
  59. canEndNotMax: false,
  60. isShowOpponent: true,
  61. selectCardCoroutine: SelectCardCoroutine,
  62. afterSelectCardCoroutine: null,
  63. mode: SelectHandEffect.Mode.Custom,
  64. cardEffect: activateClass);
  65. selectHandEffect.SetUpCustomMessage("Select card to play.",
  66. "The opponent is selecting 1 card to play.");
  67. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  68. yield return StartCoroutine(selectHandEffect.Activate());
  69. IEnumerator SelectCardCoroutine(CardSource cardSource)
  70. {
  71. selectedCards.Add(cardSource);
  72. yield return null;
  73. }
  74. yield return ContinuousController.instance.StartCoroutine(
  75. CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass,
  76. payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  77. }
  78. }
  79. #endregion
  80. return cardEffects;
  81. }
  82. }
  83. }