BT24_056.cs 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Dezipmon
  5. namespace DCGO.CardEffects.BT24
  6. {
  7. public class BT24_056 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternative Digivolution Condition
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.HasStandardAppTraits;
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null));
  20. }
  21. #endregion
  22. #region Link Condition
  23. if (timing == EffectTiming.None)
  24. {
  25. static bool PermanentCondition(Permanent targetPermanent)
  26. {
  27. return targetPermanent.TopCard.HasAppmonTraits;
  28. }
  29. cardEffects.Add(CardEffectFactory.AddSelfLinkConditionStaticEffect(permanentCondition: PermanentCondition, linkCost: 2, card: card));
  30. }
  31. #endregion
  32. #region Blocker
  33. if (timing == EffectTiming.None)
  34. {
  35. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(
  36. isInheritedEffect: false,
  37. card: card,
  38. condition: null));
  39. }
  40. #endregion
  41. #region Shared OP/WD
  42. string SharedEffectName() => "1 Digimon can't be returned to hand or deck.";
  43. string SharedEffectDescription(string tag) => $"[{tag}] Until your opponent's turn ends, their effects can't return 1 of your Digimon with the [System], [Life] or [Transmutation] trait to hands or decks.";
  44. bool SharedCanActivateCondition(Hashtable hashtable)
  45. {
  46. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  47. }
  48. bool CanSelectPermanentConditionShared(Permanent permanent)
  49. {
  50. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  51. && (permanent.TopCard.EqualsTraits("System")
  52. || permanent.TopCard.EqualsTraits("Life")
  53. || permanent.TopCard.EqualsTraits("Transmutation"));
  54. }
  55. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  56. {
  57. Permanent selectedPermanent = null;
  58. #region Select Permanent
  59. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersPermanentCount(card, CanSelectPermanentConditionShared));
  60. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  61. selectPermanentEffect.SetUp(
  62. selectPlayer: card.Owner,
  63. canTargetCondition: CanSelectPermanentConditionShared,
  64. canTargetCondition_ByPreSelecetedList: null,
  65. canEndSelectCondition: null,
  66. maxCount: maxCount,
  67. canNoSelect: false,
  68. canEndNotMax: false,
  69. selectPermanentCoroutine: SelectPermanentCoroutine,
  70. afterSelectPermanentCoroutine: null,
  71. mode: SelectPermanentEffect.Mode.Custom,
  72. cardEffect: activateClass);
  73. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  74. {
  75. selectedPermanent = permanent;
  76. yield return null;
  77. }
  78. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to gain bounce immunity", "The opponent is selecting 1 Digimon gain bounce immunity.");
  79. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  80. #endregion
  81. if (selectedPermanent != null)
  82. {
  83. yield return ContinuousController.instance.StartCoroutine(
  84. CardEffectCommons.GainCanNotReturnToDeck(selectedPermanent, null, EffectDuration.UntilOpponentTurnEnd, activateClass, "Can not be bounced to deck"));
  85. yield return ContinuousController.instance.StartCoroutine(
  86. CardEffectCommons.GainCanNotReturnToHand(selectedPermanent, null, EffectDuration.UntilOpponentTurnEnd, activateClass, "Can not be bounced to hand"));
  87. }
  88. }
  89. #endregion
  90. #region On Play
  91. if (timing == EffectTiming.OnEnterFieldAnyone)
  92. {
  93. ActivateClass activateClass = new ActivateClass();
  94. activateClass.SetUpICardEffect(SharedEffectName(), CanUseCondition, card);
  95. activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), -1, false, SharedEffectDescription("On Play"));
  96. cardEffects.Add(activateClass);
  97. bool CanUseCondition(Hashtable hashtable)
  98. {
  99. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  100. && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  101. }
  102. }
  103. #endregion
  104. #region When Digivolving
  105. if (timing == EffectTiming.OnEnterFieldAnyone)
  106. {
  107. ActivateClass activateClass = new ActivateClass();
  108. activateClass.SetUpICardEffect(SharedEffectName(), CanUseCondition, card);
  109. activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), -1, false, SharedEffectDescription("When Digivolving"));
  110. cardEffects.Add(activateClass);
  111. bool CanUseCondition(Hashtable hashtable)
  112. {
  113. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  114. && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  115. }
  116. }
  117. #endregion
  118. #region Link
  119. if (timing == EffectTiming.OnDeclaration)
  120. {
  121. cardEffects.Add(CardEffectFactory.LinkEffect(card));
  122. }
  123. #endregion
  124. #region When Linking
  125. if (timing == EffectTiming.WhenLinked)
  126. {
  127. ActivateClass activateClass = new ActivateClass();
  128. activateClass.SetUpICardEffect("Delete 1 Digimon with 5 or less Cost", CanUseCondition, card);
  129. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  130. activateClass.SetIsLinkedEffect(true);
  131. cardEffects.Add(activateClass);
  132. string EffectDescription()
  133. {
  134. return "[When Linking] Delete 1 of your opponent's play cost 5 or lower Digimon.";
  135. }
  136. bool CanSelectPermanentCondition(Permanent permanent)
  137. {
  138. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
  139. && permanent.TopCard.HasPlayCost
  140. && permanent.TopCard.GetCostItself <= 5;
  141. }
  142. bool CanUseCondition(Hashtable hashtable)
  143. {
  144. return CardEffectCommons.CanTriggerWhenLinking(hashtable, null, card)
  145. && CardEffectCommons.IsExistOnBattleArea(card);
  146. }
  147. bool CanActivateCondition(Hashtable hashtable)
  148. {
  149. return CardEffectCommons.IsExistOnBattleArea(card);
  150. }
  151. IEnumerator ActivateCoroutine(Hashtable hashtable)
  152. {
  153. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  154. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  155. selectPermanentEffect.SetUp(
  156. selectPlayer: card.Owner,
  157. canTargetCondition: CanSelectPermanentCondition,
  158. canTargetCondition_ByPreSelecetedList: null,
  159. canEndSelectCondition: null,
  160. maxCount: maxCount,
  161. canNoSelect: false,
  162. canEndNotMax: false,
  163. selectPermanentCoroutine: null,
  164. afterSelectPermanentCoroutine: null,
  165. mode: SelectPermanentEffect.Mode.Destroy,
  166. cardEffect: activateClass);
  167. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  168. }
  169. }
  170. #endregion
  171. return cardEffects;
  172. }
  173. }
  174. }