BT7_085.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  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. public class BT7_085 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. if (timing == EffectTiming.SecuritySkill)
  14. {
  15. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  16. }
  17. if (timing == EffectTiming.OnDeclaration)
  18. {
  19. ActivateClass activateClass = new ActivateClass();
  20. activateClass.SetUpICardEffect("Place cards from trash to digivolution cards and digivolve", CanUseCondition, card);
  21. activateClass.SetUpActivateClass(null, ActivateCoroutine, 1, false, EffectDiscription());
  22. activateClass.SetHashString("Digivolve_BT7_085");
  23. cardEffects.Add(activateClass);
  24. string EffectDiscription()
  25. {
  26. return "[Main][Once Per Turn] You may place 5 cards with [Hybrid] in their traits from your trash under this Tamer in any order to digivolve it into an [EmperorGreymon] in your hand for its digivolution cost as if this Tamer is a level 5 red Digimon.";
  27. }
  28. bool CanSelectCardCondition(CardSource cardSource)
  29. {
  30. return cardSource.CardTraits.Contains("Hybrid");
  31. }
  32. bool CanSelectCardCondition1(CardSource cardSource)
  33. {
  34. return cardSource.CardNames.Contains("EmperorGreymon");
  35. }
  36. bool CanUseCondition(Hashtable hashtable)
  37. {
  38. if (CardEffectCommons.IsExistOnBattleArea(card))
  39. {
  40. if (card.Owner.TrashCards.Count(CanSelectCardCondition) >= 5)
  41. {
  42. return true;
  43. }
  44. }
  45. return false;
  46. }
  47. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  48. {
  49. if (CardEffectCommons.IsExistOnBattleArea(card))
  50. {
  51. if (card.Owner.TrashCards.Count(CanSelectCardCondition) >= 5)
  52. {
  53. List<CardSource> selectedCards = new List<CardSource>();
  54. int maxCount = 5;
  55. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  56. selectCardEffect.SetUp(
  57. canTargetCondition: CanSelectCardCondition,
  58. canTargetCondition_ByPreSelecetedList: null,
  59. canEndSelectCondition: null,
  60. canNoSelect: () => false,
  61. selectCardCoroutine: SelectCardCoroutine,
  62. afterSelectCardCoroutine: null,
  63. message: "Select cards to place in Digivolution cards\n(cards will be placed so that cards with lower numbers are on top).",
  64. maxCount: maxCount,
  65. canEndNotMax: false,
  66. isShowOpponent: true,
  67. mode: SelectCardEffect.Mode.Custom,
  68. root: SelectCardEffect.Root.Trash,
  69. customRootCardList: null,
  70. canLookReverseCard: true,
  71. selectPlayer: card.Owner,
  72. cardEffect: activateClass);
  73. selectCardEffect.SetUpCustomMessage("Select cards to place in Digivolution cards.", "The opponent is selecting cards to place in Digivolution cards.");
  74. selectCardEffect.SetUpCustomMessage_ShowCard("Digivolution Cards");
  75. yield return StartCoroutine(selectCardEffect.Activate());
  76. IEnumerator SelectCardCoroutine(CardSource cardSource)
  77. {
  78. selectedCards.Add(cardSource);
  79. yield return null;
  80. }
  81. List<CardSource> digivolutionCards = new List<CardSource>();
  82. if (selectedCards.Count == 5)
  83. {
  84. selectCardEffect.SetUp(
  85. canTargetCondition: (cardSource) => true,
  86. canTargetCondition_ByPreSelecetedList: null,
  87. canEndSelectCondition: null,
  88. canNoSelect: () => false,
  89. selectCardCoroutine: null,
  90. afterSelectCardCoroutine: AfterSelectCardCoroutine1,
  91. message: "Specify the order to place the cards in the digivolution cards\n(cards will be placed so that cards with lower numbers are on top).",
  92. maxCount: selectedCards.Count,
  93. canEndNotMax: false,
  94. isShowOpponent: false,
  95. mode: SelectCardEffect.Mode.Custom,
  96. root: SelectCardEffect.Root.Custom,
  97. customRootCardList: selectedCards,
  98. canLookReverseCard: true,
  99. selectPlayer: card.Owner,
  100. cardEffect: activateClass);
  101. selectCardEffect.SetUpCustomMessage_ShowCard("Digivolution Cards");
  102. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  103. IEnumerator AfterSelectCardCoroutine1(List<CardSource> cardSources)
  104. {
  105. foreach (CardSource cardSource in cardSources)
  106. {
  107. digivolutionCards.Add(cardSource);
  108. }
  109. yield return null;
  110. }
  111. }
  112. if (digivolutionCards.Count == 5)
  113. {
  114. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(digivolutionCards, activateClass));
  115. #region treat as red level 5 Digimon
  116. CardSource topCard = card.PermanentOfThisCard().TopCard;
  117. #region treat as red
  118. ChangeCardColorClass changeCardColorClass = new ChangeCardColorClass();
  119. changeCardColorClass.SetUpICardEffect($"Treated as red", CanUseCondition1, card);
  120. changeCardColorClass.SetUpChangeCardColorClass(ChangeCardColors: ChangeCardColors);
  121. changeCardColorClass.SetNotShowUI(true);
  122. bool CanUseCondition1(Hashtable hashtable)
  123. {
  124. if (CardEffectCommons.IsExistOnBattleArea(card))
  125. {
  126. if (card == topCard)
  127. {
  128. if (topCard == card.PermanentOfThisCard().TopCard)
  129. {
  130. return true;
  131. }
  132. }
  133. }
  134. return false;
  135. }
  136. List<CardColor> ChangeCardColors(CardSource cardSource, List<CardColor> CardColors)
  137. {
  138. if (cardSource == card)
  139. {
  140. CardColors.Add(CardColor.Red);
  141. }
  142. return CardColors;
  143. }
  144. #endregion
  145. #region treat as level 5
  146. ChangePermanentLevelClass changePermanentLevelClass = new ChangePermanentLevelClass();
  147. changePermanentLevelClass.SetUpICardEffect($"Treated as level 5", CanUseCondition1, card);
  148. changePermanentLevelClass.SetUpChangePermanentLevelClass(GetLevel: GetLevel);
  149. changePermanentLevelClass.SetNotShowUI(true);
  150. int GetLevel(Permanent permanent, int level)
  151. {
  152. if (CardEffectCommons.IsExistOnBattleArea(card))
  153. {
  154. if (permanent == card.PermanentOfThisCard())
  155. {
  156. level = 5;
  157. }
  158. }
  159. return level;
  160. }
  161. #endregion
  162. #region treat as Digimon
  163. TreatAsDigimonClass treatAsDigimonClass = new TreatAsDigimonClass();
  164. treatAsDigimonClass.SetUpICardEffect($"Treated as Digimon", CanUseCondition1, card);
  165. treatAsDigimonClass.SetUpTreatAsDigimonClass(permanentCondition: PermanentCondition);
  166. treatAsDigimonClass.SetNotShowUI(true);
  167. bool PermanentCondition(Permanent permanent)
  168. {
  169. if (CardEffectCommons.IsExistOnBattleArea(card))
  170. {
  171. if (permanent == card.PermanentOfThisCard())
  172. {
  173. return true;
  174. }
  175. }
  176. return false;
  177. }
  178. #endregion
  179. #region treat as not having DP(not to show on UI)
  180. DontHaveDPClass dontHaveDPClass = new DontHaveDPClass();
  181. dontHaveDPClass.SetUpICardEffect("Doesn't have DP", CanUseCondition1, card);
  182. dontHaveDPClass.SetUpDontHaveDPClass(PermanentCondition: PermanentCondition);
  183. dontHaveDPClass.SetNotShowUI(true);
  184. #endregion
  185. List<Func<EffectTiming, ICardEffect>> GetCardEffects = new List<Func<EffectTiming, ICardEffect>>()
  186. {
  187. (_timing) => changeCardColorClass,
  188. (_timing) => changePermanentLevelClass,
  189. (_timing) => treatAsDigimonClass,
  190. (_timing) => dontHaveDPClass,
  191. };
  192. foreach (Func<EffectTiming, ICardEffect> GetCardEffect in GetCardEffects)
  193. {
  194. card.PermanentOfThisCard().PermanentEffects.Add(GetCardEffect);
  195. }
  196. #endregion
  197. card.PermanentOfThisCard().IsPlaceToTrashDueToNotHavingDP = false;
  198. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  199. targetPermanent: card.PermanentOfThisCard(),
  200. cardCondition: CanSelectCardCondition1,
  201. payCost: true,
  202. reduceCostTuple: null,
  203. fixedCostTuple: null,
  204. ignoreDigivolutionRequirementFixedCost: -1,
  205. isHand: true,
  206. activateClass: activateClass,
  207. successProcess: null));
  208. #region release effects
  209. if (CardEffectCommons.IsExistOnBattleArea(card))
  210. {
  211. foreach (Func<EffectTiming, ICardEffect> GetCardEffect in GetCardEffects)
  212. {
  213. card.PermanentOfThisCard().PermanentEffects.Remove(GetCardEffect);
  214. }
  215. card.PermanentOfThisCard().IsPlaceToTrashDueToNotHavingDP = true;
  216. }
  217. #endregion
  218. }
  219. }
  220. }
  221. }
  222. }
  223. if (timing == EffectTiming.None)
  224. {
  225. bool Condition()
  226. {
  227. if (CardEffectCommons.IsExistOnBattleArea(card))
  228. {
  229. if (CardEffectCommons.IsOwnerTurn(card))
  230. {
  231. return true;
  232. }
  233. }
  234. return false;
  235. }
  236. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(changeValue: 2000, isInheritedEffect: true, card: card, condition: Condition));
  237. }
  238. if (timing == EffectTiming.None)
  239. {
  240. bool Condition()
  241. {
  242. if (CardEffectCommons.IsExistOnBattleArea(card))
  243. {
  244. if (CardEffectCommons.IsOwnerTurn(card))
  245. {
  246. if (card.PermanentOfThisCard().DP >= 10000)
  247. {
  248. return true;
  249. }
  250. }
  251. }
  252. return false;
  253. }
  254. cardEffects.Add(CardEffectFactory.ChangeSelfSAttackStaticEffect(changeValue: 1, isInheritedEffect: true, card: card, condition: Condition));
  255. }
  256. return cardEffects;
  257. }
  258. }