BT16_030.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT16
  5. {
  6. public class BT16_030 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Digivolve Condition
  12. if (timing == EffectTiming.None)
  13. {
  14. static bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. if (targetPermanent.TopCard.CardNames.Contains("Nyaromon"))
  17. {
  18. return true;
  19. }
  20. return false;
  21. }
  22. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false, card: card, condition: null));
  23. }
  24. #endregion
  25. #region Inherit
  26. if (timing == EffectTiming.None)
  27. {
  28. bool CardCondition(CardSource cardSource)
  29. {
  30. return cardSource.Owner == card.Owner.Enemy;
  31. }
  32. bool Condition()
  33. {
  34. if (CardEffectCommons.IsExistOnBattleArea(card))
  35. {
  36. if (CardEffectCommons.IsOwnerTurn(card))
  37. {
  38. return true;
  39. }
  40. }
  41. return false;
  42. }
  43. cardEffects.Add(CardEffectFactory.ChangeSecurityDigimonCardDPStaticEffect(
  44. cardCondition: CardCondition,
  45. changeValue: -3000,
  46. isInheritedEffect: true,
  47. card: card,
  48. condition: Condition,
  49. effectName: "Opponent's Security Digimon gains DP -3000"));
  50. }
  51. #endregion
  52. #region Start of Main
  53. if (timing == EffectTiming.OnStartMainPhase)
  54. {
  55. ActivateClass activateClass = new ActivateClass();
  56. activateClass.SetUpICardEffect("1 of your Digimon may Digivolve", CanUseCondition, card);
  57. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  58. activateClass.SetHashString("Digivolve_BT16_030");
  59. cardEffects.Add(activateClass);
  60. string EffectDiscription()
  61. {
  62. return "[Start of Main Phase] If it's your turn, 1 of your Digimon may digivolve into a level 4 Digimon card with the [Holy Beast] or [Free] trait from your trash with the digivolution cost reduced by 1.";
  63. }
  64. bool CanSelectCardCondition(CardSource cardSource)
  65. {
  66. if (cardSource.CardTraits.Contains("Holy Beast") || cardSource.CardTraits.Contains("HolyBeast") || cardSource.CardTraits.Contains("Free"))
  67. {
  68. if (cardSource.HasLevel && cardSource.Level == 4)
  69. {
  70. return true;
  71. }
  72. }
  73. return false;
  74. }
  75. bool CanSelectPermanentCondition(Permanent permanent)
  76. {
  77. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  78. {
  79. foreach (CardSource cardSource in card.Owner.TrashCards)
  80. {
  81. if (CanSelectCardCondition(cardSource))
  82. {
  83. if (cardSource.CanPlayCardTargetFrame(permanent.PermanentFrame, false, activateClass))
  84. {
  85. return true;
  86. }
  87. }
  88. }
  89. }
  90. return false;
  91. }
  92. bool CanUseCondition(Hashtable hashtable)
  93. {
  94. if (CardEffectCommons.IsExistOnBattleArea(card))
  95. {
  96. if (CardEffectCommons.IsOwnerTurn(card))
  97. {
  98. return true;
  99. }
  100. }
  101. return false;
  102. }
  103. bool CanActivateCondition(Hashtable hashtable)
  104. {
  105. if (CardEffectCommons.IsExistOnBattleArea(card))
  106. {
  107. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  108. {
  109. if (card.Owner.TrashCards.Count >= 1)
  110. {
  111. return true;
  112. }
  113. }
  114. }
  115. return false;
  116. }
  117. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  118. {
  119. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  120. {
  121. Permanent selectedPermanent = null;
  122. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  123. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  124. selectPermanentEffect.SetUp(
  125. selectPlayer: card.Owner,
  126. canTargetCondition: CanSelectPermanentCondition,
  127. canTargetCondition_ByPreSelecetedList: null,
  128. canEndSelectCondition: null,
  129. maxCount: maxCount,
  130. canNoSelect: true,
  131. canEndNotMax: false,
  132. selectPermanentCoroutine: SelectPermanentCoroutine,
  133. afterSelectPermanentCoroutine: null,
  134. mode: SelectPermanentEffect.Mode.Custom,
  135. cardEffect: activateClass);
  136. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will digivolve.", "The opponent is selecting 1 Digimon that will digivolve.");
  137. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  138. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  139. {
  140. selectedPermanent = permanent;
  141. yield return null;
  142. }
  143. if (selectedPermanent != null)
  144. {
  145. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  146. targetPermanent: selectedPermanent,
  147. cardCondition: CanSelectCardCondition,
  148. payCost: true,
  149. reduceCostTuple: (reduceCost: 1, reduceCostCardCondition: null),
  150. fixedCostTuple: null,
  151. ignoreDigivolutionRequirementFixedCost: -1,
  152. isHand: false,
  153. activateClass: activateClass,
  154. successProcess: null));
  155. }
  156. }
  157. }
  158. }
  159. #endregion
  160. #region On Play
  161. if (timing == EffectTiming.OnEnterFieldAnyone)
  162. {
  163. ActivateClass activateClass = new ActivateClass();
  164. activateClass.SetUpICardEffect("1 of your Digimon may Digivolve", CanUseCondition, card);
  165. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  166. activateClass.SetHashString("Digivolve_BT16_030");
  167. cardEffects.Add(activateClass);
  168. string EffectDiscription()
  169. {
  170. return "[On Play] If it's your turn, 1 of your Digimon may digivolve into a level 4 Digimon card with the [Holy Beast] or [Free] trait from your trash with the digivolution cost reduced by 1.";
  171. }
  172. bool CanSelectCardCondition(CardSource cardSource)
  173. {
  174. if (cardSource.CardTraits.Contains("Holy Beast") || cardSource.CardTraits.Contains("HolyBeast") || cardSource.CardTraits.Contains("Free"))
  175. {
  176. if (cardSource.HasLevel && cardSource.Level == 4)
  177. {
  178. return true;
  179. }
  180. }
  181. return false;
  182. }
  183. bool CanSelectPermanentCondition(Permanent permanent)
  184. {
  185. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  186. {
  187. foreach (CardSource cardSource in card.Owner.TrashCards)
  188. {
  189. if (CanSelectCardCondition(cardSource))
  190. {
  191. if (cardSource.CanPlayCardTargetFrame(permanent.PermanentFrame, false, activateClass))
  192. {
  193. return true;
  194. }
  195. }
  196. }
  197. }
  198. return false;
  199. }
  200. bool CanUseCondition(Hashtable hashtable)
  201. {
  202. if (CardEffectCommons.IsOwnerTurn(card))
  203. {
  204. if (CardEffectCommons.CanTriggerOnPlay(hashtable, card))
  205. {
  206. return true;
  207. }
  208. }
  209. return false;
  210. }
  211. bool CanActivateCondition(Hashtable hashtable)
  212. {
  213. if (CardEffectCommons.IsExistOnBattleArea(card))
  214. {
  215. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  216. {
  217. if (card.Owner.TrashCards.Count >= 1)
  218. {
  219. return true;
  220. }
  221. }
  222. }
  223. return false;
  224. }
  225. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  226. {
  227. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  228. {
  229. Permanent selectedPermanent = null;
  230. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  231. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  232. selectPermanentEffect.SetUp(
  233. selectPlayer: card.Owner,
  234. canTargetCondition: CanSelectPermanentCondition,
  235. canTargetCondition_ByPreSelecetedList: null,
  236. canEndSelectCondition: null,
  237. maxCount: maxCount,
  238. canNoSelect: true,
  239. canEndNotMax: false,
  240. selectPermanentCoroutine: SelectPermanentCoroutine,
  241. afterSelectPermanentCoroutine: null,
  242. mode: SelectPermanentEffect.Mode.Custom,
  243. cardEffect: activateClass);
  244. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will digivolve.", "The opponent is selecting 1 Digimon that will digivolve.");
  245. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  246. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  247. {
  248. selectedPermanent = permanent;
  249. yield return null;
  250. }
  251. if (selectedPermanent != null)
  252. {
  253. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  254. targetPermanent: selectedPermanent,
  255. cardCondition: CanSelectCardCondition,
  256. payCost: true,
  257. reduceCostTuple: (reduceCost: 1, reduceCostCardCondition: null),
  258. fixedCostTuple: null,
  259. ignoreDigivolutionRequirementFixedCost: -1,
  260. isHand: false,
  261. activateClass: activateClass,
  262. successProcess: null));
  263. }
  264. }
  265. }
  266. }
  267. #endregion
  268. return cardEffects;
  269. }
  270. }
  271. }