ArtsDigivolve.cs 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. public partial class CardEffectFactory
  4. {
  5. #region Processing of [Arts Digivolve]
  6. public static OptionResolutionClass ArtsDigivolveEffect(CardSource card)
  7. {
  8. if (card == null) return null;
  9. OptionResolutionClass artsDigivolutionClass = new();
  10. artsDigivolutionClass.SetUpICardEffect("Arts Digivolve", CanUseCondition, card);
  11. artsDigivolutionClass.SetUpOptionResolutionClass(ResolutionCoroutine, CanResolveCondition);
  12. return artsDigivolutionClass;
  13. bool CanUseCondition(Hashtable hashtable) => CardEffectCommons.IsExistOnExecutingArea(card);
  14. bool CanResolveCondition(CardSource optionCard) => CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition, true);
  15. bool CanSelectPermanentCondition(Permanent permanent)
  16. {
  17. return CardEffectCommons.IsOwnerPermanent(permanent, card)
  18. && permanent.IsDigimon
  19. && card.CanPlayCardTargetFrame(permanent.PermanentFrame, false, artsDigivolutionClass, SelectCardEffect.Root.Execution);
  20. }
  21. IEnumerator ResolutionCoroutine(CardSource optionCard)
  22. {
  23. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  24. selectPermanentEffect.SetUp(
  25. selectPlayer: card.Owner,
  26. canTargetCondition: CanSelectPermanentCondition,
  27. canTargetCondition_ByPreSelecetedList: null,
  28. canEndSelectCondition: null,
  29. maxCount: 1,
  30. canNoSelect: true,
  31. canEndNotMax: false,
  32. selectPermanentCoroutine: SelectPermanentCoroutine,
  33. afterSelectPermanentCoroutine: null,
  34. mode: SelectPermanentEffect.Mode.Custom,
  35. cardEffect: artsDigivolutionClass);
  36. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to Arts Digivolve.", "The opponent is selecting 1 Digimon to Arts Digivolve.");
  37. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  38. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  39. {
  40. yield return ContinuousController.instance.StartCoroutine(new PlayCardClass(
  41. cardSources: new List<CardSource>() { card },
  42. hashtable: null,
  43. payCost: false,
  44. targetPermanent: permanent,
  45. isTapped: false,
  46. root: SelectCardEffect.Root.Execution,
  47. activateETB: true).PlayCard());
  48. }
  49. }
  50. }
  51. #endregion
  52. }