BT12_077.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT12
  5. {
  6. public class BT12_077 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. if (timing == EffectTiming.None)
  12. {
  13. bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. return targetPermanent.TopCard.HasSaveText && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 3;
  16. }
  17. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null));
  18. }
  19. if (timing == EffectTiming.OnEnterFieldAnyone)
  20. {
  21. ActivateClass activateClass = new ActivateClass();
  22. activateClass.SetUpICardEffect("This Digimon gains Rush", CanUseCondition, card);
  23. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  24. cardEffects.Add(activateClass);
  25. string EffectDiscription()
  26. {
  27. return "[When Digivolving] If there are 2 or more digivolution cards under this Digimon, this Digimon gains <Rush> for the turn.";
  28. }
  29. bool CanUseCondition(Hashtable hashtable)
  30. {
  31. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  32. }
  33. bool CanActivateCondition(Hashtable hashtable)
  34. {
  35. if (CardEffectCommons.IsExistOnBattleArea(card))
  36. {
  37. if (card.PermanentOfThisCard().DigivolutionCards.Count >= 2)
  38. {
  39. return true;
  40. }
  41. }
  42. return false;
  43. }
  44. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  45. {
  46. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainRush(
  47. targetPermanent: card.PermanentOfThisCard(),
  48. effectDuration: EffectDuration.UntilEachTurnEnd,
  49. activateClass: activateClass));
  50. }
  51. }
  52. if (timing == EffectTiming.OnDestroyedAnyone)
  53. {
  54. ActivateClass activateClass = new ActivateClass();
  55. activateClass.SetUpICardEffect("Save and place 1 card under your 1 Tamer from trash", CanUseCondition, card);
  56. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  57. cardEffects.Add(activateClass);
  58. string EffectDiscription()
  59. {
  60. return "[On Deletion] <Save>. Then, place 1 Digimon card with <Save> in its text from your trash under 1 of your Tamers.";
  61. }
  62. bool CanSelectPermanentCondition(Permanent permanent)
  63. {
  64. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  65. {
  66. if (permanent.IsTamer)
  67. {
  68. if (!permanent.IsToken)
  69. {
  70. return true;
  71. }
  72. }
  73. }
  74. return false;
  75. }
  76. bool CanSelectCardCondition1(CardSource cardSource)
  77. {
  78. if (cardSource != null)
  79. {
  80. if (cardSource.Owner == card.Owner)
  81. {
  82. if (cardSource.HasSaveText)
  83. {
  84. if (cardSource.IsDigimon)
  85. {
  86. return true;
  87. }
  88. }
  89. }
  90. }
  91. return false;
  92. }
  93. bool CanUseCondition(Hashtable hashtable)
  94. {
  95. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  96. }
  97. bool CanActivateCondition(Hashtable hashtable)
  98. {
  99. return CardEffectCommons.CanActivateSave(hashtable, CanSelectPermanentCondition);
  100. }
  101. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  102. {
  103. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SaveProcess(_hashtable, activateClass, card, CanSelectPermanentCondition));
  104. List<CardSource> selectedCards = new List<CardSource>();
  105. int maxCount = 1;
  106. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  107. selectCardEffect.SetUp(
  108. canTargetCondition: CanSelectCardCondition1,
  109. canTargetCondition_ByPreSelecetedList: null,
  110. canEndSelectCondition: null,
  111. canNoSelect: () => false,
  112. selectCardCoroutine: SelectCardCoroutine,
  113. afterSelectCardCoroutine: null,
  114. message: "Select 1 card to place at the bottom of digivolution cards.",
  115. maxCount: maxCount,
  116. canEndNotMax: false,
  117. isShowOpponent: true,
  118. mode: SelectCardEffect.Mode.Custom,
  119. root: SelectCardEffect.Root.Trash,
  120. customRootCardList: null,
  121. canLookReverseCard: true,
  122. selectPlayer: card.Owner,
  123. cardEffect: activateClass);
  124. selectCardEffect.SetUpCustomMessage("Select 1 card to place at the bottom of digivolution cards.", "The opponent is selecting 1 card to place at the bottom of digivolution cards.");
  125. yield return StartCoroutine(selectCardEffect.Activate());
  126. IEnumerator SelectCardCoroutine(CardSource cardSource)
  127. {
  128. selectedCards.Add(cardSource);
  129. yield return null;
  130. }
  131. if (selectedCards.Count >= 1)
  132. {
  133. maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  134. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  135. selectPermanentEffect.SetUp(
  136. selectPlayer: card.Owner,
  137. canTargetCondition: CanSelectPermanentCondition,
  138. canTargetCondition_ByPreSelecetedList: null,
  139. canEndSelectCondition: null,
  140. maxCount: maxCount,
  141. canNoSelect: false,
  142. canEndNotMax: false,
  143. selectPermanentCoroutine: SelectPermanentCoroutine,
  144. afterSelectPermanentCoroutine: null,
  145. mode: SelectPermanentEffect.Mode.Custom,
  146. cardEffect: activateClass);
  147. selectPermanentEffect.SetUpCustomMessage("Select 1 Tamer that will get a digivolution card.", "The opponent is selecting 1 Tamer that will get a digivolution card.");
  148. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  149. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  150. {
  151. Permanent selectedPermanent = permanent;
  152. yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddDigivolutionCardsBottom(selectedCards, activateClass));
  153. }
  154. }
  155. }
  156. }
  157. if (timing == EffectTiming.OnAllyAttack)
  158. {
  159. ActivateClass activateClass = new ActivateClass();
  160. activateClass.SetUpICardEffect("Draw 1", CanUseCondition, card);
  161. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  162. activateClass.SetIsInheritedEffect(true);
  163. activateClass.SetHashString("Draw1_BT12_077");
  164. cardEffects.Add(activateClass);
  165. string EffectDiscription()
  166. {
  167. return "[When Attacking][Once Per Turn] If this Digimon has <Save> in its text, <Draw 1>. (Draw 1 card from your deck.)";
  168. }
  169. bool CanUseCondition(Hashtable hashtable)
  170. {
  171. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  172. }
  173. bool CanActivateCondition(Hashtable hashtable)
  174. {
  175. if (CardEffectCommons.IsExistOnBattleArea(card))
  176. {
  177. if (card.PermanentOfThisCard().TopCard.HasSaveText)
  178. {
  179. return true;
  180. }
  181. }
  182. return false;
  183. }
  184. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  185. {
  186. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  187. }
  188. }
  189. return cardEffects;
  190. }
  191. }
  192. }