BT24_057.cs 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. //Docmon
  5. namespace DCGO.CardEffects.BT24
  6. {
  7. public class BT24_057 : 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.EqualsTraits("Stnd.");
  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 Link
  33. if (timing == EffectTiming.OnDeclaration)
  34. {
  35. cardEffects.Add(CardEffectFactory.LinkEffect(card));
  36. }
  37. #endregion
  38. #region Security
  39. if (timing == EffectTiming.SecuritySkill)
  40. {
  41. cardEffects.Add(CardEffectFactory.PlaySelfDigimonAfterBattleSecurityEffect(card: card));
  42. }
  43. #endregion
  44. #region Shared OP/OD
  45. string SharedEffectName() => "1 opponent digimon can't attack players.";
  46. string SharedEffectDescription(string tag) => $"[{tag}] Until your opponent's turn ends, 1 of their Digimon can't attack players.";
  47. bool CanSelectPermanentConditionShared(Permanent permanent)
  48. {
  49. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  50. }
  51. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  52. {
  53. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentConditionShared))
  54. {
  55. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentConditionShared));
  56. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  57. selectPermanentEffect.SetUp(
  58. selectPlayer: card.Owner,
  59. canTargetCondition: CanSelectPermanentConditionShared,
  60. canTargetCondition_ByPreSelecetedList: null,
  61. canEndSelectCondition: null,
  62. maxCount: maxCount,
  63. canNoSelect: false,
  64. canEndNotMax: false,
  65. selectPermanentCoroutine: SelectPermanentCoroutine,
  66. afterSelectPermanentCoroutine: null,
  67. mode: SelectPermanentEffect.Mode.Custom,
  68. cardEffect: activateClass);
  69. selectPermanentEffect.SetUpCustomMessage(
  70. "Select Digimon that will get effects.",
  71. "The opponent is selecting Digimon that will get effects.");
  72. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  73. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  74. {
  75. bool DefenderCondition(Permanent defender)
  76. {
  77. return defender == null;
  78. }
  79. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotAttack(
  80. targetPermanent: permanent,
  81. defenderCondition: DefenderCondition,
  82. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  83. activateClass: activateClass,
  84. effectName: "Can't Attack to player"));
  85. }
  86. }
  87. }
  88. #endregion
  89. #region On Play
  90. if (timing == EffectTiming.OnEnterFieldAnyone)
  91. {
  92. ActivateClass activateClass = new ActivateClass();
  93. activateClass.SetUpICardEffect(SharedEffectName(), CanUseCondition, card);
  94. activateClass.SetUpActivateClass(CanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), -1, false, SharedEffectDescription("On Play"));
  95. cardEffects.Add(activateClass);
  96. bool CanUseCondition(Hashtable hashtable)
  97. {
  98. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  99. && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  100. }
  101. bool CanActivateCondition(Hashtable hashtable)
  102. {
  103. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  104. }
  105. }
  106. #endregion
  107. #region On Deletion
  108. if (timing == EffectTiming.OnDestroyedAnyone)
  109. {
  110. ActivateClass activateClass = new ActivateClass();
  111. activateClass.SetUpICardEffect(SharedEffectName(), CanUseCondition, card);
  112. activateClass.SetUpActivateClass(CanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), -1, false, SharedEffectDescription("On Deletion"));
  113. cardEffects.Add(activateClass);
  114. bool CanUseCondition(Hashtable hashtable)
  115. {
  116. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  117. }
  118. bool CanActivateCondition(Hashtable hashtable)
  119. {
  120. return CardEffectCommons.IsExistOnTrash(card);
  121. }
  122. }
  123. #endregion
  124. #region Linked On Deletion
  125. if (timing == EffectTiming.OnDestroyedAnyone)
  126. {
  127. ActivateClass activateClass = new ActivateClass();
  128. activateClass.SetUpICardEffect("De-Digivolve 1 on 1 Digimon", CanUseCondition, card);
  129. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  130. activateClass.SetIsLinkedEffect(true);
  131. cardEffects.Add(activateClass);
  132. string EffectDescription()
  133. {
  134. return "[On Deletion] <De-Digivolve 1> 1 of your opponent's Digimon. (Trash 1 card from the top of 1 of your opponent's Digimon. Stop trashing when you would trash a level 3 card or the Digimon's last card.)";
  135. }
  136. bool CanSelectPermanentCondition(Permanent permanent)
  137. {
  138. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  139. }
  140. bool CanUseCondition(Hashtable hashtable)
  141. {
  142. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  143. }
  144. bool CanActivateCondition(Hashtable hashtable)
  145. {
  146. return CardEffectCommons.CanActivateOnDeletion(card, activateClass);
  147. }
  148. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  149. {
  150. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  151. {
  152. int maxCount1 = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  153. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  154. selectPermanentEffect.SetUp(
  155. selectPlayer: card.Owner,
  156. canTargetCondition: CanSelectPermanentCondition,
  157. canTargetCondition_ByPreSelecetedList: null,
  158. canEndSelectCondition: null,
  159. maxCount: maxCount1,
  160. canNoSelect: false,
  161. canEndNotMax: false,
  162. selectPermanentCoroutine: SelectPermanentCoroutine,
  163. afterSelectPermanentCoroutine: null,
  164. mode: SelectPermanentEffect.Mode.Custom,
  165. cardEffect: activateClass);
  166. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to De-Digivolve.", "The opponent is selecting 1 Digimon to De-Digivolve.");
  167. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  168. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  169. {
  170. Permanent selectedPermanent = permanent;
  171. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(selectedPermanent, 1, activateClass).Degeneration());
  172. }
  173. }
  174. }
  175. }
  176. #endregion
  177. return cardEffects;
  178. }
  179. }
  180. }