ST19_04.cs 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.ST19
  4. {
  5. public class ST19_04 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region On Play
  11. if (timing == EffectTiming.OnEnterFieldAnyone)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Trash 1 [Puppet], <Draw 2>", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  16. cardEffects.Add(activateClass);
  17. string EffectDescription()
  18. {
  19. return "[On Play] By trashing 1 card with the [Puppet] trait in your hand, <Draw 2>.";
  20. }
  21. bool CanUseCondition(Hashtable hashtable)
  22. {
  23. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  24. }
  25. bool HasPuppetInTrait(CardSource cardSource)
  26. {
  27. return cardSource.ContainsTraits("Puppet");
  28. }
  29. bool CanActivateCondition(Hashtable hashtable)
  30. {
  31. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  32. CardEffectCommons.HasMatchConditionOwnersHand(card, HasPuppetInTrait);
  33. }
  34. IEnumerator ActivateCoroutine(Hashtable hashtable)
  35. {
  36. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  37. selectHandEffect.SetUp(
  38. canTargetCondition: HasPuppetInTrait,
  39. canTargetCondition_ByPreSelecetedList: null,
  40. canEndSelectCondition: null,
  41. canNoSelect: true,
  42. selectCardCoroutine: null,
  43. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  44. maxCount: 1,
  45. canEndNotMax: false,
  46. isShowOpponent: true,
  47. mode: SelectHandEffect.Mode.Discard,
  48. selectPlayer: card.Owner,
  49. cardEffect: activateClass);
  50. selectHandEffect.SetUpCustomMessage("Select 1 card with [Puppet] trait to discard.",
  51. "The opponent is selecting 1 card with [Puppet] trait to discard.");
  52. yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
  53. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  54. {
  55. if (cardSources.Count > 0)
  56. yield return ContinuousController.instance.StartCoroutine(
  57. new DrawClass(card.Owner, 2, activateClass).Draw());
  58. }
  59. }
  60. }
  61. #endregion
  62. #region Reboot - ESS
  63. if (timing == EffectTiming.None)
  64. {
  65. cardEffects.Add(CardEffectFactory.RebootSelfStaticEffect(isInheritedEffect: true, card: card, condition: null));
  66. }
  67. #endregion
  68. return cardEffects;
  69. }
  70. }
  71. }