ArtsDigivolve.cs 2.6 KB

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