LM_039.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. //Valkyrimon
  5. namespace DCGO.CardEffects.LM
  6. {
  7. public class LM_039 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternate Digivolution
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.EqualsCardName("Silphymon");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(PermanentCondition, 3, false, card: card, condition: null));
  20. }
  21. #endregion
  22. #region When Digivolving
  23. if (timing == EffectTiming.OnEnterFieldAnyone)
  24. {
  25. ActivateClass activateClass = new ActivateClass();
  26. activateClass.SetUpICardEffect("<Blitz>", CanUseCondition, card);
  27. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  28. cardEffects.Add(activateClass);
  29. string EffectDiscription()
  30. {
  31. return "[When Digivolving] <Blitz> (If your opponent has 1 or more memory, this Digimon may attack).";
  32. }
  33. bool CanUseCondition(Hashtable hashtable)
  34. {
  35. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  36. {
  37. if (CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card))
  38. {
  39. return true;
  40. }
  41. }
  42. return false;
  43. }
  44. bool CanActivateCondition(Hashtable hashtable)
  45. {
  46. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  47. {
  48. if (CardEffectCommons.CanActivateBlitz(card, activateClass))
  49. {
  50. return true;
  51. }
  52. }
  53. return false;
  54. }
  55. IEnumerator ActivateCoroutine(Hashtable hashtable)
  56. {
  57. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.BlitzProcess(card, activateClass));
  58. }
  59. }
  60. #endregion
  61. #region When Digivolving OPT
  62. if (timing == EffectTiming.OnEnterFieldAnyone)
  63. {
  64. ActivateClass activateClass = new ActivateClass();
  65. activateClass.SetUpICardEffect("Bottom deck 1 digimon, if you didnt, Sec +1", CanUseCondition, card);
  66. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  67. activateClass.SetHashString("BottomDeck_LM_039");
  68. cardEffects.Add(activateClass);
  69. string EffectDiscription()
  70. {
  71. return "[When Digivolving] [Once Per Turn] Return 1 of your opponent's Digimon with 8000 DP or less to the bottom of the deck. If this effect didn't return, this Digimon gains <Security A. +1> (This Digimon checks 1 additional security card) for the turn.";
  72. }
  73. bool CanUseCondition(Hashtable hashtable)
  74. {
  75. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  76. {
  77. if (CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card))
  78. {
  79. return true;
  80. }
  81. }
  82. return false;
  83. }
  84. bool CanActivateCondition(Hashtable hashtable)
  85. {
  86. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  87. }
  88. bool CanSelectPermanentCondition(Permanent permanent)
  89. {
  90. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  91. {
  92. if (permanent.DP <= 8000)
  93. {
  94. return true;
  95. }
  96. }
  97. return false;
  98. }
  99. IEnumerator ActivateCoroutine(Hashtable hashtable)
  100. {
  101. bool bottomdecked = false;
  102. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectPermanentCondition))
  103. {
  104. Permanent selectedPermanent = null;
  105. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  106. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  107. selectPermanentEffect.SetUp(
  108. selectPlayer: card.Owner,
  109. canTargetCondition: CanSelectPermanentCondition,
  110. canTargetCondition_ByPreSelecetedList: null,
  111. canEndSelectCondition: null,
  112. maxCount: maxCount,
  113. canNoSelect: false,
  114. canEndNotMax: false,
  115. selectPermanentCoroutine: SelectPermanentCoroutine,
  116. afterSelectPermanentCoroutine: null,
  117. mode: SelectPermanentEffect.Mode.Custom,
  118. cardEffect: activateClass);
  119. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will be returned to bottom of the deck", "The opponent is selecting 1 Digimon that will be returned to bottom of the deck");
  120. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  121. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  122. {
  123. selectedPermanent = permanent;
  124. yield return null;
  125. }
  126. if(selectedPermanent != null)
  127. {
  128. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeckBouncePeremanentAndProcessAccordingToResult(new List<Permanent> { selectedPermanent }, activateClass, SuccessProcess(), null));
  129. IEnumerator SuccessProcess()
  130. {
  131. bottomdecked = true;
  132. yield return null;
  133. }
  134. }
  135. if (!bottomdecked)
  136. {
  137. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonSAttack(targetPermanent: card.PermanentOfThisCard(), changeValue: 1, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  138. }
  139. }
  140. }
  141. }
  142. #endregion
  143. #region When Attacking OPT
  144. if (timing == EffectTiming.OnAllyAttack)
  145. {
  146. ActivateClass activateClass = new ActivateClass();
  147. activateClass.SetUpICardEffect("Bottom deck 1 digimon, if you didnt, Sec +1", CanUseCondition, card);
  148. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  149. activateClass.SetHashString("BottomDeck_LM_039");
  150. cardEffects.Add(activateClass);
  151. string EffectDiscription()
  152. {
  153. return "[When Attacking] [Once Per Turn] Return 1 of your opponent's Digimon with 8000 DP or less to the bottom of the deck. If this effect didn't return, this Digimon gains <Security A. +1> (This Digimon checks 1 additional security card) for the turn.";
  154. }
  155. bool CanUseCondition(Hashtable hashtable)
  156. {
  157. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  158. {
  159. if (CardEffectCommons.CanTriggerOnAttack(hashtable, card))
  160. {
  161. return true;
  162. }
  163. }
  164. return false;
  165. }
  166. bool CanActivateCondition(Hashtable hashtable)
  167. {
  168. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  169. }
  170. bool CanSelectPermanentCondition(Permanent permanent)
  171. {
  172. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  173. {
  174. if (permanent.DP <= 8000)
  175. {
  176. return true;
  177. }
  178. }
  179. return false;
  180. }
  181. IEnumerator ActivateCoroutine(Hashtable hashtable)
  182. {
  183. bool bottomdecked = false;
  184. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectPermanentCondition))
  185. {
  186. Permanent selectedPermanent = null;
  187. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  188. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  189. selectPermanentEffect.SetUp(
  190. selectPlayer: card.Owner,
  191. canTargetCondition: CanSelectPermanentCondition,
  192. canTargetCondition_ByPreSelecetedList: null,
  193. canEndSelectCondition: null,
  194. maxCount: maxCount,
  195. canNoSelect: false,
  196. canEndNotMax: false,
  197. selectPermanentCoroutine: SelectPermanentCoroutine,
  198. afterSelectPermanentCoroutine: null,
  199. mode: SelectPermanentEffect.Mode.Custom,
  200. cardEffect: activateClass);
  201. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will be returned to bottom of the deck", "The opponent is selecting 1 Digimon that will be returned to bottom of the deck");
  202. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  203. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  204. {
  205. selectedPermanent = permanent;
  206. yield return null;
  207. }
  208. if (selectedPermanent != null)
  209. {
  210. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeckBouncePeremanentAndProcessAccordingToResult(new List<Permanent> { selectedPermanent }, activateClass, SuccessProcess(), null));
  211. IEnumerator SuccessProcess()
  212. {
  213. bottomdecked = true;
  214. yield return null;
  215. }
  216. }
  217. if (!bottomdecked)
  218. {
  219. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonSAttack(targetPermanent: card.PermanentOfThisCard(), changeValue: 1, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  220. }
  221. }
  222. }
  223. }
  224. #endregion
  225. #region Your Turn
  226. if (timing == EffectTiming.None)
  227. {
  228. CanNotSwitchAttackTargetClass canNotSwitchAttackTargetClass = new CanNotSwitchAttackTargetClass();
  229. canNotSwitchAttackTargetClass.SetUpICardEffect("This Digimon's attack target can't be switched.", CanUseCondition, card);
  230. canNotSwitchAttackTargetClass.SetUpCanNotSwitchAttackTargetClass(PermanentCondition: PermanentCondition);
  231. cardEffects.Add(canNotSwitchAttackTargetClass);
  232. bool CanUseCondition(Hashtable hashtable)
  233. {
  234. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  235. CardEffectCommons.IsOwnerTurn(card);
  236. }
  237. bool PermanentCondition(Permanent permanent)
  238. {
  239. return permanent != null && permanent.TopCard && permanent == card.PermanentOfThisCard();
  240. }
  241. }
  242. #endregion
  243. return cardEffects;
  244. }
  245. }
  246. }