ArtsDigivolve.cs 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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.SetUpICardEffect("Arts Digivolve", CanUseCondition, card);
  14. artsDigivolutionClass.SetUpOptionResolutionClass(ResolutionCoroutine, CanResolveCondition);
  15. return artsDigivolutionClass;
  16. bool CanUseCondition(Hashtable hashtable) => CardEffectCommons.IsExistOnExecutingArea(card);
  17. bool CanResolveCondition(CardSource optionCard) => CardEffectCommons.HasMatchConditionOwnersPermanent(card, CanSelectPermanentCondition);
  18. bool CanSelectPermanentCondition(Permanent permanent)
  19. {
  20. return (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card)
  21. || CardEffectCommons.IsPermanentExistsOnOwnerBreedingArea(permanent, card))
  22. && card.CanPlayCardTargetFrame(permanent.PermanentFrame, false, artsDigivolutionClass, SelectCardEffect.Root.Execution);
  23. }
  24. IEnumerator ResolutionCoroutine(CardSource optionCard)
  25. {
  26. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  27. selectPermanentEffect.SetUp(
  28. selectPlayer: card.Owner,
  29. canTargetCondition: CanSelectPermanentCondition,
  30. canTargetCondition_ByPreSelecetedList: null,
  31. canEndSelectCondition: null,
  32. maxCount: 1,
  33. canNoSelect: true,
  34. canEndNotMax: false,
  35. selectPermanentCoroutine: SelectPermanentCoroutine,
  36. afterSelectPermanentCoroutine: null,
  37. mode: SelectPermanentEffect.Mode.Custom,
  38. cardEffect: artsDigivolutionClass);
  39. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to Arts Digivolve.", "The opponent is selecting 1 Digimon to Arts Digivolve.");
  40. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  41. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  42. {
  43. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoExcecutingAreaCard(
  44. permanent,
  45. null,
  46. false,
  47. null,
  48. null,
  49. -1,
  50. artsDigivolutionClass,
  51. null,
  52. ignoreSelection: true
  53. ));
  54. }
  55. }
  56. }
  57. #endregion
  58. }