BT13_055.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT13
  6. {
  7. public class BT13_055 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. if (timing == EffectTiming.OnDeclaration)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("Your 1 [Angoramon] digivolves into this card", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[Hand][Main] If you have [Ruli Tsukiyono], by placing 1 [SymbareAngoramon] from your hand as 1 of your [Angoramon]'s bottom digivolution card, that Digimon digivolves into this card for a digivolution cost of 3, ignoring digivolution requirements.";
  21. }
  22. bool CanSelectCardCondition(CardSource cardSource)
  23. {
  24. if (cardSource != null)
  25. {
  26. if (cardSource.CardNames.Contains("SymbareAngoramon"))
  27. {
  28. if (cardSource.Owner == card.Owner)
  29. {
  30. return true;
  31. }
  32. }
  33. }
  34. return false;
  35. }
  36. bool CanSelectPermanentCondition(Permanent permanent)
  37. {
  38. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  39. {
  40. if (permanent.TopCard.CardNames.Contains("Angoramon"))
  41. {
  42. if (!permanent.IsToken)
  43. {
  44. return true;
  45. }
  46. }
  47. }
  48. return false;
  49. }
  50. bool CanUseCondition(Hashtable hashtable)
  51. {
  52. if (card.Owner.HandCards.Contains(card))
  53. {
  54. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.TopCard.CardNames.Contains("Ruli Tsukiyono") || permanent.TopCard.CardNames.Contains("RuliTsukiyono")))
  55. {
  56. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  57. {
  58. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  59. {
  60. return true;
  61. }
  62. }
  63. }
  64. }
  65. return false;
  66. }
  67. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  68. {
  69. if (card.Owner.HandCards.Contains(card))
  70. {
  71. bool added = false;
  72. Permanent selectedPermanent = null;
  73. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  74. {
  75. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  76. {
  77. CardSource selectedCard = null;
  78. int maxCount = 1;
  79. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  80. selectHandEffect.SetUp(
  81. selectPlayer: card.Owner,
  82. canTargetCondition: CanSelectCardCondition,
  83. canTargetCondition_ByPreSelecetedList: null,
  84. canEndSelectCondition: null,
  85. maxCount: maxCount,
  86. canNoSelect: true,
  87. canEndNotMax: false,
  88. isShowOpponent: true,
  89. selectCardCoroutine: SelectCardCoroutine,
  90. afterSelectCardCoroutine: null,
  91. mode: SelectHandEffect.Mode.Custom,
  92. cardEffect: activateClass);
  93. selectHandEffect.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.");
  94. yield return StartCoroutine(selectHandEffect.Activate());
  95. IEnumerator SelectCardCoroutine(CardSource cardSource)
  96. {
  97. selectedCard = cardSource;
  98. yield return null;
  99. }
  100. if (selectedCard != null)
  101. {
  102. maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  103. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  104. selectPermanentEffect.SetUp(
  105. selectPlayer: card.Owner,
  106. canTargetCondition: CanSelectPermanentCondition,
  107. canTargetCondition_ByPreSelecetedList: null,
  108. canEndSelectCondition: null,
  109. maxCount: maxCount,
  110. canNoSelect: true,
  111. canEndNotMax: false,
  112. selectPermanentCoroutine: SelectPermanentCoroutine,
  113. afterSelectPermanentCoroutine: null,
  114. mode: SelectPermanentEffect.Mode.Custom,
  115. cardEffect: activateClass);
  116. selectPermanentEffect.SetUpCustomMessage("Select 1 [Angoramon] that will get a digivolution card.", "The opponent is selecting 1 [Angoramon] that will get a digivolution card.");
  117. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  118. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  119. {
  120. selectedPermanent = permanent;
  121. if (selectedPermanent != null)
  122. {
  123. yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddDigivolutionCardsBottom(new List<CardSource>() { selectedCard }, activateClass));
  124. added = true;
  125. }
  126. }
  127. }
  128. }
  129. }
  130. if (added)
  131. {
  132. if (selectedPermanent != null)
  133. {
  134. if (card.Owner.HandCards.Contains(card))
  135. {
  136. #region ignore digivolution requirement
  137. AddDigivolutionRequirementClass addEvolutionConditionClass = new AddDigivolutionRequirementClass();
  138. addEvolutionConditionClass.SetUpICardEffect("Ignore Digivolution requirements", CanUseCondition1, card);
  139. addEvolutionConditionClass.SetUpAddDigivolutionRequirementClass(getEvoCost: GetEvoCost);
  140. Func<EffectTiming, ICardEffect> getCardEffect = GetCardEffect;
  141. card.Owner.UntilCalculateFixedCostEffect.Add(getCardEffect);
  142. ICardEffect GetCardEffect(EffectTiming _timing)
  143. {
  144. if (_timing == EffectTiming.None)
  145. {
  146. return addEvolutionConditionClass;
  147. }
  148. return null;
  149. }
  150. bool CanUseCondition1(Hashtable hashtable)
  151. {
  152. return true;
  153. }
  154. int GetEvoCost(Permanent permanent, CardSource cardSource, CardEffectCommons.IgnoreRequirement ignore, bool checkAvailability)
  155. {
  156. if (card.Owner.CanIgnoreDigivolutionRequirement(permanent, cardSource))
  157. {
  158. if (CardSourceCondition(cardSource) && PermanentCondition(permanent))
  159. {
  160. return 3;
  161. }
  162. }
  163. return -1;
  164. }
  165. bool PermanentCondition(Permanent targetPermanent)
  166. {
  167. return targetPermanent == selectedPermanent;
  168. }
  169. bool CardSourceCondition(CardSource cardSource)
  170. {
  171. return cardSource == card;
  172. }
  173. #endregion
  174. if (card.CanPlayCardTargetFrame(selectedPermanent.PermanentFrame, true, activateClass))
  175. {
  176. yield return ContinuousController.instance.StartCoroutine(new PlayCardClass(
  177. cardSources: new List<CardSource>() { card },
  178. hashtable: CardEffectCommons.CardEffectHashtable(activateClass),
  179. payCost: true,
  180. targetPermanent: selectedPermanent,
  181. isTapped: false,
  182. root: SelectCardEffect.Root.Hand,
  183. activateETB: true).PlayCard());
  184. }
  185. #region release effect
  186. card.Owner.UntilCalculateFixedCostEffect.Remove(getCardEffect);
  187. #endregion
  188. }
  189. }
  190. }
  191. }
  192. }
  193. }
  194. if (timing == EffectTiming.OnEndBattle)
  195. {
  196. ActivateClass activateClass = new ActivateClass();
  197. activateClass.SetUpICardEffect("Trash the top card of opponent's security", CanUseCondition, card);
  198. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  199. activateClass.SetIsInheritedEffect(true);
  200. activateClass.SetHashString("TrashSecurity_BT13_055");
  201. cardEffects.Add(activateClass);
  202. string EffectDiscription()
  203. {
  204. return "[Your Turn][Once Per Turn] When this Digimon deletes an opponent's Digimon in battle, trash the top card of your opponent's security stack.";
  205. }
  206. bool CanUseCondition(Hashtable hashtable)
  207. {
  208. if (CardEffectCommons.IsExistOnBattleArea(card))
  209. {
  210. if (CardEffectCommons.IsOwnerTurn(card))
  211. {
  212. bool WinnerCondition(Permanent permanent) => permanent.cardSources.Contains(card);
  213. bool LoserCondition(Permanent permanent) => CardEffectCommons.IsOpponentPermanent(permanent, card);
  214. if (CardEffectCommons.CanTriggerWhenDeleteOpponentDigimonByBattle(hashtable: hashtable, winnerCondition: WinnerCondition, loserCondition: LoserCondition, isOnlyWinnerSurvive: false))
  215. {
  216. return true;
  217. }
  218. }
  219. }
  220. return false;
  221. }
  222. bool CanActivateCondition(Hashtable hashtable)
  223. {
  224. if (CardEffectCommons.IsExistOnBattleArea(card))
  225. {
  226. if (card.Owner.Enemy.SecurityCards.Count >= 1)
  227. {
  228. if (CardEffectCommons.IsOwnerTurn(card))
  229. {
  230. return true;
  231. }
  232. }
  233. }
  234. return false;
  235. }
  236. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  237. {
  238. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  239. player: card.Owner.Enemy,
  240. destroySecurityCount: 1,
  241. cardEffect: activateClass,
  242. fromTop: true).DestroySecurity());
  243. }
  244. }
  245. return cardEffects;
  246. }
  247. }
  248. }