ST18_01.cs 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.ST18
  4. {
  5. public class ST18_01 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region When Attacking - ESS
  11. if (timing == EffectTiming.OnAllyAttack)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Suspend 1 Digimon", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDescription());
  16. activateClass.SetIsInheritedEffect(true);
  17. activateClass.SetHashString("Suspend_ST18_01");
  18. cardEffects.Add(activateClass);
  19. string EffectDescription()
  20. {
  21. return "[When Attacking] (Once Per Turn) You may suspend 1 other Digimon with DP less than or equal to this Digimon.";
  22. }
  23. bool CanSelectPermanentCondition(Permanent permanent)
  24. {
  25. if(CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(permanent))
  26. return permanent != card.PermanentOfThisCard() &&
  27. permanent.DP <= card.PermanentOfThisCard().DP;
  28. return false;
  29. }
  30. bool CanUseCondition(Hashtable hashtable)
  31. {
  32. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  33. }
  34. bool CanActivateCondition(Hashtable hashtable)
  35. {
  36. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  37. CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition);
  38. }
  39. IEnumerator ActivateCoroutine(Hashtable hashtable)
  40. {
  41. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  42. selectPermanentEffect.SetUp(
  43. selectPlayer: card.Owner,
  44. canTargetCondition: CanSelectPermanentCondition,
  45. canTargetCondition_ByPreSelecetedList: null,
  46. canEndSelectCondition: null,
  47. maxCount: 1,
  48. canNoSelect: true,
  49. canEndNotMax: false,
  50. selectPermanentCoroutine: null,
  51. afterSelectPermanentCoroutine: null,
  52. mode: SelectPermanentEffect.Mode.Tap,
  53. cardEffect: activateClass);
  54. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  55. }
  56. }
  57. #endregion
  58. return cardEffects;
  59. }
  60. }
  61. }