EX6_038.cs 8.2 KB

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