EX10_021.cs 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System;
  4. // Belphemon: Sleep Mode
  5. namespace DCGO.CardEffects.EX10
  6. {
  7. public class EX10_021 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Digivolution Requirements
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.EqualsCardName("Belphemon: Rage Mode");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 1, ignoreDigivolutionRequirement: false, card: card, condition: null));
  20. }
  21. #endregion
  22. #region On Play
  23. if (timing == EffectTiming.OnEnterFieldAnyone)
  24. {
  25. ActivateClass activateClass = new ActivateClass();
  26. activateClass.SetUpICardEffect("Place 1 card from trash to digivolution cards so that this Digimon gets effects", CanUseCondition, card);
  27. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  28. cardEffects.Add(activateClass);
  29. string EffectDiscription()
  30. {
  31. return "[On Play] By placing 1 [Belphemon: Rage Mode] from your trash as this Digimon's top digivolution card, until the end of your opponent's turn, this Digimon can't attack and isn't affected by your opponent's effects.";
  32. }
  33. bool CanSelectCardCondition(CardSource cardSource)
  34. {
  35. if (cardSource.CardNames.Contains("Belphemon: Rage Mode"))
  36. {
  37. return true;
  38. }
  39. if (cardSource.CardNames.Contains("Belphemon:RageMode"))
  40. {
  41. return true;
  42. }
  43. return false;
  44. }
  45. bool CanUseCondition(Hashtable hashtable)
  46. {
  47. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  48. }
  49. bool CanActivateCondition(Hashtable hashtable)
  50. {
  51. if (CardEffectCommons.IsExistOnBattleArea(card))
  52. {
  53. if (!card.PermanentOfThisCard().IsToken)
  54. {
  55. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  56. {
  57. return true;
  58. }
  59. }
  60. }
  61. return false;
  62. }
  63. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  64. {
  65. if (CardEffectCommons.IsExistOnBattleArea(card))
  66. {
  67. bool added = false;
  68. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  69. {
  70. List<CardSource> selectedCards = new List<CardSource>();
  71. int maxCount = 1;
  72. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  73. selectCardEffect.SetUp(
  74. canTargetCondition: CanSelectCardCondition,
  75. canTargetCondition_ByPreSelecetedList: null,
  76. canEndSelectCondition: null,
  77. canNoSelect: () => false,
  78. selectCardCoroutine: SelectCardCoroutine,
  79. afterSelectCardCoroutine: null,
  80. message: "Select 1 card to place on bottom of digivolution cards.",
  81. maxCount: maxCount,
  82. canEndNotMax: false,
  83. isShowOpponent: true,
  84. mode: SelectCardEffect.Mode.Custom,
  85. root: SelectCardEffect.Root.Trash,
  86. customRootCardList: null,
  87. canLookReverseCard: true,
  88. selectPlayer: card.Owner,
  89. cardEffect: activateClass);
  90. selectCardEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  91. 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.");
  92. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  93. IEnumerator SelectCardCoroutine(CardSource cardSource)
  94. {
  95. selectedCards.Add(cardSource);
  96. yield return null;
  97. }
  98. if (selectedCards.Count >= 1)
  99. {
  100. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsTop(selectedCards, activateClass));
  101. added = true;
  102. }
  103. }
  104. if (added)
  105. {
  106. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotAttack(
  107. targetPermanent: card.PermanentOfThisCard(),
  108. defenderCondition: null,
  109. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  110. activateClass: activateClass,
  111. effectName: "Can't Attack"));
  112. if (CardEffectCommons.IsExistOnBattleArea(card))
  113. {
  114. Permanent selectedPermanent = card.PermanentOfThisCard();
  115. if (selectedPermanent != null)
  116. {
  117. CanNotAffectedClass canNotAffectedClass = new CanNotAffectedClass();
  118. canNotAffectedClass.SetUpICardEffect("Isn't affected by opponent's effect", CanUseCondition1, card);
  119. canNotAffectedClass.SetUpCanNotAffectedClass(CardCondition: CardCondition, SkillCondition: SkillCondition);
  120. selectedPermanent.UntilOpponentTurnEndEffects.Add((_timing) => canNotAffectedClass);
  121. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateBuffEffect(selectedPermanent));
  122. bool CanUseCondition1(Hashtable hashtable)
  123. {
  124. if (selectedPermanent.TopCard != null)
  125. {
  126. return true;
  127. }
  128. return false;
  129. }
  130. bool CardCondition(CardSource cardSource)
  131. {
  132. if (selectedPermanent.TopCard != null)
  133. {
  134. if (selectedPermanent.TopCard.Owner.GetBattleAreaPermanents().Contains(selectedPermanent))
  135. {
  136. if (cardSource == selectedPermanent.TopCard)
  137. {
  138. return true;
  139. }
  140. }
  141. }
  142. return false;
  143. }
  144. bool SkillCondition(ICardEffect cardEffect)
  145. {
  146. if (cardEffect != null)
  147. {
  148. if (cardEffect.EffectSourceCard != null)
  149. {
  150. if (cardEffect.EffectSourceCard.Owner == card.Owner.Enemy)
  151. {
  152. return true;
  153. }
  154. }
  155. }
  156. return false;
  157. }
  158. }
  159. }
  160. }
  161. }
  162. }
  163. }
  164. #endregion
  165. #region When Digivolving
  166. if (timing == EffectTiming.OnEnterFieldAnyone)
  167. {
  168. ActivateClass activateClass = new ActivateClass();
  169. activateClass.SetUpICardEffect("Place 1 card from trash to digivolution cards so that this Digimon gets effects", CanUseCondition, card);
  170. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  171. cardEffects.Add(activateClass);
  172. string EffectDiscription()
  173. {
  174. return "[When Digivolving] By placing 1 [Belphemon: Rage Mode] from your trash as this Digimon's top digivolution card, until the end of your opponent's turn, this Digimon can't attack and isn't affected by your opponent's effects.";
  175. }
  176. bool CanSelectCardCondition(CardSource cardSource)
  177. {
  178. if (cardSource.CardNames.Contains("Belphemon: Rage Mode"))
  179. {
  180. return true;
  181. }
  182. if (cardSource.CardNames.Contains("Belphemon:RageMode"))
  183. {
  184. return true;
  185. }
  186. return false;
  187. }
  188. bool CanUseCondition(Hashtable hashtable)
  189. {
  190. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  191. }
  192. bool CanActivateCondition(Hashtable hashtable)
  193. {
  194. if (CardEffectCommons.IsExistOnBattleArea(card))
  195. {
  196. if (!card.PermanentOfThisCard().IsToken)
  197. {
  198. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  199. {
  200. return true;
  201. }
  202. }
  203. }
  204. return false;
  205. }
  206. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  207. {
  208. if (CardEffectCommons.IsExistOnBattleArea(card))
  209. {
  210. bool added = false;
  211. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  212. {
  213. List<CardSource> selectedCards = new List<CardSource>();
  214. int maxCount = 1;
  215. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  216. selectCardEffect.SetUp(
  217. canTargetCondition: CanSelectCardCondition,
  218. canTargetCondition_ByPreSelecetedList: null,
  219. canEndSelectCondition: null,
  220. canNoSelect: () => false,
  221. selectCardCoroutine: SelectCardCoroutine,
  222. afterSelectCardCoroutine: null,
  223. message: "Select 1 card to place on bottom of digivolution cards.",
  224. maxCount: maxCount,
  225. canEndNotMax: false,
  226. isShowOpponent: true,
  227. mode: SelectCardEffect.Mode.Custom,
  228. root: SelectCardEffect.Root.Trash,
  229. customRootCardList: null,
  230. canLookReverseCard: true,
  231. selectPlayer: card.Owner,
  232. cardEffect: activateClass);
  233. selectCardEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  234. 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.");
  235. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  236. IEnumerator SelectCardCoroutine(CardSource cardSource)
  237. {
  238. selectedCards.Add(cardSource);
  239. yield return null;
  240. }
  241. if (selectedCards.Count >= 1)
  242. {
  243. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsTop(selectedCards, activateClass));
  244. added = true;
  245. }
  246. }
  247. if (added)
  248. {
  249. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotAttack(
  250. targetPermanent: card.PermanentOfThisCard(),
  251. defenderCondition: null,
  252. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  253. activateClass: activateClass,
  254. effectName: "Can't Attack"));
  255. if (CardEffectCommons.IsExistOnBattleArea(card))
  256. {
  257. Permanent selectedPermanent = card.PermanentOfThisCard();
  258. if (selectedPermanent != null)
  259. {
  260. CanNotAffectedClass canNotAffectedClass = new CanNotAffectedClass();
  261. canNotAffectedClass.SetUpICardEffect("Isn't affected by opponent's effect", CanUseCondition1, card);
  262. canNotAffectedClass.SetUpCanNotAffectedClass(CardCondition: CardCondition, SkillCondition: SkillCondition);
  263. selectedPermanent.UntilOpponentTurnEndEffects.Add((_timing) => canNotAffectedClass);
  264. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateBuffEffect(selectedPermanent));
  265. bool CanUseCondition1(Hashtable hashtable)
  266. {
  267. if (selectedPermanent.TopCard != null)
  268. {
  269. return true;
  270. }
  271. return false;
  272. }
  273. bool CardCondition(CardSource cardSource)
  274. {
  275. if (selectedPermanent.TopCard != null)
  276. {
  277. if (selectedPermanent.TopCard.Owner.GetBattleAreaPermanents().Contains(selectedPermanent))
  278. {
  279. if (cardSource == selectedPermanent.TopCard)
  280. {
  281. return true;
  282. }
  283. }
  284. }
  285. return false;
  286. }
  287. bool SkillCondition(ICardEffect cardEffect)
  288. {
  289. if (cardEffect != null)
  290. {
  291. if (cardEffect.EffectSourceCard != null)
  292. {
  293. if (cardEffect.EffectSourceCard.Owner == card.Owner.Enemy)
  294. {
  295. return true;
  296. }
  297. }
  298. }
  299. return false;
  300. }
  301. }
  302. }
  303. }
  304. }
  305. }
  306. }
  307. #endregion
  308. #region Opponent's Turn - OPT
  309. if (timing == EffectTiming.OnTappedAnyone)
  310. {
  311. ActivateClass activateClass = new ActivateClass();
  312. activateClass.SetUpICardEffect("Trash 2, Suspend 2", CanUseCondition, card);
  313. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  314. activateClass.SetHashString("AT_EX10-021");
  315. cardEffects.Add(activateClass);
  316. string EffectDiscription()
  317. {
  318. return "[Opponent's Turn] [Once Per Turn] When any of your opponent's Digimon suspend, by trashing 2 cards in your hand, suspend 2 of their Digimon or Tamers.";
  319. }
  320. bool CanUseCondition(Hashtable hashtable)
  321. {
  322. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  323. CardEffectCommons.IsOpponentTurn(card) &&
  324. CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, OpponentsDigimon);
  325. }
  326. bool CanActivateCondition(Hashtable hashtable)
  327. {
  328. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  329. card.Owner.HandCards.Count >= 2;
  330. }
  331. bool OpponentsDigimon(Permanent permanent)
  332. {
  333. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  334. }
  335. bool CanSelectPermanentCondition(Permanent permanent)
  336. {
  337. return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card) &&
  338. (permanent.IsDigimon || permanent.IsTamer);
  339. }
  340. IEnumerator ActivateCoroutine(Hashtable hashtable)
  341. {
  342. int discardCount = 2;
  343. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  344. selectHandEffect.SetUp(
  345. selectPlayer: card.Owner,
  346. canTargetCondition: (cardSource) => true,
  347. canTargetCondition_ByPreSelecetedList: null,
  348. canEndSelectCondition: null,
  349. maxCount: discardCount,
  350. canNoSelect: false,
  351. canEndNotMax: false,
  352. isShowOpponent: true,
  353. selectCardCoroutine: null,
  354. afterSelectCardCoroutine: null,
  355. mode: SelectHandEffect.Mode.Discard,
  356. cardEffect: activateClass);
  357. yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
  358. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  359. {
  360. int maxCount = Math.Min(2, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  361. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  362. selectPermanentEffect.SetUp(
  363. selectPlayer: card.Owner,
  364. canTargetCondition: CanSelectPermanentCondition,
  365. canTargetCondition_ByPreSelecetedList: null,
  366. canEndSelectCondition: null,
  367. maxCount: maxCount,
  368. canNoSelect: false,
  369. canEndNotMax: false,
  370. selectPermanentCoroutine: null,
  371. afterSelectPermanentCoroutine: null,
  372. mode: SelectPermanentEffect.Mode.Tap,
  373. cardEffect: activateClass);
  374. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  375. }
  376. }
  377. }
  378. #endregion
  379. return cardEffects;
  380. }
  381. }
  382. }