EX9_048.cs 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.EX9
  4. {
  5. public class EX9_048 : 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 [Negamon], <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 [Negamon] in its text from your hand, <Draw 2>.";
  20. }
  21. bool CanUseCondition(Hashtable hashtable)
  22. {
  23. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  24. }
  25. bool HasCompositeInTrait(CardSource cardSource)
  26. {
  27. return cardSource.HasText("Negamon");
  28. }
  29. bool CanActivateCondition(Hashtable hashtable)
  30. {
  31. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  32. CardEffectCommons.HasMatchConditionOwnersHand(card, HasCompositeInTrait);
  33. }
  34. IEnumerator ActivateCoroutine(Hashtable hashtable)
  35. {
  36. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  37. selectHandEffect.SetUp(
  38. canTargetCondition: HasCompositeInTrait,
  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 [Negamon] in its text to discard.",
  51. "The opponent is selecting 1 card with [Negamon] in its text 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 Inherit
  63. if (timing == EffectTiming.None)
  64. {
  65. bool Condition()
  66. {
  67. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  68. }
  69. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(changeValue: 1000, isInheritedEffect: true, card: card, condition: Condition));
  70. }
  71. #endregion
  72. return cardEffects;
  73. }
  74. }
  75. }