BT9_102.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  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 BT9_102 : 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.OptionSkill)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  17. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[Main] You may trash 1 card with [Cyborg] or [Machine] in its traits in your hand to have all of your level 6 Digimon with [Machine] in their traits gain <Rush> (This Digimon can attack the turn it comes into play) and [On Play] If this Digimon has a digivolution card, <Blitz>. (This Digimon can attack when your opponent has 1 or more memory.)for the turn.";
  22. }
  23. bool CanSelectCardCondition(CardSource cardSource)
  24. {
  25. if (cardSource.CardTraits.Contains("Cyborg"))
  26. {
  27. return true;
  28. }
  29. if (cardSource.CardTraits.Contains("Machine"))
  30. {
  31. return true;
  32. }
  33. return false;
  34. }
  35. bool CanUseCondition(Hashtable hashtable)
  36. {
  37. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  38. }
  39. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  40. {
  41. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  42. {
  43. bool discarded = false;
  44. int discardCount = 1;
  45. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  46. selectHandEffect.SetUp(
  47. selectPlayer: card.Owner,
  48. canTargetCondition: CanSelectCardCondition,
  49. canTargetCondition_ByPreSelecetedList: null,
  50. canEndSelectCondition: null,
  51. maxCount: discardCount,
  52. canNoSelect: true,
  53. canEndNotMax: false,
  54. isShowOpponent: true,
  55. selectCardCoroutine: null,
  56. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  57. mode: SelectHandEffect.Mode.Discard,
  58. cardEffect: activateClass);
  59. yield return StartCoroutine(selectHandEffect.Activate());
  60. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  61. {
  62. if (cardSources.Count >= 1)
  63. {
  64. discarded = true;
  65. yield return null;
  66. }
  67. }
  68. if (discarded)
  69. {
  70. bool PermanentCondition(Permanent permanent)
  71. {
  72. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  73. {
  74. if (permanent.TopCard.CardTraits.Contains("Machine"))
  75. {
  76. if (permanent.TopCard.HasLevel)
  77. {
  78. if (permanent.Level == 6)
  79. {
  80. return true;
  81. }
  82. }
  83. }
  84. }
  85. return false;
  86. }
  87. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainRushPlayerEffect(
  88. permanentCondition: PermanentCondition,
  89. effectDuration: EffectDuration.UntilEachTurnEnd,
  90. activateClass: activateClass));
  91. AddSkillClass addSkillClass = new AddSkillClass();
  92. addSkillClass.SetUpICardEffect("Your Digimon get Blitz", CanUseCondition1, card);
  93. addSkillClass.SetUpAddSkillClass(cardSourceCondition: CardSourceCondition, getEffects: GetEffects);
  94. CardEffectCommons.AddEffectToPlayer(effectDuration: EffectDuration.UntilEachTurnEnd, card: card, cardEffect: addSkillClass, timing: EffectTiming.None);
  95. bool CanUseCondition1(Hashtable hashtable)
  96. {
  97. return true;
  98. }
  99. bool CardSourceCondition(CardSource cardSource)
  100. {
  101. if (CardEffectCommons.IsExistOnBattleArea(cardSource))
  102. {
  103. if (cardSource == cardSource.PermanentOfThisCard().TopCard)
  104. {
  105. if (PermanentCondition(cardSource.PermanentOfThisCard()))
  106. {
  107. return true;
  108. }
  109. }
  110. }
  111. return false;
  112. }
  113. List<ICardEffect> GetEffects(CardSource cardSource, List<ICardEffect> cardEffects, EffectTiming _timing)
  114. {
  115. if (_timing == EffectTiming.OnEnterFieldAnyone)
  116. {
  117. bool Condition()
  118. {
  119. if (CardSourceCondition(cardSource))
  120. {
  121. if (cardSource.PermanentOfThisCard().DigivolutionCards.Count >= 1)
  122. {
  123. return true;
  124. }
  125. }
  126. return false;
  127. }
  128. cardEffects.Add(CardEffectFactory.BlitzSelfEffect(isInheritedEffect: false,
  129. card: cardSource,
  130. condition: Condition,
  131. isWhenDigivolving: false));
  132. }
  133. return cardEffects;
  134. }
  135. }
  136. }
  137. }
  138. }
  139. if (timing == EffectTiming.SecuritySkill)
  140. {
  141. ActivateClass activateClass = new ActivateClass();
  142. activateClass.SetUpICardEffect($"Trash 1 card from hand to delete 1 Digimon", CanUseCondition, card);
  143. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  144. activateClass.SetIsSecurityEffect(true);
  145. cardEffects.Add(activateClass);
  146. string EffectDiscription()
  147. {
  148. return "[Security] You may trash 1 Digimon card with [Cyborg] or [Machine] in its traits in your hand to delete 1 of your opponent's Digimon whose play cost is less than or equal to the trashed card's play cost.";
  149. }
  150. bool CanSelectCardCondition(CardSource cardSource)
  151. {
  152. if (cardSource.CardTraits.Contains("Cyborg"))
  153. {
  154. return true;
  155. }
  156. if (cardSource.CardTraits.Contains("Machine"))
  157. {
  158. return true;
  159. }
  160. return false;
  161. }
  162. bool CanUseCondition(Hashtable hashtable)
  163. {
  164. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  165. }
  166. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  167. {
  168. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  169. {
  170. List<CardSource> selectedCards = new List<CardSource>();
  171. int discardCount = 1;
  172. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  173. selectHandEffect.SetUp(
  174. selectPlayer: card.Owner,
  175. canTargetCondition: CanSelectCardCondition,
  176. canTargetCondition_ByPreSelecetedList: null,
  177. canEndSelectCondition: null,
  178. maxCount: discardCount,
  179. canNoSelect: true,
  180. canEndNotMax: false,
  181. isShowOpponent: true,
  182. selectCardCoroutine: null,
  183. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  184. mode: SelectHandEffect.Mode.Discard,
  185. cardEffect: activateClass);
  186. yield return StartCoroutine(selectHandEffect.Activate());
  187. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  188. {
  189. if (cardSources.Count >= 1)
  190. {
  191. foreach (CardSource cardSource in cardSources)
  192. {
  193. selectedCards.Add(cardSource);
  194. }
  195. yield return null;
  196. }
  197. }
  198. if (selectedCards.Count >= 1)
  199. {
  200. foreach (CardSource selectedCard in selectedCards)
  201. {
  202. bool CanSelectPermanentCondition(Permanent permanent)
  203. {
  204. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  205. {
  206. if (permanent.TopCard.GetCostItself <= selectedCard.GetCostItself)
  207. {
  208. if (permanent.TopCard.HasPlayCost)
  209. {
  210. return true;
  211. }
  212. }
  213. }
  214. return false;
  215. }
  216. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  217. {
  218. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  219. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  220. selectPermanentEffect.SetUp(
  221. selectPlayer: card.Owner,
  222. canTargetCondition: CanSelectPermanentCondition,
  223. canTargetCondition_ByPreSelecetedList: null,
  224. canEndSelectCondition: null,
  225. maxCount: maxCount,
  226. canNoSelect: false,
  227. canEndNotMax: false,
  228. selectPermanentCoroutine: null,
  229. afterSelectPermanentCoroutine: null,
  230. mode: SelectPermanentEffect.Mode.Destroy,
  231. cardEffect: activateClass);
  232. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  233. }
  234. }
  235. }
  236. }
  237. }
  238. }
  239. return cardEffects;
  240. }
  241. }