BT17_088.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT17
  5. {
  6. public class BT17_088 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Start Of main Phase/ On Play
  12. bool CanSelectYourGreenDigimon(Permanent permanent)
  13. {
  14. if(CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  15. return permanent.TopCard.CardColors.Contains(CardColor.Green);
  16. return false;
  17. }
  18. #endregion
  19. #region Start of You Main Phase
  20. if (timing == EffectTiming.OnStartMainPhase)
  21. {
  22. ActivateClass activateClass = new ActivateClass();
  23. activateClass.SetUpICardEffect("+2000 DP", CanUseCondition, card);
  24. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  25. cardEffects.Add(activateClass);
  26. string EffectDiscription()
  27. {
  28. return "[Start of Your Main Phase] 1 of your green Digimon gets +2000 DP until the end of your opponent's turn.";
  29. }
  30. bool CanUseCondition(Hashtable hashtable)
  31. {
  32. if (isExistOnField(card))
  33. {
  34. if (CardEffectCommons.IsOwnerTurn(card))
  35. {
  36. return true;
  37. }
  38. }
  39. return false;
  40. }
  41. bool CanActivateCondition(Hashtable hashtable)
  42. {
  43. return isExistOnField(card);
  44. }
  45. IEnumerator ActivateCoroutine(Hashtable hashtable)
  46. {
  47. if(CardEffectCommons.HasMatchConditionPermanent(CanSelectYourGreenDigimon))
  48. {
  49. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectYourGreenDigimon));
  50. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  51. selectPermanentEffect.SetUp(
  52. selectPlayer: card.Owner,
  53. canTargetCondition: CanSelectYourGreenDigimon,
  54. canTargetCondition_ByPreSelecetedList: null,
  55. canEndSelectCondition: null,
  56. maxCount: maxCount,
  57. canNoSelect: false,
  58. canEndNotMax: false,
  59. selectPermanentCoroutine: SelectPermanentCoroutine,
  60. afterSelectPermanentCoroutine: null,
  61. mode: SelectPermanentEffect.Mode.Custom,
  62. cardEffect: activateClass);
  63. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP +2000.", "The opponent is selecting 1 Digimon that will get DP +2000.");
  64. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  65. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  66. {
  67. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: 2000, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  68. }
  69. }
  70. }
  71. }
  72. #endregion
  73. #region On Play
  74. if (timing == EffectTiming.OnEnterFieldAnyone)
  75. {
  76. ActivateClass activateClass = new ActivateClass();
  77. activateClass.SetUpICardEffect("+2000 DP", CanUseCondition, card);
  78. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  79. cardEffects.Add(activateClass);
  80. string EffectDiscription()
  81. {
  82. return "[On Play] 1 of your green Digimon gets +2000 DP until the end of your opponent's turn.";
  83. }
  84. bool CanUseCondition(Hashtable hashtable)
  85. {
  86. if (isExistOnField(card))
  87. {
  88. if (CardEffectCommons.CanTriggerOnPlay(hashtable, card))
  89. return true;
  90. }
  91. return false;
  92. }
  93. bool CanActivateCondition(Hashtable hashtable)
  94. {
  95. return isExistOnField(card);
  96. }
  97. IEnumerator ActivateCoroutine(Hashtable hashtable)
  98. {
  99. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectYourGreenDigimon))
  100. {
  101. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectYourGreenDigimon));
  102. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  103. selectPermanentEffect.SetUp(
  104. selectPlayer: card.Owner,
  105. canTargetCondition: CanSelectYourGreenDigimon,
  106. canTargetCondition_ByPreSelecetedList: null,
  107. canEndSelectCondition: null,
  108. maxCount: maxCount,
  109. canNoSelect: false,
  110. canEndNotMax: false,
  111. selectPermanentCoroutine: SelectPermanentCoroutine,
  112. afterSelectPermanentCoroutine: null,
  113. mode: SelectPermanentEffect.Mode.Custom,
  114. cardEffect: activateClass);
  115. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP +2000.", "The opponent is selecting 1 Digimon that will get DP +2000.");
  116. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  117. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  118. {
  119. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: 2000, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  120. }
  121. }
  122. }
  123. }
  124. #endregion
  125. #region Your Turn - When Digimon Played
  126. if (timing == EffectTiming.OnEnterFieldAnyone)
  127. {
  128. Permanent selectedPermanent = null;
  129. ActivateClass activateClass = new ActivateClass();
  130. activateClass.SetUpICardEffect("Digivolve for reduced cost", CanUseCondition, card);
  131. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  132. cardEffects.Add(activateClass);
  133. string EffectDiscription()
  134. {
  135. return "[Your Turn] When one your Digimon with [Terriermon] or [Lopmon] in its name is played, by suspending this Tamer, 1 of your Digimon with [Terriermon] or [Lopmon] in its name may digivolve into a Digimon card in the hand with the digivolution cost reduced by 2.";
  136. }
  137. bool PlayedPermanentCondition(Permanent permanent)
  138. {
  139. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  140. {
  141. if (permanent.TopCard.ContainsCardName("Terriermon") || permanent.TopCard.ContainsCardName("Lopmon"))
  142. {
  143. return true;
  144. }
  145. }
  146. return false;
  147. }
  148. bool DigivolvePermanentCondition(CardSource source)
  149. {
  150. if (source.Owner == card.Owner)
  151. {
  152. if (source.IsDigimon)
  153. {
  154. if (source.CanPlayCardTargetFrame(selectedPermanent.PermanentFrame, true, activateClass))
  155. {
  156. return true;
  157. }
  158. }
  159. }
  160. return false;
  161. }
  162. bool CanUseCondition(Hashtable hashtable)
  163. {
  164. if (isExistOnField(card))
  165. {
  166. if (CardEffectCommons.IsOwnerTurn(card))
  167. {
  168. if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PlayedPermanentCondition))
  169. {
  170. return true;
  171. }
  172. }
  173. }
  174. return false;
  175. }
  176. bool CanActivateCondition(Hashtable hashtable)
  177. {
  178. if (isExistOnField(card))
  179. {
  180. if (CardEffectCommons.CanActivateSuspendCostEffect(card))
  181. {
  182. return true;
  183. }
  184. }
  185. return false;
  186. }
  187. IEnumerator ActivateCoroutine(Hashtable hashtable)
  188. {
  189. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  190. if(CardEffectCommons.HasMatchConditionOwnersPermanent(card, PlayedPermanentCondition))
  191. {
  192. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(PlayedPermanentCondition));
  193. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  194. selectPermanentEffect.SetUp(
  195. selectPlayer: card.Owner,
  196. canTargetCondition: PlayedPermanentCondition,
  197. canTargetCondition_ByPreSelecetedList: null,
  198. canEndSelectCondition: null,
  199. maxCount: maxCount,
  200. canNoSelect: false,
  201. canEndNotMax: false,
  202. selectPermanentCoroutine: SelectPermanentCoroutine,
  203. afterSelectPermanentCoroutine: null,
  204. mode: SelectPermanentEffect.Mode.Custom,
  205. cardEffect: activateClass);
  206. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  207. }
  208. IEnumerator SelectPermanentCoroutine (Permanent permanent)
  209. {
  210. if(permanent != null)
  211. selectedPermanent = permanent;
  212. yield return null;
  213. }
  214. if(selectedPermanent != null)
  215. {
  216. if (CardEffectCommons.HasMatchConditionOwnersHand(card, DigivolvePermanentCondition))
  217. {
  218. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  219. targetPermanent: selectedPermanent,
  220. cardCondition: DigivolvePermanentCondition,
  221. payCost: true,
  222. reduceCostTuple: (reduceCost: 2, reduceCostCardCondition: null),
  223. fixedCostTuple: null,
  224. ignoreDigivolutionRequirementFixedCost: -1,
  225. isHand: true,
  226. activateClass: activateClass,
  227. successProcess: null));
  228. }
  229. }
  230. }
  231. }
  232. #endregion
  233. #region Security Effect
  234. if (timing == EffectTiming.SecuritySkill)
  235. {
  236. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  237. }
  238. #endregion
  239. return cardEffects;
  240. }
  241. }
  242. }