P_003.cs 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.P
  4. {
  5. public class P_003 : 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("Trash the bottom digivolution card", CanUseCondition, card);
  14. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  15. cardEffects.Add(activateClass);
  16. string EffectDiscription()
  17. {
  18. return "[On Play] Trash the bottom digivolution card of 1 of your opponent's Digimon.";
  19. }
  20. bool CanSelectPermanentCondition(Permanent permanent)
  21. {
  22. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  23. }
  24. bool CanUseCondition(Hashtable hashtable)
  25. {
  26. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  27. }
  28. bool CanActivateCondition(Hashtable hashtable)
  29. {
  30. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  31. CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition);
  32. }
  33. IEnumerator ActivateCoroutine(Hashtable hashtable)
  34. {
  35. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  36. selectPermanentEffect.SetUp(
  37. selectPlayer: card.Owner,
  38. canTargetCondition: CanSelectPermanentCondition,
  39. canTargetCondition_ByPreSelecetedList: null,
  40. canEndSelectCondition: null,
  41. maxCount: 1,
  42. canNoSelect: false,
  43. canEndNotMax: false,
  44. selectPermanentCoroutine: SelectPermanentCoroutine,
  45. afterSelectPermanentCoroutine: null,
  46. mode: SelectPermanentEffect.Mode.Custom,
  47. cardEffect: activateClass);
  48. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will trash digivolution cards.", "The opponent is selecting 1 Digimon that will trash digivolution cards.");
  49. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  50. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  51. {
  52. Permanent selectedPermanent = permanent;
  53. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.TrashDigivolutionCardsFromTopOrBottom(
  54. targetPermanent: selectedPermanent,
  55. trashCount: 1,
  56. isFromTop: false,
  57. activateClass: activateClass));
  58. }
  59. }
  60. }
  61. return cardEffects;
  62. }
  63. }
  64. }