BT23_052.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System;
  4. //Consulmon
  5. namespace DCGO.CardEffects.BT23
  6. {
  7. public class BT23_052 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Link Condition
  13. if (timing == EffectTiming.None)
  14. {
  15. static bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.HasAppmonTraits;
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfLinkConditionStaticEffect(permanentCondition: PermanentCondition, linkCost: 2, card: card));
  20. }
  21. #endregion
  22. #region Alternative Digivolution Condition
  23. if (timing == EffectTiming.None)
  24. {
  25. bool PermanentCondition(Permanent targetPermanent)
  26. {
  27. return targetPermanent.TopCard.EqualsTraits("Stnd.");
  28. }
  29. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  30. permanentCondition: PermanentCondition,
  31. digivolutionCost: 2,
  32. ignoreDigivolutionRequirement: false,
  33. card: card,
  34. condition: null)
  35. );
  36. }
  37. #endregion
  38. #region Link
  39. if (timing == EffectTiming.OnDeclaration)
  40. {
  41. cardEffects.Add(CardEffectFactory.LinkEffect(card));
  42. }
  43. #endregion
  44. #region On Play
  45. if (timing == EffectTiming.OnEnterFieldAnyone)
  46. {
  47. ActivateClass activateClass = new ActivateClass();
  48. activateClass.SetUpICardEffect("1 of your opponent's Digimon can't attack players", CanUseCondition, card);
  49. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  50. cardEffects.Add(activateClass);
  51. string EffectDiscription()
  52. {
  53. return "[On Play] 1 of your opponent's Digimon can't attack players until their turn ends.";
  54. }
  55. bool CanSelectPermanentCondition(Permanent permanent)
  56. {
  57. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  58. }
  59. bool CanUseCondition(Hashtable hashtable)
  60. {
  61. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  62. }
  63. bool CanActivateCondition(Hashtable hashtable)
  64. {
  65. if (CardEffectCommons.IsExistOnBattleArea(card))
  66. {
  67. if (card.Owner.Enemy.GetBattleAreaDigimons().Count >= 1)
  68. return true;
  69. }
  70. return false;
  71. }
  72. IEnumerator ActivateCoroutine(Hashtable hashtable)
  73. {
  74. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  75. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  76. selectPermanentEffect.SetUp(
  77. selectPlayer: card.Owner,
  78. canTargetCondition: CanSelectPermanentCondition,
  79. canTargetCondition_ByPreSelecetedList: null,
  80. canEndSelectCondition: null,
  81. maxCount: maxCount,
  82. canNoSelect: false,
  83. canEndNotMax: false,
  84. selectPermanentCoroutine: SelectPermanentCoroutine,
  85. afterSelectPermanentCoroutine: null,
  86. mode: SelectPermanentEffect.Mode.Custom,
  87. cardEffect: activateClass);
  88. selectPermanentEffect.SetUpCustomMessage(
  89. "Select Digimon that will get effects.",
  90. "The opponent is selecting Digimon that will get effects.");
  91. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  92. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  93. {
  94. bool DefenderCondition(Permanent defender)
  95. {
  96. return defender == null;
  97. }
  98. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotAttack(
  99. targetPermanent: permanent,
  100. defenderCondition: DefenderCondition,
  101. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  102. activateClass: activateClass,
  103. effectName: "Can't Attack to player"));
  104. }
  105. }
  106. }
  107. #endregion
  108. #region When Digivolving
  109. if (timing == EffectTiming.OnEnterFieldAnyone)
  110. {
  111. ActivateClass activateClass = new ActivateClass();
  112. activateClass.SetUpICardEffect("1 of your opponent's Digimon can't attack players", CanUseCondition, card);
  113. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  114. cardEffects.Add(activateClass);
  115. string EffectDiscription()
  116. {
  117. return "[When Digivolving] 1 of your opponent's Digimon can't attack players until their turn ends.";
  118. }
  119. bool CanSelectPermanentCondition(Permanent permanent)
  120. {
  121. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  122. }
  123. bool CanUseCondition(Hashtable hashtable)
  124. {
  125. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  126. CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  127. }
  128. bool CanActivateCondition(Hashtable hashtable)
  129. {
  130. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  131. {
  132. if (card.Owner.Enemy.GetBattleAreaDigimons().Count >= 1)
  133. return true;
  134. }
  135. return false;
  136. }
  137. IEnumerator ActivateCoroutine(Hashtable hashtable)
  138. {
  139. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  140. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  141. selectPermanentEffect.SetUp(
  142. selectPlayer: card.Owner,
  143. canTargetCondition: CanSelectPermanentCondition,
  144. canTargetCondition_ByPreSelecetedList: null,
  145. canEndSelectCondition: null,
  146. maxCount: maxCount,
  147. canNoSelect: false,
  148. canEndNotMax: false,
  149. selectPermanentCoroutine: SelectPermanentCoroutine,
  150. afterSelectPermanentCoroutine: null,
  151. mode: SelectPermanentEffect.Mode.Custom,
  152. cardEffect: activateClass);
  153. selectPermanentEffect.SetUpCustomMessage(
  154. "Select Digimon that will get effects.",
  155. "The opponent is selecting Digimon that will get effects.");
  156. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  157. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  158. {
  159. bool DefenderCondition(Permanent defender)
  160. {
  161. return defender == null;
  162. }
  163. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotAttack(
  164. targetPermanent: permanent,
  165. defenderCondition: DefenderCondition,
  166. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  167. activateClass: activateClass,
  168. effectName: "Can't Attack to player"));
  169. }
  170. }
  171. }
  172. #endregion
  173. #region When Linking
  174. if (timing == EffectTiming.WhenLinked)
  175. {
  176. ActivateClass activateClass = new ActivateClass();
  177. activateClass.SetUpICardEffect("Gain Reboot and Blocker", CanUseCondition, card);
  178. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  179. activateClass.SetIsLinkedEffect(true);
  180. cardEffects.Add(activateClass);
  181. string EffectDiscription()
  182. {
  183. return " [When Linking] This Digimon gains <Reboot> and <Blocker> until your opponent's turn ends.";
  184. }
  185. bool CanUseCondition(Hashtable hashtable)
  186. {
  187. return CardEffectCommons.CanTriggerWhenLinking(hashtable, null, card);
  188. }
  189. bool CanActivateCondition(Hashtable hashtable)
  190. {
  191. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  192. }
  193. IEnumerator ActivateCoroutine(Hashtable hashtable)
  194. {
  195. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainBlocker(
  196. targetPermanent: card.PermanentOfThisCard(),
  197. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  198. activateClass: activateClass));
  199. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainReboot(
  200. targetPermanent: card.PermanentOfThisCard(),
  201. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  202. activateClass: activateClass));
  203. }
  204. }
  205. #endregion
  206. #region Security
  207. if (timing == EffectTiming.SecuritySkill)
  208. {
  209. cardEffects.Add(CardEffectFactory.PlaySelfDigimonAfterBattleSecurityEffect(card: card));
  210. }
  211. #endregion
  212. return cardEffects;
  213. }
  214. }
  215. }