ST22_11.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. //Defense Plug-In F
  5. namespace DCGO.CardEffects.ST22
  6. {
  7. public class ST22_11 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Static Effects
  13. #region Ignore Color Requirement
  14. if (timing == EffectTiming.None)
  15. {
  16. IgnoreColorConditionClass ignoreColorConditionClass = new IgnoreColorConditionClass();
  17. ignoreColorConditionClass.SetUpICardEffect("Ignore color requirements", CanUseCondition, card);
  18. ignoreColorConditionClass.SetUpIgnoreColorConditionClass(cardCondition: CardCondition);
  19. cardEffects.Add(ignoreColorConditionClass);
  20. bool CanUseCondition(Hashtable hashtable)
  21. {
  22. return CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsTamer);
  23. }
  24. bool CardCondition(CardSource cardSource)
  25. {
  26. return cardSource == card;
  27. }
  28. }
  29. #endregion
  30. #region Link Condition
  31. if (timing == EffectTiming.None)
  32. {
  33. static bool PermanentCondition(Permanent targetPermanent)
  34. {
  35. return targetPermanent.TopCard.HasLevel && targetPermanent.Level >= 3;
  36. }
  37. cardEffects.Add(CardEffectFactory.AddSelfLinkConditionStaticEffect(permanentCondition: PermanentCondition, linkCost: 2, card: card));
  38. }
  39. #endregion
  40. #region Link
  41. if (timing == EffectTiming.OnDeclaration)
  42. {
  43. cardEffects.Add(CardEffectFactory.LinkEffect(card));
  44. }
  45. #endregion
  46. #endregion
  47. #region Security
  48. if (timing == EffectTiming.SecuritySkill)
  49. {
  50. ActivateClass activateClass = new ActivateClass();
  51. activateClass.SetUpICardEffect("De-Digivolve(2) 1 opponent digimon. Then, add this card to hand", CanUseCondition, card);
  52. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  53. activateClass.SetIsSecurityEffect(true);
  54. cardEffects.Add(activateClass);
  55. string EffectDiscription()
  56. => "[Security] <De-Digivolve 2> 1 of your opponent's Digimon. Then, add this card to the hand.";
  57. bool CanUseCondition(Hashtable hashtable)
  58. {
  59. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  60. }
  61. bool CanSelectPermanentCondition(Permanent permanent)
  62. {
  63. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  64. }
  65. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  66. {
  67. #region De-Digivolve(2) 1 opponent digimon
  68. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectPermanentCondition))
  69. {
  70. Permanent selectedPermanent = null;
  71. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  72. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  73. selectPermanentEffect.SetUp(
  74. selectPlayer: card.Owner,
  75. canTargetCondition: CanSelectPermanentCondition,
  76. canTargetCondition_ByPreSelecetedList: null,
  77. canEndSelectCondition: null,
  78. maxCount: maxCount,
  79. canNoSelect: false,
  80. canEndNotMax: false,
  81. selectPermanentCoroutine: SelectPermanentCoroutine,
  82. afterSelectPermanentCoroutine: null,
  83. mode: SelectPermanentEffect.Mode.Custom,
  84. cardEffect: activateClass);
  85. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  86. {
  87. selectedPermanent = permanent;
  88. yield return null;
  89. }
  90. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  91. if (selectedPermanent != null) yield return ContinuousController.instance.StartCoroutine(new IDegeneration(
  92. permanent: selectedPermanent,
  93. DegenerationCount: 2,
  94. cardEffect: activateClass).Degeneration());
  95. }
  96. #endregion
  97. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.AddThisCardToHand(card, activateClass));
  98. }
  99. }
  100. #endregion
  101. #region Main
  102. if (timing == EffectTiming.OptionSkill)
  103. {
  104. ActivateClass activateClass = new ActivateClass();
  105. activateClass.SetUpICardEffect("You may link this to 1 digimon. Then, 1 digimon gains <Reboot> and 3K DP until their turn ends", CanUseCondition, card);
  106. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  107. cardEffects.Add(activateClass);
  108. string EffectDiscription()
  109. => "[Main] You may link this card to 1 of your Digimon without paying the cost. Then, until your opponent's turn ends, 1 of your Digimon gains <Reboot> and +3000 DP.";
  110. bool CanUseCondition(Hashtable hashtable)
  111. => CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  112. bool CanSelectPermanentCondition(Permanent permanent)
  113. {
  114. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  115. card.CanLinkToTargetPermanent(permanent, false);
  116. }
  117. bool CanSelectDigimonPermamentCondition(Permanent permanent)
  118. {
  119. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  120. }
  121. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  122. {
  123. #region Select Digimon To Link
  124. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  125. {
  126. Permanent selectedPermanent = null;
  127. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  128. selectPermanentEffect.SetUp(
  129. selectPlayer: card.Owner,
  130. canTargetCondition: CanSelectPermanentCondition,
  131. canTargetCondition_ByPreSelecetedList: null,
  132. canEndSelectCondition: null,
  133. maxCount: 1,
  134. canNoSelect: true,
  135. canEndNotMax: false,
  136. selectPermanentCoroutine: SelectPermanentCoroutine,
  137. afterSelectPermanentCoroutine: null,
  138. mode: SelectPermanentEffect.Mode.Custom,
  139. cardEffect: activateClass);
  140. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to link.", "The opponent is selecting 1 Digimon to link.");
  141. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  142. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  143. {
  144. selectedPermanent = permanent;
  145. yield return null;
  146. }
  147. if (selectedPermanent != null) yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddLinkCard(card, activateClass));
  148. }
  149. #endregion
  150. #region Select Digimon to gain <Reboot> & 3K DP
  151. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectDigimonPermamentCondition, card))
  152. {
  153. Permanent selectedPermanent = null;
  154. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectDigimonPermamentCondition));
  155. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  156. selectPermanentEffect.SetUp(
  157. selectPlayer: card.Owner,
  158. canTargetCondition: CanSelectDigimonPermamentCondition,
  159. canTargetCondition_ByPreSelecetedList: null,
  160. canEndSelectCondition: null,
  161. maxCount: maxCount,
  162. canNoSelect: false,
  163. canEndNotMax: false,
  164. selectPermanentCoroutine: SelectPermanentCoroutine,
  165. afterSelectPermanentCoroutine: null,
  166. mode: SelectPermanentEffect.Mode.Custom,
  167. cardEffect: activateClass);
  168. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  169. {
  170. selectedPermanent = permanent;
  171. yield return null;
  172. }
  173. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  174. if (selectedPermanent != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainReboot(
  175. targetPermanent: selectedPermanent,
  176. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  177. activateClass: activateClass));
  178. if (selectedPermanent != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  179. targetPermanent: selectedPermanent,
  180. changeValue: 3000,
  181. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  182. activateClass: activateClass));
  183. }
  184. #endregion
  185. }
  186. }
  187. #endregion
  188. #region Link ESS
  189. if (timing == EffectTiming.None)
  190. {
  191. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null, isLinkedEffect: true));
  192. }
  193. #endregion
  194. return cardEffects;
  195. }
  196. }
  197. }