BT13_088.cs 21 KB

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