ST5_09.cs 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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_09 : 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("Your 1 Digimon gains Blocker", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[When Digivolving] Until the end of your opponent's next turn, 1 of your Digimon gains <Blocker>. (When an opponent's Digimon attacks, you may suspend this Digimon to force the opponent to attack it instead.)";
  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. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  45. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  46. selectPermanentEffect.SetUp(
  47. selectPlayer: card.Owner,
  48. canTargetCondition: CanSelectPermanentCondition,
  49. canTargetCondition_ByPreSelecetedList: null,
  50. canEndSelectCondition: null,
  51. maxCount: maxCount,
  52. canNoSelect: false,
  53. canEndNotMax: false,
  54. selectPermanentCoroutine: SelectPermanentCoroutine,
  55. afterSelectPermanentCoroutine: null,
  56. mode: SelectPermanentEffect.Mode.Custom,
  57. cardEffect: activateClass);
  58. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get Blocker.", "The opponent is selecting 1 Digimon that will get Blocker.");
  59. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  60. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  61. {
  62. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainBlocker(targetPermanent: permanent, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  63. }
  64. }
  65. }
  66. return cardEffects;
  67. }
  68. }