WaruMonzaemon_BT15_065.cs 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using UnityEngine;
  5. using Photon;
  6. using System;
  7. using Photon.Pun;
  8. using System.Runtime.Remoting;
  9. public class WaruMonzaemon_BT15_065 : CEntity_Effect
  10. {
  11. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  12. {
  13. List<ICardEffect> cardEffects = new List<ICardEffect>();
  14. if(timing == EffectTiming.None)
  15. {
  16. static bool PermanentCondition(Permanent targetPermanent)
  17. {
  18. return targetPermanent.TopCard.CardNames.Contains("Numemon") && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 4;
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  21. }
  22. if(timing == EffectTiming.OnEnterFieldAnyone)
  23. {
  24. ActivateClass activateClass = new ActivateClass();
  25. activateClass.SetUpICardEffect("Place a card under this Digimon to gain effects.", CanUseCondition, card);
  26. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  27. cardEffects.Add(activateClass);
  28. string EffectDiscription()
  29. {
  30. return "[On Play] By placing 1 card with [Numemon] in it's name from your trash as this Digimon's bottom digivolution card, all of your opponent's Digimon with a play cost of 5 or less can't attack players until the end of your opponent's turn.";
  31. }
  32. bool CanSelectCardCondition(CardSource cardSource)
  33. {
  34. return cardSource.ContainsCardName("Numemon");
  35. }
  36. bool CanUseCondition(Hashtable hashtable)
  37. {
  38. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  39. }
  40. bool CanActivateCondition(Hashtable hashtable)
  41. {
  42. if (CardEffectCommons.IsExistOnBattleArea(card))
  43. {
  44. if (!card.PermanentOfThisCard().IsToken)
  45. {
  46. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  47. {
  48. return true;
  49. }
  50. }
  51. }
  52. return false;
  53. }
  54. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  55. {
  56. if (CardEffectCommons.IsExistOnBattleArea(card))
  57. {
  58. bool added = false;
  59. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  60. {
  61. List<CardSource> selectedCards = new List<CardSource>();
  62. int maxCount = 1;
  63. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  64. selectCardEffect.SetUp(
  65. canTargetCondition: CanSelectCardCondition,
  66. canTargetCondition_ByPreSelecetedList: null,
  67. canEndSelectCondition: null,
  68. canNoSelect: () => true,
  69. selectCardCoroutine: SelectCardCoroutine,
  70. afterSelectCardCoroutine: null,
  71. message: "Select 1 card to place on bottom of digivolution cards.",
  72. maxCount: maxCount,
  73. canEndNotMax: false,
  74. isShowOpponent: true,
  75. mode: SelectCardEffect.Mode.Custom,
  76. root: SelectCardEffect.Root.Trash,
  77. customRootCardList: null,
  78. canLookReverseCard: true,
  79. selectPlayer: card.Owner,
  80. cardEffect: activateClass);
  81. selectCardEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  82. selectCardEffect.SetUpCustomMessage("Select 1 card to place on bottom of digivolution cards.", "The opponent is selecting 1 card to place on bottom of digivolution cards.");
  83. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  84. IEnumerator SelectCardCoroutine(CardSource cardSource)
  85. {
  86. selectedCards.Add(cardSource);
  87. yield return null;
  88. }
  89. if (selectedCards.Count >= 1)
  90. {
  91. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(selectedCards, activateClass));
  92. added = true;
  93. }
  94. }
  95. if (added)
  96. {
  97. bool AttackerCondition(Permanent Attacker)
  98. {
  99. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(Attacker, card))
  100. {
  101. if (Attacker.TopCard.GetCostItself >= 5)
  102. {
  103. if (Attacker.TopCard.HasPlayCost)
  104. {
  105. return true;
  106. }
  107. }
  108. }
  109. return false;
  110. }
  111. bool DefenderCondition(Permanent Defender)
  112. {
  113. return Defender == null;
  114. }
  115. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotAttackPlayerEffect(
  116. attackerCondition: AttackerCondition,
  117. defenderCondition: DefenderCondition,
  118. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  119. activateClass: activateClass,
  120. effectName: "Can't Attack"));
  121. }
  122. }
  123. }
  124. }
  125. //On Play
  126. if (timing == EffectTiming.OnEnterFieldAnyone)
  127. {
  128. ActivateClass activateClass = new ActivateClass();
  129. activateClass.SetUpICardEffect("Trash 1 card from hand to DeDigivolve an opponent's Digimon.", CanUseCondition, card);
  130. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  131. cardEffects.Add(activateClass);
  132. string EffectDiscription()
  133. {
  134. return "[On Play] By trashing 1 card with [Numemon] in it's name in your hand or from the bottom of this Digimon's digivolution cards, [De-Digivolve 1] 1 of your opponent's Digimon.";
  135. }
  136. bool CanSelectCardCondition(CardSource cardSource)
  137. {
  138. if (cardSource.ContainsCardName("Numemon"))
  139. {
  140. return true;
  141. }
  142. return false;
  143. }
  144. bool CanSelectPermanentCondition(Permanent permanent)
  145. {
  146. if(permanent.TopCard.IsDigimon)
  147. {
  148. if (permanent.TopCard.HasLevel)
  149. {
  150. return true;
  151. }
  152. }
  153. return false;
  154. }
  155. bool CanUseCondition(Hashtable hashtable)
  156. {
  157. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  158. }
  159. bool CanActivateCondition(Hashtable hashtable)
  160. {
  161. if (CardEffectCommons.IsExistOnBattleArea(card))
  162. {
  163. if (card.Owner.HandCards.Count >= 1)
  164. {
  165. return true;
  166. }
  167. }
  168. return false;
  169. }
  170. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  171. {
  172. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  173. {
  174. bool discarded = false;
  175. int discardCount = 1;
  176. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  177. selectHandEffect.SetUp(
  178. selectPlayer: card.Owner,
  179. canTargetCondition: CanSelectCardCondition,
  180. canTargetCondition_ByPreSelecetedList: null,
  181. canEndSelectCondition: null,
  182. maxCount: discardCount,
  183. canNoSelect: true,
  184. canEndNotMax: false,
  185. isShowOpponent: true,
  186. selectCardCoroutine: null,
  187. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  188. mode: SelectHandEffect.Mode.Discard,
  189. cardEffect: activateClass);
  190. yield return StartCoroutine(selectHandEffect.Activate());
  191. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  192. {
  193. if (cardSources.Count >= 1)
  194. {
  195. discarded = true;
  196. yield return null;
  197. }
  198. }
  199. if (discarded)
  200. {
  201. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  202. {
  203. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  204. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  205. selectPermanentEffect.SetUp(
  206. selectPlayer: card.Owner,
  207. canTargetCondition: CanSelectPermanentCondition,
  208. canTargetCondition_ByPreSelecetedList: null,
  209. canEndSelectCondition: null,
  210. maxCount: maxCount,
  211. canNoSelect: false,
  212. canEndNotMax: false,
  213. selectPermanentCoroutine: SelectPermanentCoroutine,
  214. afterSelectPermanentCoroutine: null,
  215. mode: SelectPermanentEffect.Mode.Custom,
  216. cardEffect: activateClass);
  217. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to De-Digivolve.", "The opponent is selecting 1 Digimon to De-Digivolve.");
  218. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  219. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  220. {
  221. Permanent selectedPermanent = permanent;
  222. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(selectedPermanent, 1, activateClass).Degeneration());
  223. }
  224. }
  225. }
  226. }
  227. }
  228. }
  229. //On Digivolve
  230. if (timing == EffectTiming.OnEnterFieldAnyone)
  231. {
  232. ActivateClass activateClass = new ActivateClass();
  233. activateClass.SetUpICardEffect("Trash 1 card from hand to DeDigivolve an opponent's Digimon.", CanUseCondition, card);
  234. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  235. cardEffects.Add(activateClass);
  236. string EffectDiscription()
  237. {
  238. return "[When Digivolving] By trashing 1 card with [Numemon] in it's name in your hand or from the bottom of this Digimon's digivolution cards, [De-Digivolve 1] 1 of your opponent's Digimon.";
  239. }
  240. bool CanSelectCardCondition(CardSource cardSource)
  241. {
  242. if (cardSource.ContainsCardName("Numemon") || cardSource.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => cardSource.ContainsCardName("Numemon")) >= 1)
  243. {
  244. return true;
  245. }
  246. return false;
  247. }
  248. bool CanSelectPermanentCondition(Permanent permanent)
  249. {
  250. return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card);
  251. }
  252. bool CanUseCondition(Hashtable hashtable)
  253. {
  254. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  255. }
  256. bool CanActivateCondition(Hashtable hashtable)
  257. {
  258. if (CardEffectCommons.IsExistOnBattleArea(card))
  259. {
  260. if (card.Owner.HandCards.Count >= 1)
  261. {
  262. return true;
  263. }
  264. }
  265. return false;
  266. }
  267. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  268. {
  269. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  270. {
  271. bool discarded = false;
  272. int discardCount = 1;
  273. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  274. selectHandEffect.SetUp(
  275. selectPlayer: card.Owner,
  276. canTargetCondition: CanSelectCardCondition,
  277. canTargetCondition_ByPreSelecetedList: null,
  278. canEndSelectCondition: null,
  279. maxCount: discardCount,
  280. canNoSelect: true,
  281. canEndNotMax: false,
  282. isShowOpponent: true,
  283. selectCardCoroutine: null,
  284. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  285. mode: SelectHandEffect.Mode.Discard,
  286. cardEffect: activateClass);
  287. yield return StartCoroutine(selectHandEffect.Activate());
  288. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  289. {
  290. if (cardSources.Count >= 1)
  291. {
  292. discarded = true;
  293. yield return null;
  294. }
  295. }
  296. if (discarded)
  297. {
  298. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  299. {
  300. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  301. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  302. selectPermanentEffect.SetUp(
  303. selectPlayer: card.Owner,
  304. canTargetCondition: CanSelectPermanentCondition,
  305. canTargetCondition_ByPreSelecetedList: null,
  306. canEndSelectCondition: null,
  307. maxCount: maxCount,
  308. canNoSelect: false,
  309. canEndNotMax: false,
  310. selectPermanentCoroutine: SelectPermanentCoroutine,
  311. afterSelectPermanentCoroutine: null,
  312. mode: SelectPermanentEffect.Mode.Custom,
  313. cardEffect: activateClass);
  314. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to De-Digivolve.", "The opponent is selecting 1 Digimon to De-Digivolve.");
  315. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  316. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  317. {
  318. Permanent selectedPermanent = permanent;
  319. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(selectedPermanent, 1, activateClass).Degeneration());
  320. }
  321. }
  322. }
  323. }
  324. }
  325. }
  326. if (timing == EffectTiming.None)
  327. {
  328. bool Condition()
  329. {
  330. if (CardEffectCommons.IsExistOnBattleArea(card))
  331. {
  332. if (CardEffectCommons.IsOwnerTurn(card))
  333. {
  334. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsDigimon && permanent.TopCard.ContainsCardName("Monzaemon") || permanent.TopCard.ContainsCardName("Numemon")))
  335. {
  336. return true;
  337. }
  338. }
  339. }
  340. return false;
  341. }
  342. cardEffects.Add(CardEffectFactory.ChangeSelfSAttackStaticEffect(changeValue: 1, isInheritedEffect: true, card: card, condition: Condition));
  343. }
  344. return cardEffects;
  345. }
  346. }