BT10_066.cs 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System.Linq;
  5. using Photon;
  6. using System;
  7. using Photon.Pun;
  8. namespace DCGO.CardEffects.BT10
  9. {
  10. public class BT10_066 : CEntity_Effect
  11. {
  12. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  13. {
  14. List<ICardEffect> cardEffects = new List<ICardEffect>();
  15. if (timing == EffectTiming.OnEnterFieldAnyone)
  16. {
  17. ActivateClass activateClass = new ActivateClass();
  18. activateClass.SetUpICardEffect("De-Digivolve 1 to 1 Digimon and delete 1 Digimon with 5 or less Cost", CanUseCondition, card);
  19. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  20. cardEffects.Add(activateClass);
  21. string EffectDiscription()
  22. {
  23. return "[On Play] <De-Digivolve 1> 1 of your opponent's Digimon. Then, if DigiXrosing with 2 cards, delete 1 of your opponent's Digimon with a play cost of 5 or less.";
  24. }
  25. bool CanSelectPermanentCondition(Permanent permanent)
  26. {
  27. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  28. }
  29. bool CanSelectPermanentCondition1(Permanent permanent)
  30. {
  31. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  32. {
  33. if (permanent.TopCard.GetCostItself <= 5)
  34. {
  35. if (permanent.TopCard.HasPlayCost)
  36. {
  37. return true;
  38. }
  39. }
  40. }
  41. return false;
  42. }
  43. bool CanUseCondition(Hashtable hashtable)
  44. {
  45. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  46. }
  47. bool CanActivateCondition(Hashtable hashtable)
  48. {
  49. if (CardEffectCommons.IsExistOnBattleArea(card))
  50. {
  51. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  52. {
  53. return true;
  54. }
  55. }
  56. return false;
  57. }
  58. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  59. {
  60. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  61. {
  62. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  63. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  64. selectPermanentEffect.SetUp(
  65. selectPlayer: card.Owner,
  66. canTargetCondition: CanSelectPermanentCondition,
  67. canTargetCondition_ByPreSelecetedList: null,
  68. canEndSelectCondition: null,
  69. maxCount: maxCount,
  70. canNoSelect: false,
  71. canEndNotMax: false,
  72. selectPermanentCoroutine: SelectPermanentCoroutine,
  73. afterSelectPermanentCoroutine: null,
  74. mode: SelectPermanentEffect.Mode.Custom,
  75. cardEffect: activateClass);
  76. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to De-Digivolve.", "The opponent is selecting 1 Digimon to De-Digivolve.");
  77. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  78. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  79. {
  80. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(permanent, 1, activateClass).Degeneration());
  81. }
  82. }
  83. if (CardEffectCommons.IsDijiXros(_hashtable, card, (count) => count == 2))
  84. {
  85. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  86. {
  87. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  88. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  89. selectPermanentEffect.SetUp(
  90. selectPlayer: card.Owner,
  91. canTargetCondition: CanSelectPermanentCondition1,
  92. canTargetCondition_ByPreSelecetedList: null,
  93. canEndSelectCondition: null,
  94. maxCount: maxCount,
  95. canNoSelect: false,
  96. canEndNotMax: false,
  97. selectPermanentCoroutine: null,
  98. afterSelectPermanentCoroutine: null,
  99. mode: SelectPermanentEffect.Mode.Destroy,
  100. cardEffect: activateClass);
  101. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  102. }
  103. }
  104. }
  105. }
  106. if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
  107. {
  108. ActivateClass activateClass = new ActivateClass();
  109. activateClass.SetUpICardEffect("Return 1 digivolution card to play a Digimon from digivolution cards", CanUseCondition, card);
  110. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  111. activateClass.SetHashString("PlayDigimon_BT10_066");
  112. cardEffects.Add(activateClass);
  113. string EffectDiscription()
  114. {
  115. return "[All Turns] When this Digimon would be deleted, by returning 1 black level 4 or lower Digimon card from this Digimon's digivolution cards to its owner's hand, you may play 1 [SkullKnightmon] or [DeadlyAxemon] from this Digimon's digivolution cards without paying its memory cost.";
  116. }
  117. bool CanSelectCardCondition(CardSource cardSource)
  118. {
  119. if (cardSource.IsDigimon)
  120. {
  121. if (cardSource.HasCardColor(CardColor.Black))
  122. {
  123. if (cardSource.Level <= 4)
  124. {
  125. if (cardSource.HasLevel)
  126. {
  127. return true;
  128. }
  129. }
  130. }
  131. }
  132. return false;
  133. }
  134. bool CanSelectCardCondition1(CardSource cardSource)
  135. {
  136. if (cardSource.IsDigimon)
  137. {
  138. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  139. {
  140. if (cardSource.CardNames.Contains("SkullKnightmon"))
  141. {
  142. return true;
  143. }
  144. if (cardSource.CardNames.Contains("DeadlyAxemon"))
  145. {
  146. return true;
  147. }
  148. }
  149. }
  150. return false;
  151. }
  152. bool CanUseCondition(Hashtable hashtable)
  153. {
  154. if (CardEffectCommons.IsExistOnBattleArea(card))
  155. {
  156. if (CardEffectCommons.CanTriggerWhenRemoveField(hashtable, card))
  157. {
  158. return true;
  159. }
  160. }
  161. return false;
  162. }
  163. bool CanActivateCondition(Hashtable hashtable)
  164. {
  165. if (CardEffectCommons.IsExistOnBattleArea(card))
  166. {
  167. if (card.PermanentOfThisCard().DigivolutionCards.Count(CanSelectCardCondition) >= 1)
  168. {
  169. return true;
  170. }
  171. }
  172. return false;
  173. }
  174. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  175. {
  176. if (CardEffectCommons.IsExistOnBattleArea(card))
  177. {
  178. Permanent selectedPermanent = card.PermanentOfThisCard();
  179. if (selectedPermanent.DigivolutionCards.Count(CanSelectCardCondition) >= 1)
  180. {
  181. int maxCount = Math.Min(1, selectedPermanent.DigivolutionCards.Count(CanSelectCardCondition));
  182. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  183. selectCardEffect.SetUp(
  184. canTargetCondition: CanSelectCardCondition,
  185. canTargetCondition_ByPreSelecetedList: null,
  186. canEndSelectCondition: null,
  187. canNoSelect: () => false,
  188. selectCardCoroutine: null,
  189. afterSelectCardCoroutine: null,
  190. message: "Select 1 card to add to your hand.",
  191. maxCount: maxCount,
  192. canEndNotMax: false,
  193. isShowOpponent: true,
  194. mode: SelectCardEffect.Mode.AddHand,
  195. root: SelectCardEffect.Root.Custom,
  196. customRootCardList: selectedPermanent.DigivolutionCards,
  197. canLookReverseCard: true,
  198. selectPlayer: card.Owner,
  199. cardEffect: activateClass);
  200. yield return StartCoroutine(selectCardEffect.Activate());
  201. if (selectedPermanent.DigivolutionCards.Count(CanSelectCardCondition1) >= 1)
  202. {
  203. maxCount = 1;
  204. List<CardSource> selectedCards = new List<CardSource>();
  205. selectCardEffect.SetUp(
  206. canTargetCondition: CanSelectCardCondition1,
  207. canTargetCondition_ByPreSelecetedList: null,
  208. canEndSelectCondition: null,
  209. canNoSelect: () => true,
  210. selectCardCoroutine: SelectCardCoroutine,
  211. afterSelectCardCoroutine: null,
  212. message: "Select 1 card to play.",
  213. maxCount: maxCount,
  214. canEndNotMax: false,
  215. isShowOpponent: true,
  216. mode: SelectCardEffect.Mode.Custom,
  217. root: SelectCardEffect.Root.Custom,
  218. customRootCardList: selectedPermanent.DigivolutionCards,
  219. canLookReverseCard: true,
  220. selectPlayer: card.Owner,
  221. cardEffect: activateClass);
  222. selectCardEffect.SetUpCustomMessage("Select 1 digivolution card to play.",
  223. "The opponent is selecting 1 digivolution card to play.");
  224. selectCardEffect.SetUpCustomMessage_ShowCard("Played Card");
  225. yield return StartCoroutine(selectCardEffect.Activate());
  226. IEnumerator SelectCardCoroutine(CardSource cardSource)
  227. {
  228. selectedCards.Add(cardSource);
  229. yield return null;
  230. }
  231. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  232. cardSources: selectedCards,
  233. activateClass: activateClass,
  234. payCost: false,
  235. isTapped: false,
  236. root: SelectCardEffect.Root.DigivolutionCards,
  237. activateETB: true));
  238. }
  239. }
  240. }
  241. }
  242. }
  243. if (timing == EffectTiming.None)
  244. {
  245. AddDigiXrosConditionClass addDigiXrosConditionClass = new AddDigiXrosConditionClass();
  246. addDigiXrosConditionClass.SetUpICardEffect($"DigiXros", CanUseCondition, card);
  247. addDigiXrosConditionClass.SetUpAddDigiXrosConditionClass(getDigiXrosCondition: GetDigiXros);
  248. addDigiXrosConditionClass.SetNotShowUI(true);
  249. cardEffects.Add(addDigiXrosConditionClass);
  250. bool CanUseCondition(Hashtable hashtable)
  251. {
  252. return true;
  253. }
  254. DigiXrosCondition GetDigiXros(CardSource cardSource)
  255. {
  256. if (cardSource == card)
  257. {
  258. DigiXrosConditionElement element = new DigiXrosConditionElement(CanSelectCardCondition, "SkullKnightmon");
  259. bool CanSelectCardCondition(CardSource cardSource)
  260. {
  261. if (cardSource != null)
  262. {
  263. if (cardSource.Owner == card.Owner)
  264. {
  265. if (cardSource.IsDigimon)
  266. {
  267. if (cardSource.CardNames_DigiXros.Contains("SkullKnightmon"))
  268. {
  269. return true;
  270. }
  271. }
  272. }
  273. }
  274. return false;
  275. }
  276. DigiXrosConditionElement element1 = new DigiXrosConditionElement(CanSelectCardCondition1, "DeadlyAxemon");
  277. bool CanSelectCardCondition1(CardSource cardSource)
  278. {
  279. if (cardSource != null)
  280. {
  281. if (cardSource.Owner == card.Owner)
  282. {
  283. if (cardSource.IsDigimon)
  284. {
  285. if (cardSource.CardNames_DigiXros.Contains("DeadlyAxemon"))
  286. {
  287. return true;
  288. }
  289. }
  290. }
  291. }
  292. return false;
  293. }
  294. List<DigiXrosConditionElement> elements = new List<DigiXrosConditionElement>() { element, element1 };
  295. DigiXrosCondition digiXrosCondition = new DigiXrosCondition(elements, null, 2);
  296. return digiXrosCondition;
  297. }
  298. return null;
  299. }
  300. }
  301. return cardEffects;
  302. }
  303. }
  304. }