BT17_101.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System;
  4. using System.Linq;
  5. using UnityEngine;
  6. using Photon.Pun;
  7. namespace DCGO.CardEffects.BT17
  8. {
  9. public class BT17_101 : CEntity_Effect
  10. {
  11. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  12. {
  13. List<ICardEffect> cardEffects = new List<ICardEffect>();
  14. #region DNA Digivolution
  15. if (timing == EffectTiming.None)
  16. {
  17. AddJogressConditionClass addJogressConditionClass = new AddJogressConditionClass();
  18. addJogressConditionClass.SetUpICardEffect($"DNA Digivolution", CanUseCondition, card);
  19. addJogressConditionClass.SetUpAddJogressConditionClass(getJogressCondition: GetJogress);
  20. addJogressConditionClass.SetNotShowUI(true);
  21. cardEffects.Add(addJogressConditionClass);
  22. bool CanUseCondition(Hashtable hashtable)
  23. {
  24. return true;
  25. }
  26. JogressCondition GetJogress(CardSource cardSource)
  27. {
  28. if (cardSource == card)
  29. {
  30. bool PermanentCondition1(Permanent permanent)
  31. {
  32. if (permanent != null)
  33. {
  34. if (permanent.TopCard != null)
  35. {
  36. if (permanent.TopCard.Owner == card.Owner)
  37. {
  38. if (permanent.IsDigimon)
  39. {
  40. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent,
  41. card))
  42. {
  43. if (permanent.TopCard.EqualsCardName("Fenriloogamon"))
  44. {
  45. return true;
  46. }
  47. }
  48. }
  49. }
  50. }
  51. }
  52. return false;
  53. }
  54. bool PermanentCondition2(Permanent permanent)
  55. {
  56. if (permanent != null)
  57. {
  58. if (permanent.TopCard != null)
  59. {
  60. if (permanent.TopCard.Owner == card.Owner)
  61. {
  62. if (permanent.IsDigimon)
  63. {
  64. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent,
  65. card))
  66. {
  67. if (permanent.TopCard.EqualsCardName("Kazuchimon"))
  68. {
  69. return true;
  70. }
  71. }
  72. }
  73. }
  74. }
  75. }
  76. return false;
  77. }
  78. JogressConditionElement[] elements =
  79. {
  80. new(PermanentCondition1, "Fenriloogamon"),
  81. new(PermanentCondition2, "Kazuchimon")
  82. };
  83. JogressCondition jogressCondition = new JogressCondition(elements, 0);
  84. return jogressCondition;
  85. }
  86. return null;
  87. }
  88. }
  89. #endregion
  90. #region Trash - Your Turn
  91. if (timing == EffectTiming.OnEnterFieldAnyone)
  92. {
  93. ActivateClass activateClass = new ActivateClass();
  94. activateClass.SetUpICardEffect("DNA Digivolve", CanUseCondition, card);
  95. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true,
  96. EffectDescription());
  97. cardEffects.Add(activateClass);
  98. string EffectDescription()
  99. {
  100. return
  101. "[All Turns] When one of your level 6 Digimon with [Pulsemon] in its text is played, 2 of your Digimon may DNA digivolve into this card.";
  102. }
  103. bool PermanentCondition(Permanent permanent)
  104. {
  105. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  106. permanent.IsDigimon &&
  107. permanent.TopCard.HasLevel &&
  108. permanent.Level == 6 &&
  109. permanent.TopCard.HasText("Pulsemon");
  110. }
  111. bool CanUseCondition(Hashtable hashtable)
  112. {
  113. return CardEffectCommons.IsExistOnTrash(card) &&
  114. CardEffectCommons.IsOwnerTurn(card) &&
  115. CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentCondition);
  116. }
  117. bool CanActivateCondition(Hashtable hashtable)
  118. {
  119. return CardEffectCommons.IsExistOnTrash(card);
  120. }
  121. IEnumerator ActivateCoroutine(Hashtable hashtable)
  122. {
  123. if (card.CanPlayJogress(true))
  124. {
  125. yield return ContinuousController.instance.StartCoroutine(
  126. CardEffectCommons.DNADigivolvePermanentsIntoHandOrTrashCard(
  127. null,
  128. payCost: true,
  129. isHand: false,
  130. activateClass,
  131. ignoreSelection: true
  132. ));
  133. }
  134. }
  135. }
  136. #endregion
  137. #region When Digivolving
  138. if (timing == EffectTiming.OnEnterFieldAnyone)
  139. {
  140. ActivateClass activateClass = new ActivateClass();
  141. activateClass.SetUpICardEffect(
  142. "1 of your opponent's Digimon gets -16000 DP for the turn. If DNA Digivolving set opponent's memory to 3. Then, gain 1 memory and <Recovery +1>",
  143. CanUseCondition, card);
  144. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false,
  145. EffectDescription());
  146. cardEffects.Add(activateClass);
  147. string EffectDescription()
  148. {
  149. return
  150. "[When Digivolving] 1 of your opponent's Digimon gets -16000 DP for the turn. If DNA digivolving, you may set the memory to 3 on your opponent's side. Then, if this Digimon has a Tamer in its digivolution cards, gain 1 memory and ";
  151. }
  152. bool CanUseCondition(Hashtable hashtable)
  153. {
  154. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  155. }
  156. bool CanSelectOpponentPermanentCondition(Permanent permanent)
  157. {
  158. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  159. }
  160. bool CanActivateCondition(Hashtable hashtable)
  161. {
  162. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  163. }
  164. IEnumerator ActivateCoroutine(Hashtable hashtable)
  165. {
  166. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentPermanentCondition))
  167. {
  168. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectOpponentPermanentCondition));
  169. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  170. selectPermanentEffect.SetUp(
  171. selectPlayer: card.Owner,
  172. canTargetCondition: CanSelectOpponentPermanentCondition,
  173. canTargetCondition_ByPreSelecetedList: null,
  174. canEndSelectCondition: null,
  175. maxCount: maxCount,
  176. canNoSelect: false,
  177. canEndNotMax: false,
  178. selectPermanentCoroutine: SelectPermanentCoroutine,
  179. afterSelectPermanentCoroutine: null,
  180. mode: SelectPermanentEffect.Mode.Custom,
  181. cardEffect: activateClass);
  182. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -16000.",
  183. "The opponent is selecting 1 Digimon that will get DP -16000.");
  184. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  185. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  186. {
  187. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  188. targetPermanent: permanent, changeValue: -16000, effectDuration: EffectDuration.UntilEachTurnEnd,
  189. activateClass: activateClass));
  190. }
  191. }
  192. if (CardEffectCommons.IsJogress(hashtable))
  193. {
  194. List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>
  195. {
  196. new(message: "Yes", value: true, spriteIndex: 0),
  197. new(message: "No", value: false, spriteIndex: 1),
  198. };
  199. string selectPlayerMessage = "Set opponent's memory to 3?";
  200. string notSelectPlayerMessage = "The opponent is choosing whether to set your memory to 3 or not";
  201. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements,
  202. selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage,
  203. notSelectPlayerMessage: notSelectPlayerMessage);
  204. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager
  205. .WaitForEndSelect());
  206. bool setMemory = GManager.instance.userSelectionManager.SelectedBoolValue;
  207. if (setMemory)
  208. yield return ContinuousController.instance.StartCoroutine(card.Owner.Enemy.SetFixedMemory(3, activateClass));
  209. }
  210. if (card.PermanentOfThisCard().DigivolutionCards.Some(cardSource => cardSource.IsTamer))
  211. {
  212. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  213. yield return ContinuousController.instance.StartCoroutine(new IRecovery(card.Owner, 1, activateClass).Recovery());
  214. }
  215. }
  216. }
  217. #endregion
  218. #region When Attacking
  219. if (timing == EffectTiming.OnAllyAttack)
  220. {
  221. ActivateClass activateClass = new ActivateClass();
  222. activateClass.SetUpICardEffect("Trash 1 of your security to trash opponent's security", CanUseCondition, card);
  223. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  224. cardEffects.Add(activateClass);
  225. string EffectDescription()
  226. {
  227. return
  228. "[When Attacking] By trashing the top card of your security stack, trash the top card of your opponent's security stack.";
  229. }
  230. bool CanUseCondition(Hashtable hashtable)
  231. {
  232. if(CardEffectCommons.CanTriggerOnAttack(hashtable, card))
  233. return card.Owner.SecurityCards.Count >= 1;
  234. return false;
  235. }
  236. bool CanActivateCondition(Hashtable hashtable)
  237. {
  238. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  239. }
  240. IEnumerator ActivateCoroutine(Hashtable hashtable)
  241. {
  242. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  243. player: card.Owner,
  244. destroySecurityCount: 1,
  245. cardEffect: activateClass,
  246. fromTop: true).DestroySecurity());
  247. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  248. player: card.Owner.Enemy,
  249. destroySecurityCount: 1,
  250. cardEffect: activateClass,
  251. fromTop: true).DestroySecurity());
  252. }
  253. }
  254. #endregion
  255. return cardEffects;
  256. }
  257. }
  258. }