P_032.cs 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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 P_032 : 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.OnDigivolutionCardDiscarded)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Your 1 Digimon gains Jamming", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. activateClass.SetIsInheritedEffect(true);
  19. cardEffects.Add(activateClass);
  20. string EffectDiscription()
  21. {
  22. return "[Your Turn] When this card is trashed due to activating this Digimon's <Digi-Burst>, 1 of your Digimon gains <Jamming> (This Digimon can't be deleted in battles against Security Digimon) for the turn.";
  23. }
  24. bool CanSelectPermanentCondition(Permanent permanent)
  25. {
  26. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  27. }
  28. bool CanUseCondition(Hashtable hashtable)
  29. {
  30. if (CardEffectCommons.IsOwnerTurn(card))
  31. {
  32. if (CardEffectCommons.CanTriggerOnTrashBySelfDigiBurst(hashtable, card))
  33. {
  34. return true;
  35. }
  36. }
  37. return false;
  38. }
  39. bool CanActivateCondition(Hashtable hashtable)
  40. {
  41. if (CardEffectCommons.IsExistOnTrash(card))
  42. {
  43. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  44. {
  45. return true;
  46. }
  47. }
  48. return false;
  49. }
  50. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  51. {
  52. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  53. {
  54. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  55. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  56. selectPermanentEffect.SetUp(
  57. selectPlayer: card.Owner,
  58. canTargetCondition: CanSelectPermanentCondition,
  59. canTargetCondition_ByPreSelecetedList: null,
  60. canEndSelectCondition: null,
  61. maxCount: maxCount,
  62. canNoSelect: false,
  63. canEndNotMax: false,
  64. selectPermanentCoroutine: SelectPermanentCoroutine,
  65. afterSelectPermanentCoroutine: null,
  66. mode: SelectPermanentEffect.Mode.Custom,
  67. cardEffect: activateClass);
  68. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will gain Jamming.", "The opponent is selecting 1 Digimon that will gain Jamming.");
  69. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  70. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  71. {
  72. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainJamming(targetPermanent: permanent, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  73. }
  74. }
  75. }
  76. }
  77. return cardEffects;
  78. }
  79. }