BT24_023.cs 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. // Calmaramon
  6. namespace DCGO.CardEffects.BT24
  7. {
  8. public class BT24_023 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Digivolution Condition
  14. if (timing == EffectTiming.None)
  15. {
  16. bool PermanentCondition(Permanent targetPermanent)
  17. {
  18. return targetPermanent.TopCard.EqualsCardName("Lanamon");
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 1, ignoreDigivolutionRequirement: false, card: card, condition: null));
  21. }
  22. if (timing == EffectTiming.None)
  23. {
  24. bool PermanentCondition(Permanent targetPermanent)
  25. {
  26. return (targetPermanent.TopCard.IsLevel3 && targetPermanent.TopCard.HasTSTraits);
  27. }
  28. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  29. }
  30. #endregion
  31. #region Blocker
  32. if (timing == EffectTiming.None)
  33. {
  34. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  35. }
  36. #endregion
  37. #region Decode <[Lanamon]>
  38. if (timing == EffectTiming.WhenRemoveField)
  39. {
  40. bool SourceCondition(CardSource source)
  41. {
  42. return source.EqualsCardName("Lanamon");
  43. }
  44. string[] decodeStrings = { "(Lanamon)", "Lanamon" };
  45. cardEffects.Add(CardEffectFactory.DecodeSelfEffect(card: card, isInheritedEffect: false, decodeStrings: decodeStrings, sourceCondition: SourceCondition, condition: null));
  46. }
  47. #endregion
  48. #region Shared OP/WD
  49. string SharedEffectName() => "Bot deck 1 lvl 4 or lower, possibly prevent suspension";
  50. string EffectDescriptionShared(string tag) => $"[{tag}] Return 1 of your opponent's level 4 or lower Digimon to the bottom of the deck. Then, if played by effects, 1 of their Digimon or Tamers can't suspend until their turn ends.";
  51. bool CanSelectPermanentCondition(Permanent permanent)
  52. {
  53. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
  54. && permanent.TopCard.HasLevel && permanent.TopCard.Level <= 4;
  55. }
  56. bool CanSelectPermanentCondition1(Permanent permanent)
  57. {
  58. return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card)
  59. && (permanent.IsDigimon
  60. || permanent.IsTamer);
  61. }
  62. bool CanActivateConditionShared(Hashtable hashtable)
  63. {
  64. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  65. }
  66. IEnumerator ActivateCoroutineShared(Hashtable hashtable, ActivateClass activateClass)
  67. {
  68. int maxCount1 = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  69. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  70. selectPermanentEffect.SetUp(
  71. selectPlayer: card.Owner,
  72. canTargetCondition: CanSelectPermanentCondition,
  73. canTargetCondition_ByPreSelecetedList: null,
  74. canEndSelectCondition: null,
  75. maxCount: maxCount1,
  76. canNoSelect: false,
  77. canEndNotMax: false,
  78. selectPermanentCoroutine: null,
  79. afterSelectPermanentCoroutine: null,
  80. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  81. cardEffect: activateClass);
  82. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to bottom deck.", "The opponent is selecting 1 Digimon to bottom deck.");
  83. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  84. if (CardEffectCommons.IsByEffect(hashtable, null) && CardEffectCommons.CanTriggerOnPlay(hashtable, card))
  85. {
  86. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  87. {
  88. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  89. Permanent selectedPermanent = null;
  90. selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  91. selectPermanentEffect.SetUp(
  92. selectPlayer: card.Owner,
  93. canTargetCondition: CanSelectPermanentCondition1,
  94. canTargetCondition_ByPreSelecetedList: null,
  95. canEndSelectCondition: null,
  96. maxCount: maxCount,
  97. canNoSelect: false,
  98. canEndNotMax: false,
  99. selectPermanentCoroutine: SelectPermanentCoroutine,
  100. afterSelectPermanentCoroutine: null,
  101. mode: SelectPermanentEffect.Mode.Custom,
  102. cardEffect: activateClass);
  103. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon or Tamer to stun", "The opponent is selecting 1 Digimon or tamer to stun");
  104. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  105. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  106. {
  107. selectedPermanent = permanent;
  108. yield return null;
  109. }
  110. if (selectedPermanent != null)
  111. {
  112. CanNotSuspendClass canNotSuspendClass = new CanNotSuspendClass();
  113. canNotSuspendClass.SetUpICardEffect("Can't Suspend", CanUseCondition1, card);
  114. canNotSuspendClass.SetUpCanNotSuspendClass(PermanentCondition: PermanentCondition);
  115. selectedPermanent.UntilOwnerTurnEndEffects.Add((_timing) => canNotSuspendClass);
  116. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
  117. bool CanUseCondition1(Hashtable hashtable)
  118. {
  119. return selectedPermanent.TopCard != null
  120. && !selectedPermanent.TopCard.CanNotBeAffected(activateClass);
  121. }
  122. bool PermanentCondition(Permanent permanent) => permanent == selectedPermanent;
  123. }
  124. }
  125. }
  126. }
  127. #endregion
  128. #region On Play
  129. if (timing == EffectTiming.OnEnterFieldAnyone)
  130. {
  131. ActivateClass activateClass = new ActivateClass();
  132. activateClass.SetUpICardEffect(SharedEffectName(), CanUseCondition, card);
  133. activateClass.SetUpActivateClass(CanActivateConditionShared, hash => ActivateCoroutineShared(hash, activateClass), -1, true, EffectDescriptionShared("On Play"));
  134. cardEffects.Add(activateClass);
  135. bool CanUseCondition(Hashtable hashtable)
  136. {
  137. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  138. && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  139. }
  140. }
  141. #endregion
  142. #region When Digivolving
  143. if (timing == EffectTiming.OnEnterFieldAnyone)
  144. {
  145. ActivateClass activateClass = new ActivateClass();
  146. activateClass.SetUpICardEffect(SharedEffectName(), CanUseCondition, card);
  147. activateClass.SetUpActivateClass(CanActivateConditionShared, hash => ActivateCoroutineShared(hash, activateClass), -1, true, EffectDescriptionShared("When Digivolving"));
  148. cardEffects.Add(activateClass);
  149. bool CanUseCondition(Hashtable hashtable)
  150. {
  151. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  152. && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  153. }
  154. }
  155. #endregion
  156. #region ESS Jamming
  157. if (timing == EffectTiming.None)
  158. {
  159. cardEffects.Add(CardEffectFactory.JammingSelfStaticEffect(
  160. isInheritedEffect: true,
  161. card: card,
  162. condition: null));
  163. }
  164. #endregion
  165. return cardEffects;
  166. }
  167. }
  168. }