Gyuukimon_LM_018.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.LM
  4. {
  5. public class Gyuukimon_LM_018 : 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.OnEnterFieldAnyone)
  11. {
  12. ActivateClass activateClass = new ActivateClass();
  13. activateClass.SetUpICardEffect("Delete 1 levl 4 Digimon", CanUseCondition, card);
  14. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  15. cardEffects.Add(activateClass);
  16. string EffectDiscription()
  17. {
  18. return "[On Play] Delete 1 level 4 or lower Digimon. If you did, you may play 1 [Gyuukimon] Token without paying the cost. (Digimon/Cost 7/Lv.5/Purple/Ultimate/Virus/Dark Animal/3000 DP)";
  19. }
  20. bool CanSelectPermanentCondition(Permanent permanent)
  21. {
  22. if (CardEffectCommons.IsPermanentExistsOnBattleArea(permanent))
  23. {
  24. if (permanent.IsDigimon)
  25. {
  26. if (permanent.Level <= 4)
  27. {
  28. return true;
  29. }
  30. }
  31. }
  32. return false;
  33. }
  34. bool CanUseCondition(Hashtable hashtable)
  35. {
  36. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  37. }
  38. bool CanActivateCondition(Hashtable hashtable)
  39. {
  40. if (CardEffectCommons.IsExistOnBattleArea(card))
  41. {
  42. return true;
  43. }
  44. return false;
  45. }
  46. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  47. {
  48. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  49. {
  50. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  51. selectPermanentEffect.SetUp(
  52. selectPlayer: card.Owner,
  53. canTargetCondition: CanSelectPermanentCondition,
  54. canTargetCondition_ByPreSelecetedList: null,
  55. canEndSelectCondition: null,
  56. maxCount: 1,
  57. canNoSelect: false,
  58. canEndNotMax: false,
  59. selectPermanentCoroutine: SelectPermanentCoroutine,
  60. afterSelectPermanentCoroutine: null,
  61. mode: SelectPermanentEffect.Mode.Destroy,
  62. cardEffect: activateClass);
  63. selectPermanentEffect.SetUpCustomMessage("Select 1 Level 4 or lower Digimon", "Opponent is selecting level 4 or lower Digimon");
  64. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  65. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  66. {
  67. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: new List<Permanent>() { permanent }, activateClass: activateClass, successProcess: permanents => SuccessProcess(), failureProcess: null));
  68. }
  69. IEnumerator SuccessProcess()
  70. {
  71. ActivateClass activateClass = new ActivateClass();
  72. activateClass.SetUpICardEffect("Play 1 Gyuukimon Token", CanUseCondition, card);
  73. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  74. cardEffects.Add(activateClass);
  75. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayGyuukimonToken(activateClass));
  76. }
  77. }
  78. }
  79. }
  80. return cardEffects;
  81. }
  82. }
  83. }