EX5_068.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. public class EX5_068 : 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. IgnoreColorConditionClass ignoreColorConditionClass = new IgnoreColorConditionClass();
  13. ignoreColorConditionClass.SetUpICardEffect("Ignore color requirements", CanUseCondition, card);
  14. ignoreColorConditionClass.SetUpIgnoreColorConditionClass(cardCondition: CardCondition);
  15. cardEffects.Add(ignoreColorConditionClass);
  16. bool CanUseCondition(Hashtable hashtable)
  17. {
  18. if (card.Owner.GetBattleAreaDigimons().Count((permanet) =>
  19. permanet.TopCard.ContainsCardName("Leomon")
  20. || permanet.TopCard.ContainsCardName("Bancho")) >= 1)
  21. {
  22. return true;
  23. }
  24. return false;
  25. }
  26. bool CardCondition(CardSource cardSource)
  27. {
  28. if (cardSource == card)
  29. {
  30. return true;
  31. }
  32. return false;
  33. }
  34. }
  35. if (timing == EffectTiming.OptionSkill)
  36. {
  37. ActivateClass activateClass = new ActivateClass();
  38. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  39. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  40. cardEffects.Add(activateClass);
  41. string EffectDiscription()
  42. {
  43. return "[Main] Suspend 1 of your opponent's Digimon, and 1 of your opponent's Digimon gets -12000 DP for the turn. Then, 1 of your Digimon with [Leomon]/[Bancho] in its name may attack.";
  44. }
  45. bool CanSelectPermanentCondition(Permanent permanent)
  46. {
  47. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  48. }
  49. bool CanSelectPermanentCondition1(Permanent permanent)
  50. {
  51. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  52. {
  53. if (permanent.TopCard.ContainsCardName("Leomon") || permanent.TopCard.ContainsCardName("Bancho"))
  54. {
  55. if (permanent.CanAttack(activateClass))
  56. {
  57. return true;
  58. }
  59. }
  60. }
  61. return false;
  62. }
  63. bool CanUseCondition(Hashtable hashtable)
  64. {
  65. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  66. }
  67. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  68. {
  69. Permanent selectedPermanent = null;
  70. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  71. {
  72. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  73. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  74. selectPermanentEffect.SetUp(
  75. selectPlayer: card.Owner,
  76. canTargetCondition: CanSelectPermanentCondition,
  77. canTargetCondition_ByPreSelecetedList: null,
  78. canEndSelectCondition: null,
  79. maxCount: maxCount,
  80. canNoSelect: false,
  81. canEndNotMax: false,
  82. selectPermanentCoroutine: null,
  83. afterSelectPermanentCoroutine: null,
  84. mode: SelectPermanentEffect.Mode.Tap,
  85. cardEffect: activateClass);
  86. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  87. }
  88. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  89. {
  90. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  91. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  92. selectPermanentEffect.SetUp(
  93. selectPlayer: card.Owner,
  94. canTargetCondition: CanSelectPermanentCondition,
  95. canTargetCondition_ByPreSelecetedList: null,
  96. canEndSelectCondition: null,
  97. maxCount: maxCount,
  98. canNoSelect: false,
  99. canEndNotMax: false,
  100. selectPermanentCoroutine: SelectPermanentCoroutine,
  101. afterSelectPermanentCoroutine: null,
  102. mode: SelectPermanentEffect.Mode.Custom,
  103. cardEffect: activateClass);
  104. selectPermanentEffect.SetUpCustomMessage(
  105. "Select 1 Digimon that will get DP -12000.",
  106. "The opponent is selecting 1 Digimon that will get DP -12000.");
  107. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  108. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  109. {
  110. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  111. targetPermanent: permanent,
  112. changeValue: -12000,
  113. effectDuration: EffectDuration.UntilEachTurnEnd,
  114. activateClass: activateClass));
  115. }
  116. }
  117. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  118. {
  119. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  120. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  121. selectPermanentEffect.SetUp(
  122. selectPlayer: card.Owner,
  123. canTargetCondition: CanSelectPermanentCondition1,
  124. canTargetCondition_ByPreSelecetedList: null,
  125. canEndSelectCondition: null,
  126. maxCount: maxCount,
  127. canNoSelect: true,
  128. canEndNotMax: false,
  129. selectPermanentCoroutine: SelectPermanentCoroutine,
  130. afterSelectPermanentCoroutine: null,
  131. mode: SelectPermanentEffect.Mode.Custom,
  132. cardEffect: activateClass);
  133. selectPermanentEffect.SetUpCustomMessage(
  134. "Select 1 Digimon that will attack.",
  135. "The opponent is selecting 1 Digimon that will attack.");
  136. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  137. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  138. {
  139. selectedPermanent = permanent;
  140. yield return null;
  141. }
  142. if (selectedPermanent != null)
  143. {
  144. if (selectedPermanent.CanAttack(activateClass))
  145. {
  146. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  147. selectAttackEffect.SetUp(
  148. attacker: selectedPermanent,
  149. canAttackPlayerCondition: () => true,
  150. defenderCondition: (permanent) => true,
  151. cardEffect: activateClass);
  152. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  153. }
  154. }
  155. }
  156. }
  157. }
  158. if (timing == EffectTiming.SecuritySkill)
  159. {
  160. ActivateClass activateClass = new ActivateClass();
  161. activateClass.SetUpICardEffect($"Suspend 1 Digimon and opponent's 1 Digimon gains DP -12000", CanUseCondition, card);
  162. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  163. activateClass.SetIsSecurityEffect(true);
  164. cardEffects.Add(activateClass);
  165. string EffectDiscription()
  166. {
  167. return "[Security] Suspend 1 of your opponent's Digimon, and give 1 of your opponent's Digimon -12000 DP for the turn.";
  168. }
  169. bool CanSelectPermanentCondition(Permanent permanent)
  170. {
  171. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  172. }
  173. bool CanUseCondition(Hashtable hashtable)
  174. {
  175. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  176. }
  177. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  178. {
  179. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  180. {
  181. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  182. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  183. selectPermanentEffect.SetUp(
  184. selectPlayer: card.Owner,
  185. canTargetCondition: CanSelectPermanentCondition,
  186. canTargetCondition_ByPreSelecetedList: null,
  187. canEndSelectCondition: null,
  188. maxCount: maxCount,
  189. canNoSelect: false,
  190. canEndNotMax: false,
  191. selectPermanentCoroutine: null,
  192. afterSelectPermanentCoroutine: null,
  193. mode: SelectPermanentEffect.Mode.Tap,
  194. cardEffect: activateClass);
  195. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  196. }
  197. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  198. {
  199. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  200. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  201. selectPermanentEffect.SetUp(
  202. selectPlayer: card.Owner,
  203. canTargetCondition: CanSelectPermanentCondition,
  204. canTargetCondition_ByPreSelecetedList: null,
  205. canEndSelectCondition: null,
  206. maxCount: maxCount,
  207. canNoSelect: false,
  208. canEndNotMax: false,
  209. selectPermanentCoroutine: SelectPermanentCoroutine,
  210. afterSelectPermanentCoroutine: null,
  211. mode: SelectPermanentEffect.Mode.Custom,
  212. cardEffect: activateClass);
  213. selectPermanentEffect.SetUpCustomMessage(
  214. "Select 1 Digimon that will get DP -12000.",
  215. "The opponent is selecting 1 Digimon that will get DP -12000.");
  216. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  217. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  218. {
  219. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  220. targetPermanent: permanent,
  221. changeValue: -12000,
  222. effectDuration: EffectDuration.UntilEachTurnEnd,
  223. activateClass: activateClass));
  224. }
  225. }
  226. }
  227. }
  228. return cardEffects;
  229. }
  230. }