BT25_025.cs 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. // Aegiochusmon: Blue
  6. namespace DCGO.CardEffects.BT25
  7. {
  8. public class BT25_025 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Alt Digivolution Condition
  14. if (timing == EffectTiming.None)
  15. {
  16. static bool PermanentCondition(Permanent targetPermanent)
  17. {
  18. return targetPermanent.TopCard.EqualsCardName("Aegiomon");
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(PermanentCondition, 3, false, card, null));
  21. }
  22. #endregion
  23. #region Decode <[Aegiomon]>
  24. if (timing == EffectTiming.WhenRemoveField)
  25. {
  26. bool SourceCondition(CardSource source)
  27. {
  28. return source.EqualsCardName("Aegiomon");
  29. }
  30. string[] decodeStrings = { "(Aegiomon)", "Aegiomon" };
  31. cardEffects.Add(CardEffectFactory.DecodeSelfEffect(card: card, isInheritedEffect: false, decodeStrings: decodeStrings, sourceCondition: SourceCondition, condition: null));
  32. }
  33. #endregion
  34. #region Blocker
  35. if (timing == EffectTiming.None)
  36. {
  37. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  38. }
  39. #endregion
  40. #region Shared OP / WD
  41. string SharedEffectName = "<De-Digivolve 1> 1 opponent digimon, then if 3 or less security, 1 of your digimon unsuspends";
  42. string SharedEffectDescription(string tag) => $"[{tag}] <De-Digivolve 1> 1 of your opponent's Digimon. Then, if you have 3 or fewer security cards, 1 of your Digimon unsuspends.";
  43. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  44. {
  45. #region Conditions
  46. bool isOpponentDigimon(Permanent permanent) => CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  47. bool isYourDigimon(Permanent permanent) => CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  48. #endregion
  49. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, isOpponentDigimon))
  50. {
  51. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOpponentsPermanentCount(card, isOpponentDigimon));
  52. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  53. selectPermanentEffect.SetUp(
  54. selectPlayer: card.Owner,
  55. canTargetCondition: isOpponentDigimon,
  56. canTargetCondition_ByPreSelecetedList: null,
  57. canEndSelectCondition: null,
  58. maxCount: maxCount,
  59. canNoSelect: false,
  60. canEndNotMax: false,
  61. selectPermanentCoroutine: null,
  62. afterSelectPermanentCoroutine: null,
  63. mode: SelectPermanentEffect.Mode.Degenerate,
  64. cardEffect: activateClass);
  65. selectPermanentEffect.SetUpCustomMessage("Select 1 opponent's Digimon to De-Digivolve", "The opponent is selecting 1 Digimon to De-Digivolve");
  66. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  67. }
  68. if (card.Owner.SecurityCards.Count <= 3 && CardEffectCommons.HasMatchConditionOwnersPermanent(card, isYourDigimon))
  69. {
  70. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersPermanentCount(card, isYourDigimon));
  71. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  72. selectPermanentEffect.SetUp(
  73. selectPlayer: card.Owner,
  74. canTargetCondition: isYourDigimon,
  75. canTargetCondition_ByPreSelecetedList: null,
  76. canEndSelectCondition: null,
  77. maxCount: maxCount,
  78. canNoSelect: false,
  79. canEndNotMax: false,
  80. selectPermanentCoroutine: null,
  81. afterSelectPermanentCoroutine: null,
  82. mode: SelectPermanentEffect.Mode.UnTap,
  83. cardEffect: activateClass);
  84. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to unsuspend", "The opponent is selecting 1 Digimon to unsuspend");
  85. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  86. }
  87. }
  88. CardEffectFactory.ActivateClassesForSharedEffects
  89. (ref cardEffects, timing, card,
  90. SharedEffectName,
  91. SharedActivateCoroutine,
  92. SharedEffectDescription,
  93. optional: false,
  94. maxCountPerTurn: -1,
  95. onPlay: true,
  96. whenDigivolving: true);
  97. #endregion
  98. #region All Turns
  99. if (timing == EffectTiming.OnLoseSecurity)
  100. {
  101. ActivateClass activateClass = new ActivateClass();
  102. activateClass.SetUpICardEffect("Unsuspend 1 [Shaman] trait digimon", CanUseCondition, card);
  103. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  104. activateClass.SetHashString("BT25-025_AT");
  105. activateClass.SetIsInheritedEffect(true);
  106. cardEffects.Add(activateClass);
  107. string EffectDiscription()
  108. {
  109. return "[All Turns][Once Per Turn] When your security stack is removed from, 1 of your [Shaman] trait Digimon may unsuspend.";
  110. }
  111. bool CanUseCondition(Hashtable hashtable)
  112. {
  113. if (CardEffectCommons.IsExistOnBattleArea(card))
  114. {
  115. if (CardEffectCommons.CanTriggerWhenLoseSecurity(hashtable, player => player == card.Owner))
  116. {
  117. return true;
  118. }
  119. }
  120. return false;
  121. }
  122. bool CanActivateCondition(Hashtable hashtable)
  123. {
  124. return CardEffectCommons.IsExistOnBattleArea(card)
  125. && CardEffectCommons.HasMatchConditionOwnersPermanent(card, IsShamanDigimon);
  126. }
  127. bool IsShamanDigimon(Permanent permanent)
  128. {
  129. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  130. && permanent.TopCard.HasShamanTraits;
  131. }
  132. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  133. {
  134. bool isUsed = false;
  135. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, IsShamanDigimon))
  136. {
  137. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersPermanentCount(card, IsShamanDigimon));
  138. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  139. selectPermanentEffect.SetUp(
  140. selectPlayer: card.Owner,
  141. canTargetCondition: IsShamanDigimon,
  142. canTargetCondition_ByPreSelecetedList: null,
  143. canEndSelectCondition: null,
  144. maxCount: maxCount,
  145. canNoSelect: true,
  146. canEndNotMax: false,
  147. selectPermanentCoroutine: null,
  148. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
  149. mode: SelectPermanentEffect.Mode.UnTap,
  150. cardEffect: activateClass);
  151. IEnumerator AfterSelectPermanentCoroutine(List<Permanent> selectedPermanents)
  152. {
  153. if (selectedPermanents.Any()) isUsed = true;
  154. yield return null;
  155. }
  156. selectPermanentEffect.SetUpCustomMessage("Select 1 [Shaman] trait Digimon to unsuspend", "The opponent is selecting 1 [Shaman] trait Digimon to unsuspend");
  157. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  158. }
  159. if (!isUsed) activateClass.RemoveUse();
  160. }
  161. }
  162. #endregion
  163. return cardEffects;
  164. }
  165. }
  166. }