BT1_066.cs 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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 BT1_066 : 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.OnAllyAttack)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Suspend 1 Digimon", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. activateClass.SetIsInheritedEffect(true);
  19. cardEffects.Add(activateClass);
  20. string EffectDiscription()
  21. {
  22. return "[When Attacking] Suspend 1 of your opponent's Digimon with 3000 DP or less.";
  23. }
  24. bool CanSelectPermanentCondition(Permanent permanent)
  25. {
  26. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  27. {
  28. if (permanent.DP <= 3000)
  29. {
  30. return true;
  31. }
  32. }
  33. return false;
  34. }
  35. bool CanUseCondition(Hashtable hashtable)
  36. {
  37. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  38. }
  39. bool CanActivateCondition(Hashtable hashtable)
  40. {
  41. if (CardEffectCommons.IsExistOnBattleArea(card))
  42. {
  43. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  44. {
  45. return true;
  46. }
  47. }
  48. return false;
  49. }
  50. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  51. {
  52. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  53. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  54. selectPermanentEffect.SetUp(
  55. selectPlayer: card.Owner,
  56. canTargetCondition: CanSelectPermanentCondition,
  57. canTargetCondition_ByPreSelecetedList: null,
  58. canEndSelectCondition: null,
  59. maxCount: maxCount,
  60. canNoSelect: false,
  61. canEndNotMax: false,
  62. selectPermanentCoroutine: null,
  63. afterSelectPermanentCoroutine: null,
  64. mode: SelectPermanentEffect.Mode.Tap,
  65. cardEffect: activateClass);
  66. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  67. }
  68. }
  69. return cardEffects;
  70. }
  71. }