EX9_026.cs 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. // Angemon
  6. namespace DCGO.CardEffects.EX9
  7. {
  8. public class EX9_026 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Digivolution condition
  14. if (timing == EffectTiming.None)
  15. {
  16. bool Condition(Permanent permanent)
  17. {
  18. return permanent.TopCard.IsLevel3 && permanent.TopCard.EqualsTraits("DM");
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(Condition, 2, false, card, null));
  21. }
  22. #endregion
  23. #region Training
  24. if (timing == EffectTiming.OnDeclaration)
  25. {
  26. cardEffects.Add(CardEffectFactory.TrainingEffect(card: card));
  27. }
  28. #endregion
  29. #region On Play
  30. if (timing == EffectTiming.OnEnterFieldAnyone)
  31. {
  32. ActivateClass activateClass = new ActivateClass();
  33. activateClass.SetUpICardEffect("Place a card face down as source, to give 1 digimon SEC -1 & -3k DP", CanUseCondition, card);
  34. activateClass.SetUpActivateClass(CanActivateCondition, hashtable => SharedActivateCoroutine(hashtable, activateClass), -1, true, EffectDiscription());
  35. cardEffects.Add(activateClass);
  36. string EffectDiscription()
  37. {
  38. return "[On Play] By placing 1 card in your hand face down as this Digimon's bottom digivolution card, give 1 of your opponent's Digimon <Security A. -1> (This Digimon checks 1 fewer security card) and -3000 DP until their turn ends.";
  39. }
  40. bool CanUseCondition(Hashtable hashtable)
  41. {
  42. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  43. }
  44. bool CanActivateCondition(Hashtable hashtable)
  45. {
  46. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  47. card.Owner.HandCards.Count > 0;
  48. }
  49. }
  50. #endregion
  51. #region When Digivolving
  52. if (timing == EffectTiming.OnEnterFieldAnyone)
  53. {
  54. ActivateClass activateClass = new ActivateClass();
  55. activateClass.SetUpICardEffect("Place a card face down as source, to give 1 digimon SEC -1 & -3k DP", CanUseCondition, card);
  56. activateClass.SetUpActivateClass(CanActivateCondition, hashtable => SharedActivateCoroutine(hashtable, activateClass), -1, true, EffectDiscription());
  57. cardEffects.Add(activateClass);
  58. string EffectDiscription()
  59. {
  60. return "[When Digivolving] By placing 1 card in your hand face down as this Digimon's bottom digivolution card, give 1 of your opponent's Digimon <Security A. -1> (This Digimon checks 1 fewer security card) and -3000 DP until their turn ends.";
  61. }
  62. bool CanUseCondition(Hashtable hashtable)
  63. {
  64. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  65. CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card); ;
  66. }
  67. bool CanActivateCondition(Hashtable hashtable)
  68. {
  69. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  70. card.Owner.HandCards.Count > 0;
  71. }
  72. }
  73. #endregion
  74. #region OP/WD Shared
  75. bool CanSelectPermanentCondition(Permanent permanent)
  76. {
  77. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  78. }
  79. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  80. {
  81. CardSource selectedCard = null;
  82. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  83. selectHandEffect.SetUp(
  84. selectPlayer: card.Owner,
  85. canTargetCondition: (cardSource) => true,
  86. canTargetCondition_ByPreSelecetedList: null,
  87. canEndSelectCondition: null,
  88. maxCount: 1,
  89. canNoSelect: true,
  90. canEndNotMax: false,
  91. isShowOpponent: false,
  92. selectCardCoroutine: SelectCardCoroutine,
  93. afterSelectCardCoroutine: null,
  94. mode: SelectHandEffect.Mode.Custom,
  95. cardEffect: activateClass);
  96. yield return StartCoroutine(selectHandEffect.Activate());
  97. selectHandEffect.SetUpCustomMessage("Select a card to add face down as a source", "Opponent is selecting a card to add face down as a source");
  98. IEnumerator SelectCardCoroutine(CardSource cardSource)
  99. {
  100. selectedCard = cardSource;
  101. yield return null;
  102. }
  103. if (selectedCard != null)
  104. {
  105. Permanent permanent = card.PermanentOfThisCard();
  106. yield return ContinuousController.instance.StartCoroutine(permanent.AddDigivolutionCardsBottom(new List<CardSource>() { selectedCard }, activateClass, isFacedown: true));
  107. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectPermanentCondition))
  108. {
  109. Permanent selectedPermanent = null;
  110. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOpponentsPermanentCount(card, CanSelectPermanentCondition));
  111. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  112. selectPermanentEffect.SetUp(
  113. selectPlayer: card.Owner,
  114. canTargetCondition: CanSelectPermanentCondition,
  115. canTargetCondition_ByPreSelecetedList: null,
  116. canEndSelectCondition: null,
  117. maxCount: maxCount,
  118. canNoSelect: false,
  119. canEndNotMax: false,
  120. selectPermanentCoroutine: SelectPermanentCoroutine,
  121. afterSelectPermanentCoroutine: null,
  122. mode: SelectPermanentEffect.Mode.Custom,
  123. cardEffect: activateClass
  124. );
  125. selectPermanentEffect.SetUpCustomMessage("Select a Digimon to give SEC -1 & -3k DP", "Opponent is selecting a Digimon to give SEC -1 & -3k DP");
  126. selectHandEffect.SetUpCustomMessage_ShowCard("Selected Digimon");
  127. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  128. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  129. {
  130. selectedPermanent = permanent;
  131. yield return null;
  132. }
  133. if (selectedPermanent != null)
  134. {
  135. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonSAttack(targetPermanent: selectedPermanent, changeValue: -1, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  136. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: selectedPermanent, changeValue: -3000, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  137. }
  138. }
  139. }
  140. }
  141. #endregion
  142. #region ESS
  143. if (timing == EffectTiming.OnDestroyedAnyone)
  144. {
  145. ActivateClass activateClass = new ActivateClass();
  146. activateClass.SetUpICardEffect("Recovery +1 (Deck)", CanUseCondition, card);
  147. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  148. activateClass.SetIsInheritedEffect(true);
  149. cardEffects.Add(activateClass);
  150. string EffectDiscription()
  151. {
  152. return "[On Deletion] If you have 3 or fewer security cards, <Recovery +1 (Deck)>. (Place the top card of your deck on top of your security stack).";
  153. }
  154. bool CanUseCondition(Hashtable hashtable)
  155. {
  156. if (card.Owner.CanAddSecurity(activateClass))
  157. {
  158. if (card.Owner.LibraryCards.Count >= 1)
  159. {
  160. if (card.Owner.SecurityCards.Count <= 3)
  161. {
  162. return true;
  163. }
  164. }
  165. }
  166. return false;
  167. }
  168. bool CanActivateCondition(Hashtable hashtable)
  169. {
  170. return CardEffectCommons.CanActivateOnDeletion(card, activateClass);
  171. }
  172. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  173. {
  174. yield return ContinuousController.instance.StartCoroutine(new IRecovery(card.Owner, 1, activateClass).Recovery());
  175. }
  176. }
  177. #endregion
  178. return cardEffects;
  179. }
  180. }
  181. }