RB1_018.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System;
  5. public class RB1_018 : 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. if (targetPermanent.TopCard.ContainsCardName("Numemon"))
  15. {
  16. if (targetPermanent.TopCard.HasLevel)
  17. {
  18. if (targetPermanent.Level == 4)
  19. {
  20. return true;
  21. }
  22. }
  23. }
  24. return false;
  25. }
  26. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  27. permanentCondition: PermanentCondition,
  28. digivolutionCost: 3,
  29. ignoreDigivolutionRequirement: false,
  30. card: card,
  31. condition: null));
  32. }
  33. if (timing == EffectTiming.OnEnterFieldAnyone)
  34. {
  35. ActivateClass activateClass = new ActivateClass();
  36. activateClass.SetUpICardEffect("Place 1 card from trash to digivolution cards to gain Memory +2", CanUseCondition, card);
  37. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  38. cardEffects.Add(activateClass);
  39. string EffectDiscription()
  40. {
  41. return "[On Play] By placing 1 Digimon card with [Numemon] in its name from your trash as this Digimon's bottom digivolution card, gain 2 memory.";
  42. }
  43. bool CanSelectCardCondition(CardSource cardSource)
  44. {
  45. if (cardSource.IsDigimon)
  46. {
  47. if (cardSource.ContainsCardName("Numemon"))
  48. {
  49. return true;
  50. }
  51. }
  52. return false;
  53. }
  54. bool CanUseCondition(Hashtable hashtable)
  55. {
  56. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  57. }
  58. bool CanActivateCondition(Hashtable hashtable)
  59. {
  60. if (CardEffectCommons.IsExistOnBattleArea(card))
  61. {
  62. if (!card.PermanentOfThisCard().IsToken)
  63. {
  64. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  65. {
  66. return true;
  67. }
  68. }
  69. }
  70. return false;
  71. }
  72. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  73. {
  74. if (CardEffectCommons.IsExistOnBattleArea(card))
  75. {
  76. bool added = false;
  77. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  78. {
  79. List<CardSource> selectedCards = new List<CardSource>();
  80. int maxCount = 1;
  81. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  82. selectCardEffect.SetUp(
  83. canTargetCondition: CanSelectCardCondition,
  84. canTargetCondition_ByPreSelecetedList: null,
  85. canEndSelectCondition: null,
  86. canNoSelect: () => true,
  87. selectCardCoroutine: SelectCardCoroutine,
  88. afterSelectCardCoroutine: null,
  89. message: "Select 1 card to place on bottom of digivolution cards.",
  90. maxCount: maxCount,
  91. canEndNotMax: false,
  92. isShowOpponent: true,
  93. mode: SelectCardEffect.Mode.Custom,
  94. root: SelectCardEffect.Root.Trash,
  95. customRootCardList: null,
  96. canLookReverseCard: true,
  97. selectPlayer: card.Owner,
  98. cardEffect: activateClass);
  99. selectCardEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  100. 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.");
  101. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  102. IEnumerator SelectCardCoroutine(CardSource cardSource)
  103. {
  104. selectedCards.Add(cardSource);
  105. yield return null;
  106. }
  107. if (selectedCards.Count >= 1)
  108. {
  109. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(
  110. selectedCards,
  111. activateClass));
  112. added = true;
  113. }
  114. }
  115. if (added)
  116. {
  117. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(2, activateClass));
  118. }
  119. }
  120. }
  121. }
  122. if (timing == EffectTiming.OnEnterFieldAnyone)
  123. {
  124. ActivateClass activateClass = new ActivateClass();
  125. activateClass.SetUpICardEffect("DP -3000 and Security Attack -1", canUseCondition, card);
  126. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  127. cardEffects.Add(activateClass);
  128. string EffectDiscription()
  129. {
  130. return "[On Play] on] 1 of your opponent's Digimon gets -3000 DP and gains <Security Attack -1> until the end of their turn.";
  131. }
  132. bool CanSelectPermanentCondition(Permanent permanent)
  133. {
  134. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  135. }
  136. bool canUseCondition(Hashtable hashtable)
  137. {
  138. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  139. }
  140. bool CanActivateCondition(Hashtable hashtable)
  141. {
  142. if (CardEffectCommons.IsExistOnBattleArea(card))
  143. {
  144. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  145. {
  146. return true;
  147. }
  148. }
  149. return false;
  150. }
  151. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  152. {
  153. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  154. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  155. selectPermanentEffect.SetUp(
  156. selectPlayer: card.Owner,
  157. canTargetCondition: CanSelectPermanentCondition,
  158. canTargetCondition_ByPreSelecetedList: null,
  159. canEndSelectCondition: null,
  160. maxCount: maxCount,
  161. canNoSelect: false,
  162. canEndNotMax: false,
  163. selectPermanentCoroutine: SelectPermanentCoroutine,
  164. afterSelectPermanentCoroutine: null,
  165. mode: SelectPermanentEffect.Mode.Custom,
  166. cardEffect: activateClass);
  167. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -3000 and Security Attack -1.", "The opponent is selecting 1 Digimon that will get DP -3000 and Security Attack -1.");
  168. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  169. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  170. {
  171. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -3000, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  172. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonSAttack(targetPermanent: permanent, changeValue: -1, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  173. }
  174. }
  175. }
  176. if (timing == EffectTiming.OnEnterFieldAnyone)
  177. {
  178. ActivateClass activateClass = new ActivateClass();
  179. activateClass.SetUpICardEffect("DP -3000 and Security Attack -1", canUseCondition, card);
  180. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  181. cardEffects.Add(activateClass);
  182. string EffectDiscription()
  183. {
  184. return "[When Digivolving] on] 1 of your opponent's Digimon gets -3000 DP and gains <Security Attack -1> until the end of their turn.";
  185. }
  186. bool CanSelectPermanentCondition(Permanent permanent)
  187. {
  188. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  189. }
  190. bool canUseCondition(Hashtable hashtable)
  191. {
  192. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  193. }
  194. bool CanActivateCondition(Hashtable hashtable)
  195. {
  196. if (CardEffectCommons.IsExistOnBattleArea(card))
  197. {
  198. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  199. {
  200. return true;
  201. }
  202. }
  203. return false;
  204. }
  205. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  206. {
  207. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  208. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  209. selectPermanentEffect.SetUp(
  210. selectPlayer: card.Owner,
  211. canTargetCondition: CanSelectPermanentCondition,
  212. canTargetCondition_ByPreSelecetedList: null,
  213. canEndSelectCondition: null,
  214. maxCount: maxCount,
  215. canNoSelect: false,
  216. canEndNotMax: false,
  217. selectPermanentCoroutine: SelectPermanentCoroutine,
  218. afterSelectPermanentCoroutine: null,
  219. mode: SelectPermanentEffect.Mode.Custom,
  220. cardEffect: activateClass);
  221. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -3000 and Security Attack -1.", "The opponent is selecting 1 Digimon that will get DP -3000 and Security Attack -1.");
  222. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  223. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  224. {
  225. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -3000, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  226. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonSAttack(targetPermanent: permanent, changeValue: -1, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  227. }
  228. }
  229. }
  230. if (timing == EffectTiming.None)
  231. {
  232. bool Condition()
  233. {
  234. if (CardEffectCommons.IsExistOnBattleArea(card))
  235. {
  236. if (CardEffectCommons.IsOwnerTurn(card))
  237. {
  238. if (card.PermanentOfThisCard().TopCard.ContainsCardName("Monzaemon"))
  239. {
  240. return true;
  241. }
  242. if (card.PermanentOfThisCard().TopCard.ContainsCardName("Numemon"))
  243. {
  244. return true;
  245. }
  246. }
  247. }
  248. return false;
  249. }
  250. cardEffects.Add(CardEffectFactory.ChangeSelfSAttackStaticEffect(changeValue: 1, isInheritedEffect: true, card: card, condition: Condition));
  251. }
  252. return cardEffects;
  253. }
  254. }