ST5_12.cs 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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 ST5_12 : 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.OnEnterFieldAnyone)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Gain Reboot", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[When Digivolving] Up to 2 of your Digimon gain <Reboot> (Unsuspend this Digimon during your opponent's unsuspend phase) until the end of your opponent's next turn.";
  22. }
  23. bool CanSelectPermanentCondition(Permanent permanent)
  24. {
  25. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  26. }
  27. bool CanUseCondition(Hashtable hashtable)
  28. {
  29. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  30. }
  31. bool CanActivateCondition(Hashtable hashtable)
  32. {
  33. if (CardEffectCommons.IsExistOnBattleArea(card))
  34. {
  35. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  36. {
  37. return true;
  38. }
  39. }
  40. return false;
  41. }
  42. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  43. {
  44. if (isExistOnField(card))
  45. {
  46. if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard()))
  47. {
  48. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  49. {
  50. int maxCount = Math.Min(2, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  51. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  52. selectPermanentEffect.SetUp(
  53. selectPlayer: card.Owner,
  54. canTargetCondition: CanSelectPermanentCondition,
  55. canTargetCondition_ByPreSelecetedList: null,
  56. canEndSelectCondition: CanEndSelectCondition,
  57. maxCount: maxCount,
  58. canNoSelect: false,
  59. canEndNotMax: true,
  60. selectPermanentCoroutine: SelectPermanentCoroutine,
  61. afterSelectPermanentCoroutine: null,
  62. mode: SelectPermanentEffect.Mode.Custom,
  63. cardEffect: activateClass);
  64. selectPermanentEffect.SetUpCustomMessage("Select up to 2 Digimon to gain Reboot.", "The opponent is selecting up to 2 Digimon to gain Reboot.");
  65. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  66. bool CanEndSelectCondition(List<Permanent> permanents)
  67. {
  68. if (permanents.Count <= 0)
  69. {
  70. return false;
  71. }
  72. return true;
  73. }
  74. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  75. {
  76. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainReboot(targetPermanent: permanent, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  77. }
  78. }
  79. }
  80. }
  81. }
  82. }
  83. return cardEffects;
  84. }
  85. }