EX5_058_token.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.Tokens
  4. {
  5. public class EX5_058_token : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. if (timing == EffectTiming.None)
  11. {
  12. bool CanUseCondition()
  13. {
  14. return CardEffectCommons.IsExistOnBattleArea(card);
  15. }
  16. string effectName = "This Digimon doesn't unsuspend.";
  17. cardEffects.Add(CardEffectFactory.CantUnsuspendStaticEffect(
  18. permanentCondition: permanent => permanent == card.PermanentOfThisCard(),
  19. isInheritedEffect: false,
  20. card: card,
  21. condition: CanUseCondition,
  22. effectName: effectName
  23. ));
  24. }
  25. if (timing == EffectTiming.OnDestroyedAnyone)
  26. {
  27. ActivateClass activateClass = new ActivateClass();
  28. activateClass.SetUpICardEffect("Trash 1 card from hand", CanUseCondition, card);
  29. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  30. cardEffects.Add(activateClass);
  31. string EffectDiscription()
  32. {
  33. return "[On Deletion] Trash 1 card in your hand.";
  34. }
  35. bool CanUseCondition(Hashtable hashtable)
  36. {
  37. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  38. }
  39. bool CanActivateCondition(Hashtable hashtable)
  40. {
  41. if (card.Owner.HandCards.Count >= 1)
  42. {
  43. return true;
  44. }
  45. return false;
  46. }
  47. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  48. {
  49. if (card.Owner.HandCards.Count >= 1)
  50. {
  51. int discardCount = 1;
  52. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  53. selectHandEffect.SetUp(
  54. selectPlayer: card.Owner,
  55. canTargetCondition: (cardSource) => true,
  56. canTargetCondition_ByPreSelecetedList: null,
  57. canEndSelectCondition: null,
  58. maxCount: discardCount,
  59. canNoSelect: false,
  60. canEndNotMax: false,
  61. isShowOpponent: true,
  62. selectCardCoroutine: null,
  63. afterSelectCardCoroutine: null,
  64. mode: SelectHandEffect.Mode.Discard,
  65. cardEffect: activateClass);
  66. yield return StartCoroutine(selectHandEffect.Activate());
  67. }
  68. }
  69. }
  70. return cardEffects;
  71. }
  72. }
  73. }