BT10_059.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System.Linq;
  5. using Photon;
  6. using System;
  7. using Photon.Pun;
  8. namespace DCGO.CardEffects.BT10
  9. {
  10. public class BT10_059 : CEntity_Effect
  11. {
  12. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  13. {
  14. List<ICardEffect> cardEffects = new List<ICardEffect>();
  15. if (timing == EffectTiming.OnEnterFieldAnyone)
  16. {
  17. ActivateClass activateClass = new ActivateClass();
  18. activateClass.SetUpICardEffect("Place this Digimon under your Digimon's digivolution cards to De-Digivolve 1", CanUseCondition, card);
  19. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  20. cardEffects.Add(activateClass);
  21. string EffectDiscription()
  22. {
  23. return "[On Play] By placing this Digimon under 1 of your Digimon with [Legend-Arms] or [Xros Heart] in its traits as its bottom digivolution card, <De-Digivolve 1> 1 of your opponent's Digimon. (Trash 1 card from the top of 1 of your opponent's Digimon. Stop trashing when you would trash a level 3 card or the Digimon's last card.)";
  24. }
  25. bool CanSelectPermanentCondition(Permanent permanent)
  26. {
  27. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  28. {
  29. if (permanent != card.PermanentOfThisCard())
  30. {
  31. if (!permanent.IsToken)
  32. {
  33. if (permanent.TopCard.CardTraits.Contains("Legend-Arms"))
  34. {
  35. return true;
  36. }
  37. if (permanent.TopCard.CardTraits.Contains("Xros Heart"))
  38. {
  39. return true;
  40. }
  41. if (permanent.TopCard.CardTraits.Contains("XrosHeart"))
  42. {
  43. return true;
  44. }
  45. }
  46. }
  47. }
  48. return false;
  49. }
  50. bool CanSelectPermanentCondition1(Permanent permanent)
  51. {
  52. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  53. }
  54. bool CanUseCondition(Hashtable hashtable)
  55. {
  56. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  57. }
  58. bool CanActivateCondition(Hashtable hashtable)
  59. {
  60. if (CardEffectCommons.IsExistOnBattleArea(card))
  61. {
  62. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  63. {
  64. return true;
  65. }
  66. }
  67. return false;
  68. }
  69. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  70. {
  71. if (CardEffectCommons.IsExistOnBattleArea(card))
  72. {
  73. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  74. {
  75. bool added = false;
  76. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  77. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  78. selectPermanentEffect.SetUp(
  79. selectPlayer: card.Owner,
  80. canTargetCondition: CanSelectPermanentCondition,
  81. canTargetCondition_ByPreSelecetedList: null,
  82. canEndSelectCondition: null,
  83. maxCount: maxCount,
  84. canNoSelect: true,
  85. canEndNotMax: false,
  86. selectPermanentCoroutine: SelectPermanentCoroutine,
  87. afterSelectPermanentCoroutine: null,
  88. mode: SelectPermanentEffect.Mode.Custom,
  89. cardEffect: activateClass);
  90. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get a digivolution card.", "The opponent is selecting 1 Digimon that will get a digivolution card.");
  91. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  92. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  93. {
  94. Permanent selectedPermanent = permanent;
  95. if (selectedPermanent != null)
  96. {
  97. yield return ContinuousController.instance.StartCoroutine(new IPlacePermanentToDigivolutionCards(new List<Permanent[]>() { new Permanent[] { card.PermanentOfThisCard(), selectedPermanent } }, false, activateClass).PlacePermanentToDigivolutionCards());
  98. if (CardEffectCommons.IsExistOnBattleArea(card))
  99. {
  100. if (selectedPermanent.DigivolutionCards.Contains(card))
  101. {
  102. added = true;
  103. }
  104. }
  105. }
  106. }
  107. if (added)
  108. {
  109. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  110. {
  111. maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  112. selectPermanentEffect.SetUp(
  113. selectPlayer: card.Owner,
  114. canTargetCondition: CanSelectPermanentCondition1,
  115. canTargetCondition_ByPreSelecetedList: null,
  116. canEndSelectCondition: null,
  117. maxCount: maxCount,
  118. canNoSelect: false,
  119. canEndNotMax: false,
  120. selectPermanentCoroutine: SelectPermanentCoroutine1,
  121. afterSelectPermanentCoroutine: null,
  122. mode: SelectPermanentEffect.Mode.Custom,
  123. cardEffect: activateClass);
  124. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to De-Digivolve.", "The opponent is selecting 1 Digimon to De-Digivolve.");
  125. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  126. IEnumerator SelectPermanentCoroutine1(Permanent permanent)
  127. {
  128. Permanent selectedPermanent = permanent;
  129. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(selectedPermanent, 1, activateClass).Degeneration());
  130. }
  131. }
  132. }
  133. }
  134. }
  135. }
  136. }
  137. if (timing == EffectTiming.OnAllyAttack)
  138. {
  139. ActivateClass activateClass = new ActivateClass();
  140. activateClass.SetUpICardEffect("Reveal the top 3 cards of deck", CanUseCondition, card);
  141. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  142. activateClass.SetIsInheritedEffect(true);
  143. activateClass.SetHashString("Reveal3_BT10_059");
  144. cardEffects.Add(activateClass);
  145. string EffectDiscription()
  146. {
  147. return "[When Attacking][Once Per Turn] Reveal the top 3 cards of your deck. Add 1 card with [Legend-Arms] or [Xros Heart] in its traits among them to your hand. Place the rest at the bottom of your deck in any order.";
  148. }
  149. bool CanSelectCardCondition(CardSource cardSource)
  150. {
  151. if (cardSource.CardTraits.Contains("Legend-Arms"))
  152. {
  153. return true;
  154. }
  155. if (cardSource.CardTraits.Contains("Xros Heart"))
  156. {
  157. return true;
  158. }
  159. if (cardSource.CardTraits.Contains("XrosHeart"))
  160. {
  161. return true;
  162. }
  163. return false;
  164. }
  165. bool CanUseCondition(Hashtable hashtable)
  166. {
  167. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  168. }
  169. bool CanActivateCondition(Hashtable hashtable)
  170. {
  171. if (CardEffectCommons.IsExistOnBattleArea(card))
  172. {
  173. return true;
  174. }
  175. return false;
  176. }
  177. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  178. {
  179. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  180. revealCount: 3,
  181. simplifiedSelectCardConditions:
  182. new SimplifiedSelectCardConditionClass[]
  183. {
  184. new SimplifiedSelectCardConditionClass(
  185. canTargetCondition:CanSelectCardCondition,
  186. message: "Select 1 card with [Legend-Arms] or [Xros Heart] in its traits.",
  187. mode: SelectCardEffect.Mode.AddHand,
  188. maxCount: 1,
  189. selectCardCoroutine: null),
  190. },
  191. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  192. activateClass: activateClass
  193. ));
  194. }
  195. }
  196. return cardEffects;
  197. }
  198. }
  199. }