BT5_102.cs 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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 BT5_102 : 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] Up to 2 of your opponent's Digimon can't attack or block until the end of your opponent's next turn. Then, if you have a Digimon with <Digi-Burst> in play, gain 2 memory.";
  22. }
  23. bool CanSelectPermanentCondition(Permanent permanent)
  24. {
  25. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  26. }
  27. bool CanUseCondition(Hashtable hashtable)
  28. {
  29. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  30. }
  31. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  32. {
  33. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  34. {
  35. int maxCount = Math.Min(2, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  36. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  37. selectPermanentEffect.SetUp(
  38. selectPlayer: card.Owner,
  39. canTargetCondition: CanSelectPermanentCondition,
  40. canTargetCondition_ByPreSelecetedList: null,
  41. canEndSelectCondition: CanEndSelectCondition,
  42. maxCount: maxCount,
  43. canNoSelect: false,
  44. canEndNotMax: true,
  45. selectPermanentCoroutine: SelectPermanentCoroutine,
  46. afterSelectPermanentCoroutine: null,
  47. mode: SelectPermanentEffect.Mode.Custom,
  48. cardEffect: activateClass);
  49. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get effects.", "The opponent is selecting 1 Digimon that will get effects.");
  50. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  51. bool CanEndSelectCondition(List<Permanent> permanents)
  52. {
  53. if (CardEffectCommons.HasNoElement(permanents))
  54. {
  55. return false;
  56. }
  57. return true;
  58. }
  59. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  60. {
  61. Permanent selectedPermanent = permanent;
  62. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotAttack(targetPermanent: selectedPermanent, defenderCondition: null, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass, effectName: "Can't Attack"));
  63. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotBlock(targetPermanent: selectedPermanent, attackerCondition: null, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass, effectName: "Can't Block"));
  64. }
  65. }
  66. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsDigimon && permanent.TopCard.HasDigiBurst))
  67. {
  68. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(2, activateClass));
  69. }
  70. }
  71. }
  72. if (timing == EffectTiming.SecuritySkill)
  73. {
  74. ActivateClass activateClass = new ActivateClass();
  75. activateClass.SetUpICardEffect($"Opponent's 1 Digimon can't Attack and Memory +2", CanUseCondition, card);
  76. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  77. activateClass.SetIsSecurityEffect(true);
  78. cardEffects.Add(activateClass);
  79. string EffectDiscription()
  80. {
  81. return "[Security] Up to 2 of your opponent's Digimon can't attack until the end of the turn. Then, if you have a Digimon with <Digi-Burst> in play, gain 2 memory.";
  82. }
  83. bool CanSelectPermanentCondition(Permanent permanent)
  84. {
  85. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  86. }
  87. bool CanUseCondition(Hashtable hashtable)
  88. {
  89. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  90. }
  91. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  92. {
  93. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  94. {
  95. int maxCount = Math.Min(2, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  96. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  97. selectPermanentEffect.SetUp(
  98. selectPlayer: card.Owner,
  99. canTargetCondition: CanSelectPermanentCondition,
  100. canTargetCondition_ByPreSelecetedList: null,
  101. canEndSelectCondition: CanEndSelectCondition,
  102. maxCount: maxCount,
  103. canNoSelect: false,
  104. canEndNotMax: true,
  105. selectPermanentCoroutine: SelectPermanentCoroutine,
  106. afterSelectPermanentCoroutine: null,
  107. mode: SelectPermanentEffect.Mode.Custom,
  108. cardEffect: activateClass);
  109. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get effects.", "The opponent is selecting 1 Digimon that will get effects.");
  110. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  111. bool CanEndSelectCondition(List<Permanent> permanents)
  112. {
  113. if (CardEffectCommons.HasNoElement(permanents))
  114. {
  115. return false;
  116. }
  117. return true;
  118. }
  119. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  120. {
  121. Permanent selectedPermanent = permanent;
  122. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotAttack(targetPermanent: selectedPermanent, defenderCondition: null, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass, effectName: "Can't Attack"));
  123. }
  124. }
  125. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsDigimon && permanent.TopCard.HasDigiBurst))
  126. {
  127. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(2, activateClass));
  128. }
  129. }
  130. }
  131. return cardEffects;
  132. }
  133. }