BT6_103.cs 4.1 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 BT6_103 : 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] Suspend all of your opponent's Digimon. Then, gain 1 memory for each of your opponent's suspended Digimon.";
  22. }
  23. bool CanUseCondition(Hashtable hashtable)
  24. {
  25. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  26. }
  27. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  28. {
  29. List<Permanent> tappedPermanents = new List<Permanent>();
  30. foreach (Permanent permanent in card.Owner.Enemy.GetBattleAreaDigimons())
  31. {
  32. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  33. {
  34. tappedPermanents.Add(permanent);
  35. }
  36. }
  37. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(tappedPermanents, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  38. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(card.Owner.Enemy.GetBattleAreaDigimons().Count((permanent) => permanent.IsSuspended), activateClass));
  39. }
  40. }
  41. if (timing == EffectTiming.SecuritySkill)
  42. {
  43. ActivateClass activateClass = new ActivateClass();
  44. activateClass.SetUpICardEffect($"Suspend 1 Digimon", CanUseCondition, card);
  45. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  46. activateClass.SetIsSecurityEffect(true);
  47. cardEffects.Add(activateClass);
  48. string EffectDiscription()
  49. {
  50. return "[Security] Suspend 1 of your opponent's Digimon.";
  51. }
  52. bool CanSelectPermanentCondition(Permanent permanent)
  53. {
  54. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  55. }
  56. bool CanUseCondition(Hashtable hashtable)
  57. {
  58. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  59. }
  60. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  61. {
  62. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  63. {
  64. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  65. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  66. selectPermanentEffect.SetUp(
  67. selectPlayer: card.Owner,
  68. canTargetCondition: CanSelectPermanentCondition,
  69. canTargetCondition_ByPreSelecetedList: null,
  70. canEndSelectCondition: null,
  71. maxCount: maxCount,
  72. canNoSelect: false,
  73. canEndNotMax: false,
  74. selectPermanentCoroutine: null,
  75. afterSelectPermanentCoroutine: null,
  76. mode: SelectPermanentEffect.Mode.Tap,
  77. cardEffect: activateClass);
  78. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  79. }
  80. }
  81. }
  82. return cardEffects;
  83. }
  84. }