ST5_15.cs 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System.Linq;
  5. using Photon;
  6. using System;
  7. using Photon.Pun;
  8. public class ST5_15 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. if (timing == EffectTiming.OptionSkill)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  17. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[Main] Trigger <De-Digivolve 1> on up to 2 of your opponent's Digimon. (Trash a card from the top of one of your opponent's Digimon. If it has no digivolution cards, or becomes a level 3 Digimon, you can't trash any more cards.)";
  22. }
  23. bool CanSelectPermanentCondition(Permanent permanent)
  24. {
  25. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  26. }
  27. bool CanUseCondition(Hashtable hashtable)
  28. {
  29. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  30. }
  31. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  32. {
  33. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  34. {
  35. int maxCount = Math.Min(2, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  36. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  37. selectPermanentEffect.SetUp(
  38. selectPlayer: card.Owner,
  39. canTargetCondition: CanSelectPermanentCondition,
  40. canTargetCondition_ByPreSelecetedList: null,
  41. canEndSelectCondition: CanEndSelectCondition,
  42. maxCount: maxCount,
  43. canNoSelect: false,
  44. canEndNotMax: true,
  45. selectPermanentCoroutine: SelectPermanentCoroutine,
  46. afterSelectPermanentCoroutine: null,
  47. mode: SelectPermanentEffect.Mode.Custom,
  48. cardEffect: activateClass);
  49. selectPermanentEffect.SetUpCustomMessage("Select Digimon to De-Digivolve.", "The opponent is selecting Digimon to De-Digivolve.");
  50. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  51. bool CanEndSelectCondition(List<Permanent> permanents)
  52. {
  53. if (CardEffectCommons.HasNoElement(permanents))
  54. {
  55. return false;
  56. }
  57. return true;
  58. }
  59. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  60. {
  61. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(permanent, 1, activateClass).Degeneration());
  62. }
  63. }
  64. }
  65. }
  66. if (timing == EffectTiming.SecuritySkill)
  67. {
  68. CardEffectCommons.AddActivateMainOptionSecurityEffect(card: card, cardEffects: ref cardEffects, effectName: $"De-Digivolve 1 to 2 Digimon");
  69. }
  70. return cardEffects;
  71. }
  72. }