BT16_075.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT16
  6. {
  7. public class BT16_075 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region On Play
  13. if (timing == EffectTiming.OnEnterFieldAnyone)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Return 1 Dark Animal or Shaman from your trash to your hand.", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[On Play] You may return 1 Digimon with the [Dark Animal] or [Shaman] trait from your trash to your hand.";
  22. }
  23. bool CanSelectCardCondition(CardSource cardSource)
  24. {
  25. if (cardSource.IsDigimon)
  26. {
  27. if (cardSource.CardTraits.Contains("Dark Animal"))
  28. {
  29. return true;
  30. }
  31. if (cardSource.CardTraits.Contains("DarkAnimal"))
  32. {
  33. return true;
  34. }
  35. if (cardSource.CardTraits.Contains("Shaman"))
  36. {
  37. return true;
  38. }
  39. }
  40. return false;
  41. }
  42. bool CanUseCondition(Hashtable hashtable)
  43. {
  44. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  45. }
  46. bool CanActivateCondition(Hashtable hashtable)
  47. {
  48. if (CardEffectCommons.IsExistOnBattleArea(card))
  49. {
  50. return true;
  51. }
  52. return false;
  53. }
  54. IEnumerator ActivateCoroutine(Hashtable hashtable)
  55. {
  56. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  57. {
  58. int maxCount = Math.Min(1, card.Owner.TrashCards.Count(CanSelectCardCondition));
  59. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  60. selectCardEffect.SetUp(
  61. canTargetCondition: CanSelectCardCondition,
  62. canTargetCondition_ByPreSelecetedList: null,
  63. canEndSelectCondition: null,
  64. canNoSelect: () => true,
  65. selectCardCoroutine: null,
  66. afterSelectCardCoroutine: null,
  67. message: "Select 1 card to add to your hand.",
  68. maxCount: maxCount,
  69. canEndNotMax: false,
  70. isShowOpponent: true,
  71. mode: SelectCardEffect.Mode.AddHand,
  72. root: SelectCardEffect.Root.Trash,
  73. customRootCardList: null,
  74. canLookReverseCard: true,
  75. selectPlayer: card.Owner,
  76. cardEffect: activateClass);
  77. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  78. }
  79. }
  80. }
  81. #endregion
  82. #region When Digivolving
  83. if (timing == EffectTiming.OnEnterFieldAnyone)
  84. {
  85. ActivateClass activateClass = new ActivateClass();
  86. activateClass.SetUpICardEffect("Return 1 Dark Animal or Shaman from your trash to your hand.", CanUseCondition, card);
  87. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  88. cardEffects.Add(activateClass);
  89. string EffectDiscription()
  90. {
  91. return "[When Digivolving] You may return 1 Digimon with the [Dark Animal] or [Shaman] trait from your trash to your hand.";
  92. }
  93. bool CanSelectCardCondition(CardSource cardSource)
  94. {
  95. if (cardSource.IsDigimon)
  96. {
  97. if (cardSource.CardTraits.Contains("Dark Animal"))
  98. {
  99. return true;
  100. }
  101. if (cardSource.CardTraits.Contains("DarkAnimal"))
  102. {
  103. return true;
  104. }
  105. if (cardSource.CardTraits.Contains("Shaman"))
  106. {
  107. return true;
  108. }
  109. }
  110. return false;
  111. }
  112. bool CanUseCondition(Hashtable hashtable)
  113. {
  114. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  115. }
  116. bool CanActivateCondition(Hashtable hashtable)
  117. {
  118. if (CardEffectCommons.IsExistOnBattleArea(card))
  119. {
  120. return true;
  121. }
  122. return false;
  123. }
  124. IEnumerator ActivateCoroutine(Hashtable hashtable)
  125. {
  126. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  127. {
  128. int maxCount = Math.Min(1, card.Owner.TrashCards.Count(CanSelectCardCondition));
  129. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  130. selectCardEffect.SetUp(
  131. canTargetCondition: CanSelectCardCondition,
  132. canTargetCondition_ByPreSelecetedList: null,
  133. canEndSelectCondition: null,
  134. canNoSelect: () => true,
  135. selectCardCoroutine: null,
  136. afterSelectCardCoroutine: null,
  137. message: "Select 1 card to add to your hand.",
  138. maxCount: maxCount,
  139. canEndNotMax: false,
  140. isShowOpponent: true,
  141. mode: SelectCardEffect.Mode.AddHand,
  142. root: SelectCardEffect.Root.Trash,
  143. customRootCardList: null,
  144. canLookReverseCard: true,
  145. selectPlayer: card.Owner,
  146. cardEffect: activateClass);
  147. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  148. }
  149. }
  150. }
  151. #endregion
  152. #region Inherit
  153. if (timing == EffectTiming.OnEnterFieldAnyone)
  154. {
  155. ActivateClass activateClass = new ActivateClass();
  156. activateClass.SetUpICardEffect("Give a Digimon rush.", CanUseCondition, card);
  157. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  158. activateClass.SetIsInheritedEffect(true);
  159. activateClass.SetHashString("Rush_BT16_075");
  160. cardEffects.Add(activateClass);
  161. string EffectDiscription()
  162. {
  163. return "[Your Turn] When an effect plays one of your Digimon, 1 of your Digimon gains [Rush] for the turn.";
  164. }
  165. bool PermanentCondition(Permanent permanent)
  166. {
  167. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  168. {
  169. if (permanent.IsDigimon)
  170. {
  171. return true;
  172. }
  173. }
  174. return false;
  175. }
  176. bool CanUseCondition(Hashtable hashtable)
  177. {
  178. if (CardEffectCommons.IsExistOnBattleArea(card))
  179. {
  180. if (CardEffectCommons.IsOwnerTurn(card))
  181. {
  182. if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentCondition))
  183. {
  184. if (CardEffectCommons.IsByEffect(hashtable, null))
  185. {
  186. return true;
  187. }
  188. }
  189. }
  190. }
  191. return false;
  192. }
  193. bool CanActivateCondition(Hashtable hashtable)
  194. {
  195. if (CardEffectCommons.IsExistOnBattleArea(card))
  196. {
  197. return true;
  198. }
  199. return false;
  200. }
  201. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  202. {
  203. if (CardEffectCommons.HasMatchConditionPermanent(PermanentCondition))
  204. {
  205. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(PermanentCondition));
  206. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  207. selectPermanentEffect.SetUp(
  208. selectPlayer: card.Owner,
  209. canTargetCondition: PermanentCondition,
  210. canTargetCondition_ByPreSelecetedList: null,
  211. canEndSelectCondition: null,
  212. maxCount: maxCount,
  213. canNoSelect: false,
  214. canEndNotMax: false,
  215. selectPermanentCoroutine: SelectPermanentCoroutine,
  216. afterSelectPermanentCoroutine: null,
  217. mode: SelectPermanentEffect.Mode.Custom,
  218. cardEffect: activateClass);
  219. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get Rush.", "The opponent is selecting 1 Digimon that will get Rush.");
  220. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  221. IEnumerator SelectPermanentCoroutine(Permanent selectedPermanent)
  222. {
  223. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainRush(
  224. targetPermanent: selectedPermanent,
  225. effectDuration: EffectDuration.UntilEachTurnEnd,
  226. activateClass: activateClass));
  227. }
  228. }
  229. }
  230. }
  231. #endregion
  232. return cardEffects;
  233. }
  234. }
  235. }