EX6_007.cs 9.1 KB

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