BT2_104.cs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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 BT2_104 : 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.OptionSkill)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  17. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[Main] Unsuspend 1 of your Digimon with <Blocker>.";
  22. }
  23. bool CanSelectPermanentCondition(Permanent permanent)
  24. {
  25. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  26. {
  27. if (permanent.HasBlocker)
  28. {
  29. return true;
  30. }
  31. }
  32. return false;
  33. }
  34. bool CanUseCondition(Hashtable hashtable)
  35. {
  36. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  37. }
  38. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  39. {
  40. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  41. {
  42. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  43. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  44. selectPermanentEffect.SetUp(
  45. selectPlayer: card.Owner,
  46. canTargetCondition: CanSelectPermanentCondition,
  47. canTargetCondition_ByPreSelecetedList: null,
  48. canEndSelectCondition: null,
  49. maxCount: maxCount,
  50. canNoSelect: false,
  51. canEndNotMax: false,
  52. selectPermanentCoroutine: null,
  53. afterSelectPermanentCoroutine: null,
  54. mode: SelectPermanentEffect.Mode.UnTap,
  55. cardEffect: activateClass);
  56. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  57. }
  58. }
  59. }
  60. if (timing == EffectTiming.SecuritySkill)
  61. {
  62. ActivateClass activateClass = new ActivateClass();
  63. activateClass.SetUpICardEffect($"Unsuspend your all Digimon with Blocker and DP +5000", CanUseCondition, card);
  64. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  65. activateClass.SetIsSecurityEffect(true);
  66. cardEffects.Add(activateClass);
  67. string EffectDiscription()
  68. {
  69. return "[Security] Unsuspend all of your Digimon with <Blocker> and they get +5000 DP for the turn.";
  70. }
  71. bool PermanentCondition(Permanent permanent)
  72. {
  73. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  74. {
  75. if (permanent.HasBlocker)
  76. {
  77. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  78. {
  79. return true;
  80. }
  81. }
  82. }
  83. return false;
  84. }
  85. bool CanUseCondition(Hashtable hashtable)
  86. {
  87. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  88. }
  89. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  90. {
  91. List<Permanent> unsuspendTargetPermanents = card.Owner.GetBattleAreaDigimons().Filter(PermanentCondition);
  92. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(
  93. unsuspendTargetPermanents,
  94. activateClass).Unsuspend());
  95. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDPPlayerEffect(
  96. permanentCondition: PermanentCondition,
  97. changeValue: 5000,
  98. effectDuration: EffectDuration.UntilEachTurnEnd,
  99. activateClass: activateClass));
  100. }
  101. }
  102. return cardEffects;
  103. }
  104. }