EX6_009.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System;
  5. namespace DCGO.CardEffects.EX6
  6. {
  7. public class EX6_009 : 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. static bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. if (targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 4)
  18. {
  19. return targetPermanent.TopCard.ContainsTraits("Legend-Arms");
  20. }
  21. return false;
  22. }
  23. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  24. permanentCondition: PermanentCondition,
  25. digivolutionCost: 3,
  26. ignoreDigivolutionRequirement: false,
  27. card: card,
  28. condition: null));
  29. }
  30. #endregion
  31. #region Hand - Main
  32. if (timing == EffectTiming.OnDeclaration)
  33. {
  34. ActivateClass activateClass = new ActivateClass();
  35. activateClass.SetUpICardEffect("Gain [Security Attack +1]", CanUseCondition, card);
  36. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, true, EffectDescription());
  37. cardEffects.Add(activateClass);
  38. string EffectDescription()
  39. {
  40. return
  41. "[Hand] [Main] By paying 2 cost and placing this card as the bottom digivolution card of 1 of your Digimon that's level 5 or has the [Legend-Arms] trait, that Digimon gains [Security Attack +1] for the turn.";
  42. }
  43. bool IsLevel5OrHasLegendArmsTrait(Permanent targetPermanent)
  44. {
  45. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(targetPermanent, card))
  46. {
  47. if (targetPermanent.TopCard.HasLevel && targetPermanent.Level == 5)
  48. return true;
  49. if (targetPermanent.TopCard.ContainsTraits("Legend-Arms"))
  50. return true;
  51. }
  52. return false;
  53. }
  54. bool CanUseCondition(Hashtable hashtable)
  55. {
  56. if (CardEffectCommons.IsExistOnHand(card))
  57. {
  58. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, IsLevel5OrHasLegendArmsTrait))
  59. {
  60. return true;
  61. }
  62. }
  63. return false;
  64. }
  65. IEnumerator ActivateCoroutine(Hashtable hashtable)
  66. {
  67. Permanent selectedPermanent = null;
  68. if (CardEffectCommons.HasMatchConditionPermanent(IsLevel5OrHasLegendArmsTrait))
  69. {
  70. int maxCount = Math.Min(1,
  71. CardEffectCommons.MatchConditionPermanentCount(IsLevel5OrHasLegendArmsTrait));
  72. SelectPermanentEffect selectPermanentEffect =
  73. GManager.instance.GetComponent<SelectPermanentEffect>();
  74. selectPermanentEffect.SetUp(
  75. selectPlayer: card.Owner,
  76. canTargetCondition: IsLevel5OrHasLegendArmsTrait,
  77. canTargetCondition_ByPreSelecetedList: null,
  78. canEndSelectCondition: null,
  79. maxCount: maxCount,
  80. canNoSelect: false,
  81. canEndNotMax: false,
  82. selectPermanentCoroutine: SelectPermanentCoroutine,
  83. afterSelectPermanentCoroutine: null,
  84. mode: SelectPermanentEffect.Mode.Custom,
  85. cardEffect: activateClass);
  86. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to add bottom digivolution source.",
  87. "The opponent is selecting 1 Digimon to add bottom digivolution source.");
  88. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  89. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  90. {
  91. selectedPermanent = permanent;
  92. yield return null;
  93. }
  94. if (selectedPermanent != null)
  95. {
  96. yield return ContinuousController.instance.StartCoroutine(
  97. card.Owner.AddMemory(-2, activateClass));
  98. yield return ContinuousController.instance.StartCoroutine(
  99. selectedPermanent.AddDigivolutionCardsBottom(
  100. new List<CardSource>() { card },
  101. activateClass));
  102. yield return ContinuousController.instance.StartCoroutine(
  103. CardEffectCommons.ChangeDigimonSAttack(
  104. targetPermanent: selectedPermanent,
  105. changeValue: 1,
  106. effectDuration: EffectDuration.UntilEachTurnEnd,
  107. activateClass: activateClass));
  108. }
  109. }
  110. }
  111. }
  112. #endregion
  113. #region Your Turn - Place Digivolution
  114. if (timing == EffectTiming.OnAddDigivolutionCards)
  115. {
  116. ActivateClass activateClass = new ActivateClass();
  117. activateClass.SetUpICardEffect("Gain <Raid> and <Piercing>", CanUseCondition, card);
  118. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false,
  119. EffectDiscription());
  120. activateClass.SetHashString("GainEffects_EX6_009");
  121. cardEffects.Add(activateClass);
  122. string EffectDiscription()
  123. {
  124. return
  125. "[Your Turn] [Once Per Turn] When an effect places a digivolution card under this Digimon, it gains <Raid> and <Piercing> for the turn.";
  126. }
  127. bool CanUseCondition(Hashtable hashtable)
  128. {
  129. if (CardEffectCommons.IsExistOnBattleArea(card))
  130. {
  131. if (CardEffectCommons.IsOwnerTurn(card))
  132. {
  133. if (CardEffectCommons.CanTriggerOnAddDigivolutionCard(
  134. hashtable: hashtable,
  135. permanentCondition: permanent => permanent == card.PermanentOfThisCard(),
  136. cardEffectCondition: cardEffect => cardEffect.EffectSourceCard != null,
  137. cardCondition: null))
  138. {
  139. return true;
  140. }
  141. }
  142. }
  143. return false;
  144. }
  145. bool CanActivateCondition(Hashtable hashtable)
  146. {
  147. return CardEffectCommons.IsExistOnBattleArea(card);
  148. }
  149. IEnumerator ActivateCoroutine(Hashtable hashtable)
  150. {
  151. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainRaid(
  152. targetPermanent: card.PermanentOfThisCard(),
  153. effectDuration: EffectDuration.UntilEachTurnEnd,
  154. activateClass: activateClass));
  155. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainPierce(
  156. targetPermanent: card.PermanentOfThisCard(),
  157. effectDuration: EffectDuration.UntilEachTurnEnd,
  158. activateClass: activateClass));
  159. }
  160. }
  161. #endregion
  162. #region Your Turn - ESS
  163. if (timing == EffectTiming.OnAttackTargetChanged)
  164. {
  165. ActivateClass activateClass = new ActivateClass();
  166. activateClass.SetUpICardEffect("Trash the top card of opponent's security", CanUseCondition, card);
  167. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false,
  168. EffectDescription());
  169. activateClass.SetIsInheritedEffect(true);
  170. activateClass.SetHashString("TrashSecurity_BT11_014");
  171. cardEffects.Add(activateClass);
  172. string EffectDescription()
  173. {
  174. return
  175. "[Your Turn][Once Per Turn] When this Digimon's attack target is switched, trash the top card of your opponent's security stack.";
  176. }
  177. bool CanUseCondition(Hashtable hashtable)
  178. {
  179. if (CardEffectCommons.IsExistOnBattleArea(card))
  180. {
  181. if (CardEffectCommons.CanTriggerOnAttackTargetSwitch(hashtable, card))
  182. {
  183. if (CardEffectCommons.IsOwnerTurn(card))
  184. {
  185. return true;
  186. }
  187. }
  188. }
  189. return false;
  190. }
  191. bool CanActivateCondition(Hashtable hashtable)
  192. {
  193. if (CardEffectCommons.IsExistOnBattleArea(card))
  194. {
  195. return true;
  196. }
  197. return false;
  198. }
  199. IEnumerator ActivateCoroutine(Hashtable hashtable)
  200. {
  201. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  202. player: card.Owner.Enemy,
  203. destroySecurityCount: 1,
  204. cardEffect: activateClass,
  205. fromTop: true).DestroySecurity());
  206. }
  207. }
  208. #endregion
  209. return cardEffects;
  210. }
  211. }
  212. }