P_159.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System;
  4. namespace DCGO.CardEffects.P
  5. {
  6. public class P_159 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Ignore Color Requirements
  12. if (timing == EffectTiming.None)
  13. {
  14. IgnoreColorConditionClass ignoreColorConditionClass = new IgnoreColorConditionClass();
  15. ignoreColorConditionClass.SetUpICardEffect("Ignore color requirements", CanUseCondition, card);
  16. ignoreColorConditionClass.SetUpIgnoreColorConditionClass(cardCondition: CardCondition);
  17. cardEffects.Add(ignoreColorConditionClass);
  18. bool CanUseCondition(Hashtable hashtable)
  19. {
  20. return !CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.TopCard.EqualsCardName("Rook Device"));
  21. }
  22. bool CardCondition(CardSource cardSource)
  23. {
  24. return (cardSource == card);
  25. }
  26. }
  27. #endregion
  28. #region When Trashed from battle area
  29. if (timing == EffectTiming.OnDestroyedAnyone)
  30. {
  31. ActivateClass activateClass = new ActivateClass();
  32. activateClass.SetUpICardEffect("Gain Reboot, Blocker, +2000 DP", CanUseCondition, card);
  33. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  34. cardEffects.Add(activateClass);
  35. string EffectDiscription()
  36. {
  37. return "1 of your Digimon gains <Reboot>, <Blocker> and gets +2000 DP until the end of your opponent's turn.";
  38. }
  39. bool HasDigimon(Permanent permanent)
  40. {
  41. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  42. }
  43. bool CanUseCondition(Hashtable hashtable)
  44. {
  45. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  46. }
  47. bool CanActivateCondition(Hashtable hashtable)
  48. {
  49. return CardEffectCommons.CanActivateOnDeletion(card, activateClass);
  50. }
  51. IEnumerator ActivateCoroutine(Hashtable hashtable)
  52. {
  53. if (CardEffectCommons.HasMatchConditionPermanent(HasDigimon))
  54. {
  55. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  56. selectPermanentEffect.SetUp(
  57. selectPlayer: card.Owner,
  58. canTargetCondition: HasDigimon,
  59. canTargetCondition_ByPreSelecetedList: null,
  60. canEndSelectCondition: null,
  61. maxCount: 1,
  62. canNoSelect: false,
  63. canEndNotMax: false,
  64. selectPermanentCoroutine: SelectPermanentCoroutine1,
  65. afterSelectPermanentCoroutine: null,
  66. mode: SelectPermanentEffect.Mode.Custom,
  67. cardEffect: activateClass);
  68. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get Reboot, Blocker, +2000 DP.", "The opponent is selecting 1 Digimon that will get Reboot, Blocker, +2000 DP.");
  69. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  70. IEnumerator SelectPermanentCoroutine1(Permanent permanent)
  71. {
  72. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainReboot(
  73. targetPermanent: permanent,
  74. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  75. activateClass: activateClass));
  76. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainBlocker(
  77. targetPermanent: permanent,
  78. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  79. activateClass: activateClass));
  80. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  81. targetPermanent: permanent,
  82. changeValue: 2000,
  83. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  84. activateClass: activateClass));
  85. }
  86. }
  87. }
  88. }
  89. #endregion
  90. #region Main
  91. if (timing == EffectTiming.OptionSkill)
  92. {
  93. ActivateClass activateClass = new ActivateClass();
  94. activateClass.SetUpICardEffect("Gain Reboot, Blocker, +2000 DP, then place in battle area", CanUseCondition, card);
  95. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  96. cardEffects.Add(activateClass);
  97. string EffectDiscription()
  98. {
  99. return "[Main] 1 of your Digimon gains <Reboot>, <Blocker> and gets +2000 DP until the end of your opponent's turn. Then, place this card in the battle area.";
  100. }
  101. bool HasDigimon(Permanent permanent)
  102. {
  103. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  104. }
  105. bool CanUseCondition(Hashtable hashtable)
  106. {
  107. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  108. }
  109. IEnumerator ActivateCoroutine(Hashtable hashtable)
  110. {
  111. if(CardEffectCommons.HasMatchConditionPermanent(HasDigimon))
  112. {
  113. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  114. selectPermanentEffect.SetUp(
  115. selectPlayer: card.Owner,
  116. canTargetCondition: HasDigimon,
  117. canTargetCondition_ByPreSelecetedList: null,
  118. canEndSelectCondition: null,
  119. maxCount: 1,
  120. canNoSelect: false,
  121. canEndNotMax: false,
  122. selectPermanentCoroutine: SelectPermanentCoroutine1,
  123. afterSelectPermanentCoroutine: null,
  124. mode: SelectPermanentEffect.Mode.Custom,
  125. cardEffect: activateClass);
  126. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get Reboot, Blocker, +2000 DP.", "The opponent is selecting 1 Digimon that will get Reboot, Blocker, +2000 DP.");
  127. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  128. IEnumerator SelectPermanentCoroutine1(Permanent permanent)
  129. {
  130. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainReboot(
  131. targetPermanent: permanent,
  132. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  133. activateClass: activateClass));
  134. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainBlocker(
  135. targetPermanent: permanent,
  136. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  137. activateClass: activateClass));
  138. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  139. targetPermanent: permanent,
  140. changeValue: 2000,
  141. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  142. activateClass: activateClass));
  143. }
  144. }
  145. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlaceDelayOptionCards(card: card, cardEffect: activateClass));
  146. }
  147. }
  148. #endregion
  149. #region Security Effect
  150. if (timing == EffectTiming.SecuritySkill)
  151. {
  152. ActivateClass activateClass = new ActivateClass();
  153. activateClass.SetUpICardEffect("De-Digivolve 2, 1 of your opponents Digimon, then add this to hand", CanUseCondition, card);
  154. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  155. activateClass.SetIsSecurityEffect(true);
  156. cardEffects.Add(activateClass);
  157. string EffectDiscription()
  158. {
  159. return "[Security] <De-Digivolve 2> 1 of your opponent's Digimon. Then, add this card to the hand.";
  160. }
  161. bool CanSelectPermanentCondition(Permanent permanent)
  162. {
  163. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  164. }
  165. bool CanUseCondition(Hashtable hashtable)
  166. {
  167. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  168. }
  169. IEnumerator ActivateCoroutine(Hashtable hashtable)
  170. {
  171. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  172. {
  173. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  174. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  175. selectPermanentEffect.SetUp(
  176. selectPlayer: card.Owner,
  177. canTargetCondition: CanSelectPermanentCondition,
  178. canTargetCondition_ByPreSelecetedList: null,
  179. canEndSelectCondition: null,
  180. maxCount: maxCount,
  181. canNoSelect: false,
  182. canEndNotMax: false,
  183. selectPermanentCoroutine: SelectPermanentCoroutine,
  184. afterSelectPermanentCoroutine: null,
  185. mode: SelectPermanentEffect.Mode.Custom,
  186. cardEffect: activateClass);
  187. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to De-Digivolve.", "The opponent is selecting 1 Digimon to De-Digivolve.");
  188. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  189. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  190. {
  191. Permanent selectedPermanent = permanent;
  192. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(selectedPermanent, 2, activateClass).Degeneration());
  193. }
  194. }
  195. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.AddThisCardToHand(card, activateClass));
  196. }
  197. }
  198. #endregion
  199. return cardEffects;
  200. }
  201. }
  202. }