BT25_058.cs 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System;
  5. // Callismon
  6. namespace DCGO.CardEffects.BT25
  7. {
  8. public class BT25_058 : 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
  14. if (timing == EffectTiming.None)
  15. {
  16. bool PermanentCondition(Permanent permanent)
  17. {
  18. return permanent.TopCard.HasTSTraits;
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(PermanentCondition, 4, true, card, null, level: 5));
  21. }
  22. #endregion
  23. #region Reboot
  24. if (timing == EffectTiming.None)
  25. {
  26. cardEffects.Add(CardEffectFactory.RebootSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  27. }
  28. #endregion
  29. #region Blocker
  30. if (timing == EffectTiming.None)
  31. {
  32. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  33. }
  34. #endregion
  35. #region Fortitude
  36. if (timing == EffectTiming.OnDestroyedAnyone)
  37. {
  38. cardEffects.Add(CardEffectFactory.FortitudeSelfEffect(isInheritedEffect: false, card: card, condition: null));
  39. }
  40. #endregion
  41. #region Shared OP / WD / WA
  42. string SharedHashString = "BT25_058_OP_WD_WA";
  43. string SharedEffectName = "May suspend 1 enemy digimon or Tamers. 1 enemy digimon or Tamer can't unsuspend until end of their turn.";
  44. string SharedEffectDescription(string tag)
  45. => $"[{tag}] [Once Per Turn] You may suspend 1 of your opponent's Digimon or Tamers. Then, 1 of their Digimon or Tamers can't unsuspend until their turn ends.";
  46. bool CanSelectPermanentConditionShared(Permanent permanent)
  47. {
  48. return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card)
  49. && (permanent.IsDigimon || permanent.IsTamer);
  50. }
  51. CardEffectFactory.ActivateClassesForSharedEffects
  52. (ref cardEffects, timing, card,
  53. SharedEffectName,
  54. SharedActivateCoroutine,
  55. SharedEffectDescription,
  56. maxCountPerTurn: 1,
  57. hashValue: SharedHashString,
  58. optional: false,
  59. onPlay: true,
  60. whenDigivolving: true,
  61. whenAttacking: true);
  62. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  63. {
  64. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentConditionShared))
  65. {
  66. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  67. selectPermanentEffect.SetUp(
  68. selectPlayer: card.Owner,
  69. canTargetCondition: CanSelectPermanentConditionShared,
  70. canTargetCondition_ByPreSelecetedList: null,
  71. canEndSelectCondition: null,
  72. maxCount: 1,
  73. canNoSelect: true,
  74. canEndNotMax: false,
  75. selectPermanentCoroutine: null,
  76. afterSelectPermanentCoroutine: null,
  77. mode: SelectPermanentEffect.Mode.Tap,
  78. cardEffect: activateClass);
  79. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  80. selectPermanentEffect.SetUp(
  81. selectPlayer: card.Owner,
  82. canTargetCondition: CanSelectPermanentConditionShared,
  83. canTargetCondition_ByPreSelecetedList: null,
  84. canEndSelectCondition: null,
  85. maxCount: 1,
  86. canNoSelect: false,
  87. canEndNotMax: false,
  88. selectPermanentCoroutine: SelectPermanentCoroutine,
  89. afterSelectPermanentCoroutine: null,
  90. mode: SelectPermanentEffect.Mode.Custom,
  91. cardEffect: activateClass);
  92. selectPermanentEffect.SetUpCustomMessage(
  93. "Select a Digimon or Tamers that will be unable to unsuspend.",
  94. "The opponent is selecting a Digimon or Tamers that will be unable to unsuspend.");
  95. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  96. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  97. {
  98. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCantUnsuspendUntilOpponentTurnEnd(
  99. targetPermanent: permanent,
  100. activateClass: activateClass
  101. ));
  102. }
  103. }
  104. }
  105. #endregion
  106. #region All Turns
  107. if (timing == EffectTiming.OnEnterFieldAnyone)
  108. {
  109. ActivateClass activateClass = new ActivateClass();
  110. activateClass.SetUpICardEffect("<De-Digivolve 1> 1 enemy Digimon. Then, may battle 1 Digimon", CanUseCondition, card);
  111. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  112. activateClass.SetHashString("BT25_058_AT");
  113. cardEffects.Add(activateClass);
  114. string EffectDescription()
  115. => "[All Turns] [Once Per Turn] When effects play or digivolve any Digimon, <De-Digivolve 1> 1 of your opponent's Digimon. Then, this Digimon may battle 1 of your opponent's Digimon.";
  116. bool CanUseCondition(Hashtable hashtable)
  117. {
  118. return CardEffectCommons.IsExistOnBattleAreaTrigger(card, activateClass)
  119. && (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, IsDigimonCondition)
  120. || CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, IsDigimonCondition))
  121. && CardEffectCommons.IsByEffect(hashtable, null);
  122. }
  123. bool IsDigimonCondition(Permanent permanent) => CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(permanent);
  124. bool IsOpponentsDigimon(Permanent permanent) => CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  125. bool IsBattleTarget(Permanent permanent) => IsOpponentsDigimon(permanent) && permanent.HasDP;
  126. bool CanActivateCondition(Hashtable hashtable) => CardEffectCommons.IsExistOnBattleAreaActivate(card, activateClass);
  127. IEnumerator ActivateCoroutine(Hashtable hashtable)
  128. {
  129. #region De-Digivolve 1
  130. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, IsOpponentsDigimon))
  131. {
  132. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  133. selectPermanentEffect.SetUp(
  134. selectPlayer: card.Owner,
  135. canTargetCondition: IsOpponentsDigimon,
  136. canTargetCondition_ByPreSelecetedList: null,
  137. canEndSelectCondition: null,
  138. maxCount: 1,
  139. canNoSelect: false,
  140. canEndNotMax: false,
  141. selectPermanentCoroutine: null,
  142. afterSelectPermanentCoroutine: null,
  143. mode: SelectPermanentEffect.Mode.Degenerate,
  144. cardEffect: activateClass);
  145. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  146. }
  147. #endregion
  148. #region May Battle
  149. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, IsBattleTarget))
  150. {
  151. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  152. selectPermanentEffect.SetUp(
  153. selectPlayer: card.Owner,
  154. canTargetCondition: IsBattleTarget,
  155. canTargetCondition_ByPreSelecetedList: null,
  156. canEndSelectCondition: null,
  157. maxCount: 1,
  158. canNoSelect: true,
  159. canEndNotMax: false,
  160. selectPermanentCoroutine: SelectPermanentCoroutine,
  161. afterSelectPermanentCoroutine: null,
  162. mode: SelectPermanentEffect.Mode.Custom,
  163. cardEffect: activateClass);
  164. selectPermanentEffect.SetUpCustomMessage("Select a Digimon to battle.", "Opponent is selecting a Digimon to Battle.");
  165. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  166. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  167. {
  168. yield return ContinuousController.instance.StartCoroutine(new IBattle(card.PermanentOfThisCard(), permanent, null, true).Battle());
  169. }
  170. }
  171. #endregion
  172. }
  173. }
  174. #endregion
  175. return cardEffects;
  176. }
  177. }
  178. }