BT11_106.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT11
  4. {
  5. public class BT11_106 : 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. ChangeCostClass changeCostClass = new ChangeCostClass();
  13. changeCostClass.SetUpICardEffect($"Play Cost -1", CanUseCondition, card);
  14. changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
  15. cardEffects.Add(changeCostClass);
  16. bool CanUseCondition(Hashtable hashtable)
  17. {
  18. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.TopCard.CardColors.Contains(CardColor.Black) && permanent.IsTamer))
  19. {
  20. return true;
  21. }
  22. return false;
  23. }
  24. int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
  25. {
  26. if (CardSourceCondition(cardSource))
  27. {
  28. if (RootCondition(root))
  29. {
  30. if (PermanentsCondition(targetPermanents))
  31. {
  32. Cost -= 1;
  33. }
  34. }
  35. }
  36. return Cost;
  37. }
  38. bool PermanentsCondition(List<Permanent> targetPermanents)
  39. {
  40. return true;
  41. }
  42. bool CardSourceCondition(CardSource cardSource)
  43. {
  44. return cardSource == card;
  45. }
  46. bool RootCondition(SelectCardEffect.Root root)
  47. {
  48. return true;
  49. }
  50. bool isUpDown()
  51. {
  52. return true;
  53. }
  54. }
  55. if (timing == EffectTiming.OptionSkill)
  56. {
  57. ActivateClass activateClass = new ActivateClass();
  58. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  59. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  60. cardEffects.Add(activateClass);
  61. string EffectDiscription()
  62. {
  63. return "[Main] Until the end of your opponent's turn, 1 of your Digimon with [Numemon], [Sukamon], [Nanimon], or [Etemon] in its name can't be blocked and gains \"[On Deletion] Gain 3 memory.\"";
  64. }
  65. bool CanSelectPermanentCondition(Permanent permanent)
  66. {
  67. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  68. {
  69. if (permanent.TopCard.ContainsCardName("Numemon"))
  70. {
  71. return true;
  72. }
  73. if (permanent.TopCard.ContainsCardName("Sukamon"))
  74. {
  75. return true;
  76. }
  77. if (permanent.TopCard.ContainsCardName("Nanimon"))
  78. {
  79. return true;
  80. }
  81. if (permanent.TopCard.ContainsCardName("Etemon"))
  82. {
  83. return true;
  84. }
  85. }
  86. return false;
  87. }
  88. bool CanUseCondition(Hashtable hashtable)
  89. {
  90. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  91. }
  92. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  93. {
  94. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  95. {
  96. int maxCount = 1;
  97. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  98. selectPermanentEffect.SetUp(
  99. selectPlayer: card.Owner,
  100. canTargetCondition: CanSelectPermanentCondition,
  101. canTargetCondition_ByPreSelecetedList: null,
  102. canEndSelectCondition: null,
  103. maxCount: maxCount,
  104. canNoSelect: false,
  105. canEndNotMax: false,
  106. selectPermanentCoroutine: SelectPermanentCoroutine,
  107. afterSelectPermanentCoroutine: null,
  108. mode: SelectPermanentEffect.Mode.Custom,
  109. cardEffect: activateClass);
  110. selectPermanentEffect.SetUpCustomMessage(
  111. "Select 1 Digimon that will get effects.",
  112. "The opponent is selecting 1 Digimon that will get effects.");
  113. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  114. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  115. {
  116. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotBeBlocked(
  117. targetPermanent: permanent,
  118. defenderCondition: null,
  119. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  120. activateClass: activateClass,
  121. effectName: "Unblockable"));
  122. Permanent selectedPermanent = permanent;
  123. if (selectedPermanent != null)
  124. {
  125. CardSource _topCard = selectedPermanent.TopCard;
  126. ActivateClass activateClass1 = new ActivateClass();
  127. activateClass1.SetUpICardEffect("Memory +3", CanUseCondition1, selectedPermanent.TopCard);
  128. activateClass1.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine1, -1, false, EffectDiscription1());
  129. activateClass1.SetEffectSourcePermanent(selectedPermanent);
  130. CardEffectCommons.AddEffectToPermanent(targetPermanent: selectedPermanent, effectDuration: EffectDuration.UntilOpponentTurnEnd, card: card, cardEffect: activateClass1, timing: EffectTiming.OnDestroyedAnyone);
  131. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateBuffEffect(selectedPermanent));
  132. string EffectDiscription1()
  133. {
  134. return "[On Deletion] Gain 3 memory.";
  135. }
  136. bool CanUseCondition1(Hashtable hashtable1)
  137. {
  138. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  139. {
  140. if (CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable1, (permanent) => permanent == selectedPermanent, activateClass))
  141. {
  142. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  143. {
  144. return true;
  145. }
  146. }
  147. }
  148. return false;
  149. }
  150. bool CanActivateCondition1(Hashtable hashtable1)
  151. {
  152. if (CardEffectCommons.IsTopCardInTrashOnDeletion(hashtable1))
  153. {
  154. if (_topCard.Owner.CanAddMemory(activateClass1))
  155. {
  156. return true;
  157. }
  158. }
  159. return false;
  160. }
  161. IEnumerator ActivateCoroutine1(Hashtable _hashtable1)
  162. {
  163. yield return ContinuousController.instance.StartCoroutine(_topCard.Owner.AddMemory(3, activateClass1));
  164. }
  165. }
  166. }
  167. }
  168. }
  169. }
  170. if (timing == EffectTiming.SecuritySkill)
  171. {
  172. ActivateClass activateClass = new ActivateClass();
  173. activateClass.SetUpICardEffect($"Reveal the top 3 cards of deck", CanUseCondition, card);
  174. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  175. activateClass.SetIsSecurityEffect(true);
  176. cardEffects.Add(activateClass);
  177. string EffectDiscription()
  178. {
  179. return "[Security] Reveal the top 3 cards of your deck. You may play 1 black Digimon card with a play cost of 3 or less among them without paying the cost. Trash the rest.";
  180. }
  181. bool CanSelectCardCondition(CardSource cardSource)
  182. {
  183. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  184. {
  185. if (cardSource.GetCostItself <= 3)
  186. {
  187. if (cardSource.HasPlayCost)
  188. {
  189. if (cardSource.IsDigimon)
  190. {
  191. if (cardSource.HasCardColor(CardColor.Black))
  192. {
  193. return true;
  194. }
  195. }
  196. }
  197. }
  198. }
  199. return false;
  200. }
  201. bool CanUseCondition(Hashtable hashtable)
  202. {
  203. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  204. }
  205. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  206. {
  207. List<CardSource> selectedCards = new List<CardSource>();
  208. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  209. revealCount: 3,
  210. simplifiedSelectCardConditions:
  211. new SimplifiedSelectCardConditionClass[]
  212. {
  213. new SimplifiedSelectCardConditionClass(
  214. canTargetCondition:CanSelectCardCondition,
  215. message: "Select 1 black Digimon card with a play cost of 3 or less.",
  216. mode: SelectCardEffect.Mode.Custom,
  217. maxCount: 1,
  218. selectCardCoroutine: SelectCardCoroutine),
  219. },
  220. remainingCardsPlace: RemainingCardsPlace.Trash,
  221. activateClass: activateClass,
  222. canNoSelect: true
  223. ));
  224. IEnumerator SelectCardCoroutine(CardSource cardSource)
  225. {
  226. selectedCards.Add(cardSource);
  227. yield return null;
  228. }
  229. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  230. cardSources: selectedCards,
  231. activateClass: activateClass,
  232. payCost: false, isTapped: false,
  233. root: SelectCardEffect.Root.Library,
  234. activateETB: true));
  235. }
  236. }
  237. return cardEffects;
  238. }
  239. }
  240. }