BT22_033.cs 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Mediamon
  5. namespace DCGO.CardEffects.BT22
  6. {
  7. public class BT22_033 : 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 Stnd Appmon Alternative Digivolution Requirement
  14. if (timing == EffectTiming.None)
  15. {
  16. bool PermanentCondition(Permanent targetPermanent)
  17. {
  18. return targetPermanent.TopCard.HasStandardAppTraits;
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  21. }
  22. #endregion
  23. #region App Fusion (Musimon, Recomon, Mcmon)
  24. if (timing == EffectTiming.None)
  25. {
  26. cardEffects.Add(CardEffectFactory.AddAppfuseMethodByName(new List<string>() { "Musimon", "Recomon", "Mcmon" }, card));
  27. }
  28. #endregion
  29. #region Link Condition
  30. if (timing == EffectTiming.None)
  31. {
  32. static bool PermanentCondition(Permanent targetPermanent)
  33. {
  34. return targetPermanent.TopCard.HasAppmonTraits;
  35. }
  36. cardEffects.Add(CardEffectFactory.AddSelfLinkConditionStaticEffect(permanentCondition: PermanentCondition, linkCost: 2, card: card));
  37. }
  38. #endregion
  39. #region Link
  40. if (timing == EffectTiming.OnDeclaration)
  41. {
  42. cardEffects.Add(CardEffectFactory.LinkEffect(card));
  43. }
  44. #endregion
  45. #endregion
  46. #region OP/WD Shared
  47. bool SharedIsOpponentDigimon(Permanent permanent)
  48. {
  49. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  50. }
  51. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  52. {
  53. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, SharedIsOpponentDigimon))
  54. {
  55. Permanent selectedPermament = null;
  56. #region Select Permanent
  57. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOpponentsPermanentCount(card, SharedIsOpponentDigimon));
  58. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  59. selectPermanentEffect.SetUp(
  60. selectPlayer: card.Owner,
  61. canTargetCondition: SharedIsOpponentDigimon,
  62. canTargetCondition_ByPreSelecetedList: null,
  63. canEndSelectCondition: null,
  64. maxCount: maxCount,
  65. canNoSelect: false,
  66. canEndNotMax: false,
  67. selectPermanentCoroutine: SelectPermanentCoroutine,
  68. afterSelectPermanentCoroutine: null,
  69. mode: SelectPermanentEffect.Mode.Custom,
  70. cardEffect: activateClass);
  71. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  72. {
  73. selectedPermament = permanent;
  74. yield return null;
  75. }
  76. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to -4K DP", "The opponent is selecting 1 Digimon to -4K DP");
  77. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  78. #endregion
  79. if (selectedPermament != null) yield return ContinuousController.instance.StartCoroutine(
  80. CardEffectCommons.ChangeDigimonDP(selectedPermament, -4000, EffectDuration.UntilEachTurnEnd, activateClass));
  81. }
  82. }
  83. #endregion
  84. #region On Play
  85. if (timing == EffectTiming.OnEnterFieldAnyone)
  86. {
  87. ActivateClass activateClass = new ActivateClass();
  88. activateClass.SetUpICardEffect("-4K DP", CanUseCondition, card);
  89. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  90. cardEffects.Add(activateClass);
  91. string EffectDiscription()
  92. {
  93. return "[On Play] 1 of your opponent's Digimon gets -4000 DP for the turn.";
  94. }
  95. bool CanUseCondition(Hashtable hashtable)
  96. {
  97. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  98. }
  99. bool CanActivateCondition(Hashtable hashtable)
  100. {
  101. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  102. && CardEffectCommons.HasMatchConditionOpponentsPermanent(card, SharedIsOpponentDigimon);
  103. }
  104. IEnumerator ActivateCoroutine(Hashtable hashtable)
  105. {
  106. yield return ContinuousController.instance.StartCoroutine(SharedActivateCoroutine(hashtable, activateClass));
  107. }
  108. }
  109. #endregion
  110. #region When Digivolving
  111. if (timing == EffectTiming.OnEnterFieldAnyone)
  112. {
  113. ActivateClass activateClass = new ActivateClass();
  114. activateClass.SetUpICardEffect("-4K DP", CanUseCondition, card);
  115. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  116. cardEffects.Add(activateClass);
  117. string EffectDiscription()
  118. {
  119. return "[When Digivolving] 1 of your opponent's Digimon gets -4000 DP for the turn.";
  120. }
  121. bool CanUseCondition(Hashtable hashtable)
  122. {
  123. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  124. }
  125. bool CanActivateCondition(Hashtable hashtable)
  126. {
  127. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  128. && CardEffectCommons.HasMatchConditionOpponentsPermanent(card, SharedIsOpponentDigimon);
  129. }
  130. IEnumerator ActivateCoroutine(Hashtable hashtable)
  131. {
  132. yield return ContinuousController.instance.StartCoroutine(SharedActivateCoroutine(hashtable, activateClass));
  133. }
  134. }
  135. #endregion
  136. #region Your Turn
  137. if (timing == EffectTiming.WhenLinked)
  138. {
  139. ActivateClass activateClass = new ActivateClass();
  140. activateClass.SetUpICardEffect("Play 1 level 3 [Appmon] digimon", CanUseCondition, card);
  141. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  142. activateClass.SetHashString("BT22_033_WL");
  143. cardEffects.Add(activateClass);
  144. string EffectDiscription()
  145. {
  146. return "[Your Turn] [Once Per Turn] When this Digimon gets linked, you may play 1 level 3 Digimon card with the [Appmon] trait from your hand without paying the cost.";
  147. }
  148. bool CanUseCondition(Hashtable hashtable)
  149. {
  150. return CardEffectCommons.CanTriggerWhenLinked(hashtable, IsMediamon, null);
  151. }
  152. bool CanActivateCondition(Hashtable hashtable)
  153. {
  154. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  155. && CardEffectCommons.IsOwnerTurn(card)
  156. && CardEffectCommons.HasMatchConditionOwnersHand(card, IsAppMonLevel3Card);
  157. }
  158. bool IsMediamon(Permanent permanent)
  159. {
  160. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  161. && permanent == card.PermanentOfThisCard();
  162. }
  163. bool IsAppMonLevel3Card(CardSource cardSource)
  164. {
  165. return CardEffectCommons.IsExistOnHand(cardSource)
  166. && cardSource.IsDigimon
  167. && cardSource.HasLevel && cardSource.IsLevel3
  168. && cardSource.HasAppmonTraits;
  169. }
  170. IEnumerator ActivateCoroutine(Hashtable hashtable)
  171. {
  172. if (CardEffectCommons.HasMatchConditionOwnersHand(card, IsAppMonLevel3Card))
  173. {
  174. CardSource selectedCard = null;
  175. #region Select Puppet in Hand
  176. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersCardCountInHand(card, IsAppMonLevel3Card));
  177. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  178. selectHandEffect.SetUp(
  179. selectPlayer: card.Owner,
  180. canTargetCondition: IsAppMonLevel3Card,
  181. canTargetCondition_ByPreSelecetedList: null,
  182. canEndSelectCondition: null,
  183. maxCount: maxCount,
  184. canNoSelect: true,
  185. canEndNotMax: false,
  186. isShowOpponent: true,
  187. selectCardCoroutine: SelectCardCoroutine,
  188. afterSelectCardCoroutine: null,
  189. mode: SelectHandEffect.Mode.Custom,
  190. cardEffect: activateClass);
  191. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  192. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  193. yield return StartCoroutine(selectHandEffect.Activate());
  194. IEnumerator SelectCardCoroutine(CardSource cardSource)
  195. {
  196. selectedCard = cardSource;
  197. yield return null;
  198. }
  199. #endregion
  200. if (selectedCard != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: new List<CardSource>() { selectedCard }, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  201. }
  202. }
  203. }
  204. #endregion
  205. #region Link Effect
  206. if (timing == EffectTiming.OnAllyAttack)
  207. {
  208. ActivateClass activateClass = new ActivateClass();
  209. activateClass.SetUpICardEffect("Play 1 level 3 [Appmon] digimon", CanUseCondition, card);
  210. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  211. activateClass.SetIsLinkedEffect(true);
  212. cardEffects.Add(activateClass);
  213. string EffectDiscription()
  214. {
  215. return "[When Attacking] You may play 1 level 3 Digimon card with the [Appmon] trait from your hand without paying the cost";
  216. }
  217. bool CanUseCondition(Hashtable hashtable)
  218. {
  219. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  220. }
  221. bool CanActivateCondition(Hashtable hashtable)
  222. {
  223. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  224. && CardEffectCommons.HasMatchConditionOwnersHand(card, IsAppMonLevel3Card);
  225. }
  226. bool IsAppMonLevel3Card(CardSource cardSource)
  227. {
  228. return CardEffectCommons.IsExistOnHand(cardSource)
  229. && cardSource.IsDigimon
  230. && cardSource.HasLevel && cardSource.IsLevel3
  231. && cardSource.HasAppmonTraits;
  232. }
  233. IEnumerator ActivateCoroutine(Hashtable hashtable)
  234. {
  235. if (CardEffectCommons.HasMatchConditionOwnersHand(card, IsAppMonLevel3Card))
  236. {
  237. CardSource selectedCard = null;
  238. #region Select Appmon in Hand
  239. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersCardCountInHand(card, IsAppMonLevel3Card));
  240. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  241. selectHandEffect.SetUp(
  242. selectPlayer: card.Owner,
  243. canTargetCondition: IsAppMonLevel3Card,
  244. canTargetCondition_ByPreSelecetedList: null,
  245. canEndSelectCondition: null,
  246. maxCount: maxCount,
  247. canNoSelect: true,
  248. canEndNotMax: false,
  249. isShowOpponent: true,
  250. selectCardCoroutine: SelectCardCoroutine,
  251. afterSelectCardCoroutine: null,
  252. mode: SelectHandEffect.Mode.Custom,
  253. cardEffect: activateClass);
  254. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  255. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  256. yield return StartCoroutine(selectHandEffect.Activate());
  257. IEnumerator SelectCardCoroutine(CardSource cardSource)
  258. {
  259. selectedCard = cardSource;
  260. yield return null;
  261. }
  262. #endregion
  263. if (selectedCard != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: new List<CardSource>() { selectedCard }, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  264. }
  265. }
  266. }
  267. #endregion
  268. return cardEffects;
  269. }
  270. }
  271. }