LM_001.cs 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.LM
  5. {
  6. public class LM_001 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. //Alternate Digivolution Requirement
  12. if (timing == EffectTiming.None)
  13. {
  14. static bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.HasText("Gammamon") && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 5;
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 4, ignoreDigivolutionRequirement: false, card: card, condition: null));
  19. }
  20. //Blast Digivolve
  21. if (timing == EffectTiming.OnCounterTiming)
  22. {
  23. cardEffects.Add(CardEffectFactory.BlastDigivolveEffect(card: card, condition: null));
  24. }
  25. #region On Play
  26. if (timing == EffectTiming.OnEnterFieldAnyone)
  27. {
  28. ActivateClass activateClass = new ActivateClass();
  29. activateClass.SetUpICardEffect("Place a Card from hand to digivolution cards to get effects", CanUseCondition, card);
  30. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  31. cardEffects.Add(activateClass);
  32. string EffectDiscription()
  33. {
  34. return "[On Play] You may place 1 card with [Gammamon] in its text from your hand as this Digimon's bottom digivolution card. Then, delete 1 of your opponent's Digimon with 8000 DP or less. For each color in this Digimon's digivolution cards, add 1000 to this DP deletion effect's maximum.";
  35. }
  36. bool CanSelectCardCondition(CardSource cardSource)
  37. {
  38. return cardSource.HasText("Gammamon");
  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.Owner.HandCards.Count >= 1)
  49. {
  50. return true;
  51. }
  52. }
  53. return false;
  54. }
  55. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  56. {
  57. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  58. {
  59. List<CardSource> selectedCards = new List<CardSource>();
  60. int maxCount = 1;
  61. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  62. selectHandEffect.SetUp(
  63. selectPlayer: card.Owner,
  64. canTargetCondition: CanSelectCardCondition,
  65. canTargetCondition_ByPreSelecetedList: null,
  66. canEndSelectCondition: null,
  67. maxCount: maxCount,
  68. canNoSelect: true,
  69. canEndNotMax: false,
  70. isShowOpponent: true,
  71. selectCardCoroutine: SelectCardCoroutine,
  72. afterSelectCardCoroutine: null,
  73. mode: SelectHandEffect.Mode.Custom,
  74. cardEffect: activateClass);
  75. selectHandEffect.SetUpCustomMessage("Select 1 card to place on bottom of digivolution cards.", "The opponent is selecting 1 card to place on bottom of digivolution cards.");
  76. yield return StartCoroutine(selectHandEffect.Activate());
  77. IEnumerator SelectCardCoroutine(CardSource cardSource)
  78. {
  79. selectedCards.Add(cardSource);
  80. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(selectedCards, activateClass));
  81. }
  82. }
  83. #region Then, Delete 1 of your opponent's Digimon with 8000 DP or less.
  84. int MaxDP()
  85. {
  86. int DP = 8000;
  87. List<CardColor> cardColors = new List<CardColor>();
  88. foreach (CardSource source in card.PermanentOfThisCard().cardSources)
  89. {
  90. foreach (CardColor cardColor in source.CardColors)
  91. {
  92. if (!cardColors.Contains(cardColor))
  93. cardColors.Add(cardColor);
  94. }
  95. }
  96. cardColors = cardColors.Distinct().ToList();
  97. DP += cardColors.Count * 1000;
  98. return DP;
  99. }
  100. bool CanSelectPermanentCondition(Permanent permanent)
  101. {
  102. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  103. {
  104. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(MaxDP(), activateClass))
  105. {
  106. return true;
  107. }
  108. }
  109. return false;
  110. }
  111. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  112. {
  113. int maxDeleteCount = System.Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  114. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  115. selectPermanentEffect.SetUp(
  116. selectPlayer: card.Owner,
  117. canTargetCondition: CanSelectPermanentCondition,
  118. canTargetCondition_ByPreSelecetedList: null,
  119. canEndSelectCondition: null,
  120. maxCount: maxDeleteCount,
  121. canNoSelect: false,
  122. canEndNotMax: false,
  123. selectPermanentCoroutine: null,
  124. afterSelectPermanentCoroutine: null,
  125. mode: SelectPermanentEffect.Mode.Destroy,
  126. cardEffect: activateClass);
  127. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  128. }
  129. #endregion
  130. }
  131. }
  132. #endregion
  133. #region When Digivolving
  134. if (timing == EffectTiming.OnEnterFieldAnyone)
  135. {
  136. ActivateClass activateClass = new ActivateClass();
  137. activateClass.SetUpICardEffect("Place a Card from hand to digivolution cards to get effects", CanUseCondition, card);
  138. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  139. cardEffects.Add(activateClass);
  140. string EffectDiscription()
  141. {
  142. return "[When Digivolving] You may place 1 card with [Gammamon] in its text from your hand as this Digimon's bottom digivolution card. Then, delete 1 of your opponent's Digimon with 8000 DP or less. For each color in this Digimon's digivolution cards, add 1000 to this DP deletion effect's maximum.";
  143. }
  144. bool CanSelectCardCondition(CardSource cardSource)
  145. {
  146. return cardSource.HasText("Gammamon");
  147. }
  148. bool CanUseCondition(Hashtable hashtable)
  149. {
  150. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  151. }
  152. bool CanActivateCondition(Hashtable hashtable)
  153. {
  154. if (CardEffectCommons.IsExistOnBattleArea(card))
  155. {
  156. if (card.Owner.HandCards.Count >= 1)
  157. {
  158. return true;
  159. }
  160. }
  161. return false;
  162. }
  163. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  164. {
  165. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  166. {
  167. List<CardSource> selectedCards = new List<CardSource>();
  168. int maxCount = 1;
  169. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  170. selectHandEffect.SetUp(
  171. selectPlayer: card.Owner,
  172. canTargetCondition: CanSelectCardCondition,
  173. canTargetCondition_ByPreSelecetedList: null,
  174. canEndSelectCondition: null,
  175. maxCount: maxCount,
  176. canNoSelect: true,
  177. canEndNotMax: false,
  178. isShowOpponent: true,
  179. selectCardCoroutine: SelectCardCoroutine,
  180. afterSelectCardCoroutine: null,
  181. mode: SelectHandEffect.Mode.Custom,
  182. cardEffect: activateClass);
  183. selectHandEffect.SetUpCustomMessage("Select 1 card to place on bottom of digivolution cards.", "The opponent is selecting 1 card to place on bottom of digivolution cards.");
  184. yield return StartCoroutine(selectHandEffect.Activate());
  185. IEnumerator SelectCardCoroutine(CardSource cardSource)
  186. {
  187. selectedCards.Add(cardSource);
  188. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(selectedCards, activateClass));
  189. }
  190. }
  191. #region Then, Delete 1 of your opponent's Digimon with 8000 DP or less.
  192. int MaxDP()
  193. {
  194. int DP = 8000;
  195. List<CardColor> cardColors = new List<CardColor>();
  196. foreach (CardSource source in card.PermanentOfThisCard().cardSources)
  197. {
  198. foreach (CardColor cardColor in source.CardColors)
  199. {
  200. if (!cardColors.Contains(cardColor))
  201. cardColors.Add(cardColor);
  202. }
  203. }
  204. cardColors = cardColors.Distinct().ToList();
  205. DP += cardColors.Count * 1000;
  206. return DP;
  207. }
  208. bool CanSelectPermanentCondition(Permanent permanent)
  209. {
  210. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  211. {
  212. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(MaxDP(), activateClass))
  213. {
  214. return true;
  215. }
  216. }
  217. return false;
  218. }
  219. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  220. {
  221. int maxDeleteCount = System.Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  222. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  223. selectPermanentEffect.SetUp(
  224. selectPlayer: card.Owner,
  225. canTargetCondition: CanSelectPermanentCondition,
  226. canTargetCondition_ByPreSelecetedList: null,
  227. canEndSelectCondition: null,
  228. maxCount: maxDeleteCount,
  229. canNoSelect: false,
  230. canEndNotMax: false,
  231. selectPermanentCoroutine: null,
  232. afterSelectPermanentCoroutine: null,
  233. mode: SelectPermanentEffect.Mode.Destroy,
  234. cardEffect: activateClass);
  235. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  236. }
  237. #endregion
  238. }
  239. }
  240. #endregion
  241. #region All Turns
  242. if (timing == EffectTiming.OnDestroyedAnyone)
  243. {
  244. ActivateClass activateClass = new ActivateClass();
  245. activateClass.SetUpICardEffect("Gain Memory", CanUseCondition, card);
  246. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  247. activateClass.SetHashString("AllTurn_LM_001");
  248. cardEffects.Add(activateClass);
  249. string EffectDiscription()
  250. {
  251. return "[All Turns] [Once Per Turn] When another Digimon is deleted, gain 1 memory.";
  252. }
  253. bool PermanentCondition(Permanent permanent)
  254. {
  255. if (CardEffectCommons.IsPermanentExistsOnBattleArea(permanent))
  256. {
  257. if (permanent.IsDigimon)
  258. {
  259. if (permanent != card.PermanentOfThisCard())
  260. {
  261. return true;
  262. }
  263. }
  264. }
  265. return false;
  266. }
  267. bool CanUseCondition(Hashtable hashtable)
  268. {
  269. if (CardEffectCommons.IsExistOnBattleArea(card))
  270. {
  271. if (CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable, PermanentCondition))
  272. {
  273. return true;
  274. }
  275. }
  276. return false;
  277. }
  278. bool CanActivateCondition(Hashtable hashtable)
  279. {
  280. if (CardEffectCommons.IsExistOnBattleArea(card))
  281. {
  282. if (card.Owner.CanAddMemory(activateClass))
  283. {
  284. List<Hashtable> hashtables = CardEffectCommons.GetHashtablesFromHashtable(hashtable);
  285. if (hashtables != null)
  286. {
  287. if (hashtables.Count >= 1)
  288. {
  289. return true;
  290. }
  291. }
  292. }
  293. }
  294. return false;
  295. }
  296. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  297. {
  298. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  299. }
  300. }
  301. #endregion
  302. return cardEffects;
  303. }
  304. }
  305. }