EX8_022.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.EX8
  5. {
  6. public class EX8_022 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alternate Digivolution Requirement
  12. if (timing == EffectTiming.None)
  13. {
  14. static bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.EqualsTraits("Ice-Snow") && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 3;
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null));
  19. }
  20. #endregion
  21. #region Iceclad
  22. if (timing == EffectTiming.None)
  23. {
  24. cardEffects.Add(CardEffectFactory.IcecladSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  25. }
  26. #endregion
  27. #region On Play
  28. if (timing == EffectTiming.OnEnterFieldAnyone)
  29. {
  30. ActivateClass activateClass = new ActivateClass();
  31. activateClass.SetUpICardEffect("Trash bottom 2 sources of 1 opponents digimon. Then memory +1", CanUseCondition, card);
  32. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  33. cardEffects.Add(activateClass);
  34. string EffectDiscription()
  35. {
  36. return "[On Play] Trash the bottom 2 digivolution cards of 1 your opponent's Digimon. Then, if your opponent has no Digimon with digivolution cards, gain 1 memory.";
  37. }
  38. bool OpponentsDigimon(Permanent permanent)
  39. {
  40. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  41. }
  42. bool CanUseCondition(Hashtable hashtable)
  43. {
  44. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  45. }
  46. bool CanActivateCondition(Hashtable hashtable)
  47. {
  48. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  49. }
  50. IEnumerator ActivateCoroutine(Hashtable hashtable)
  51. {
  52. if (CardEffectCommons.HasMatchConditionPermanent(OpponentsDigimon))
  53. {
  54. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  55. selectPermanentEffect.SetUp(
  56. selectPlayer: card.Owner,
  57. canTargetCondition: OpponentsDigimon,
  58. canTargetCondition_ByPreSelecetedList: null,
  59. canEndSelectCondition: null,
  60. maxCount: 1,
  61. canNoSelect: false,
  62. canEndNotMax: false,
  63. selectPermanentCoroutine: SelectPermanentCoroutine,
  64. afterSelectPermanentCoroutine: null,
  65. mode: SelectPermanentEffect.Mode.Custom,
  66. cardEffect: activateClass);
  67. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will trash digivolution cards.", "The opponent is selecting 1 Digimon that will trash digivolution cards.");
  68. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  69. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  70. {
  71. Permanent selectedPermanent = permanent;
  72. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.TrashDigivolutionCardsFromTopOrBottom(
  73. targetPermanent: selectedPermanent,
  74. trashCount: 2,
  75. isFromTop: false,
  76. activateClass: activateClass));
  77. }
  78. }
  79. if (card.Owner.Enemy.GetBattleAreaDigimons().Count(permanent => permanent.DigivolutionCards.Count > 0) == 0)
  80. {
  81. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  82. }
  83. }
  84. }
  85. #endregion
  86. #region When Digivolving
  87. if (timing == EffectTiming.OnEnterFieldAnyone)
  88. {
  89. ActivateClass activateClass = new ActivateClass();
  90. activateClass.SetUpICardEffect("Trash bottom 2 sources of 1 opponents digimon. Then memory +1", CanUseCondition, card);
  91. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  92. cardEffects.Add(activateClass);
  93. string EffectDiscription()
  94. {
  95. return "[When Digivolving] Trash the bottom 2 digivolution cards of 1 your opponent's Digimon. Then, if your opponent has no Digimon with digivolution cards, gain 1 memory.";
  96. }
  97. bool OpponentsDigimon(Permanent permanent)
  98. {
  99. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  100. }
  101. bool CanUseCondition(Hashtable hashtable)
  102. {
  103. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card) &&
  104. CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  105. }
  106. bool CanActivateCondition(Hashtable hashtable)
  107. {
  108. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  109. }
  110. IEnumerator ActivateCoroutine(Hashtable hashtable)
  111. {
  112. if (CardEffectCommons.HasMatchConditionPermanent(OpponentsDigimon))
  113. {
  114. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  115. selectPermanentEffect.SetUp(
  116. selectPlayer: card.Owner,
  117. canTargetCondition: OpponentsDigimon,
  118. canTargetCondition_ByPreSelecetedList: null,
  119. canEndSelectCondition: null,
  120. maxCount: 1,
  121. canNoSelect: false,
  122. canEndNotMax: false,
  123. selectPermanentCoroutine: SelectPermanentCoroutine,
  124. afterSelectPermanentCoroutine: null,
  125. mode: SelectPermanentEffect.Mode.Custom,
  126. cardEffect: activateClass);
  127. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will trash digivolution cards.", "The opponent is selecting 1 Digimon that will trash digivolution cards.");
  128. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  129. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  130. {
  131. Permanent selectedPermanent = permanent;
  132. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.TrashDigivolutionCardsFromTopOrBottom(
  133. targetPermanent: selectedPermanent,
  134. trashCount: 2,
  135. isFromTop: false,
  136. activateClass: activateClass));
  137. }
  138. }
  139. if (card.Owner.Enemy.GetBattleAreaDigimons().Count(permanent => permanent.DigivolutionCards.Count > 0) == 0)
  140. {
  141. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  142. }
  143. }
  144. }
  145. #endregion
  146. #region When Attacking - ESS
  147. if (timing == EffectTiming.OnAllyAttack)
  148. {
  149. ActivateClass activateClass = new ActivateClass();
  150. activateClass.SetUpICardEffect("Security Attack -1", CanUseCondition, card);
  151. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  152. activateClass.SetIsInheritedEffect(true);
  153. cardEffects.Add(activateClass);
  154. string EffectDescription()
  155. {
  156. return "[When Attacking] Give 1 of your opponent's Digimon <Security A. -1> until the end of their turn.";
  157. }
  158. bool CanSelectPermanentCondition(Permanent permanent)
  159. {
  160. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  161. }
  162. bool CanUseCondition(Hashtable hashtable)
  163. {
  164. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  165. }
  166. bool CanActivateCondition(Hashtable hashtable)
  167. {
  168. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  169. CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition);
  170. }
  171. IEnumerator ActivateCoroutine(Hashtable hashtable)
  172. {
  173. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  174. selectPermanentEffect.SetUp(
  175. selectPlayer: card.Owner,
  176. canTargetCondition: CanSelectPermanentCondition,
  177. canTargetCondition_ByPreSelecetedList: null,
  178. canEndSelectCondition: null,
  179. maxCount: 1,
  180. canNoSelect: false,
  181. canEndNotMax: false,
  182. selectPermanentCoroutine: SelectPermanentCoroutine,
  183. afterSelectPermanentCoroutine: null,
  184. mode: SelectPermanentEffect.Mode.Custom,
  185. cardEffect: activateClass);
  186. selectPermanentEffect.SetUpCustomMessage(
  187. "Select 1 Digimon that will get Security Attack -1.",
  188. "The opponent is selecting 1 Digimon that will get Security Attack -1.");
  189. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  190. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  191. {
  192. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonSAttack(
  193. targetPermanent: permanent,
  194. changeValue: -1,
  195. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  196. activateClass: activateClass));
  197. }
  198. }
  199. }
  200. #endregion
  201. return cardEffects;
  202. }
  203. }
  204. }