EX6_008.cs 8.8 KB

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