BT12_055.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT12
  5. {
  6. public class BT12_055 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. if (timing == EffectTiming.None)
  12. {
  13. AddJogressConditionClass addJogressConditionClass = new AddJogressConditionClass();
  14. addJogressConditionClass.SetUpICardEffect($"DNA Digivolution", CanUseCondition, card);
  15. addJogressConditionClass.SetUpAddJogressConditionClass(getJogressCondition: GetJogress);
  16. addJogressConditionClass.SetNotShowUI(true);
  17. cardEffects.Add(addJogressConditionClass);
  18. bool CanUseCondition(Hashtable hashtable)
  19. {
  20. return true;
  21. }
  22. JogressCondition GetJogress(CardSource cardSource)
  23. {
  24. if (cardSource == card)
  25. {
  26. bool PermanentCondition1(Permanent permanent)
  27. {
  28. if (permanent != null)
  29. {
  30. if (permanent.TopCard != null)
  31. {
  32. if (permanent.TopCard.Owner == card.Owner)
  33. {
  34. if (permanent.IsDigimon)
  35. {
  36. if (permanent.TopCard.Owner.GetBattleAreaPermanents().Contains(permanent))
  37. {
  38. if (permanent.TopCard.CardColors.Contains(CardColor.Blue))
  39. {
  40. if (permanent.Levels_ForJogress(card).Contains(4))
  41. {
  42. return true;
  43. }
  44. }
  45. }
  46. }
  47. }
  48. }
  49. }
  50. return false;
  51. }
  52. bool PermanentCondition2(Permanent permanent)
  53. {
  54. if (permanent != null)
  55. {
  56. if (permanent.TopCard != null)
  57. {
  58. if (permanent.TopCard.Owner == card.Owner)
  59. {
  60. if (permanent.IsDigimon)
  61. {
  62. if (permanent.TopCard.Owner.GetBattleAreaPermanents().Contains(permanent))
  63. {
  64. if (permanent.TopCard.CardColors.Contains(CardColor.Green))
  65. {
  66. if (permanent.Levels_ForJogress(card).Contains(4))
  67. {
  68. return true;
  69. }
  70. }
  71. }
  72. }
  73. }
  74. }
  75. }
  76. return false;
  77. }
  78. JogressConditionElement[] elements = new JogressConditionElement[]
  79. {
  80. new JogressConditionElement(PermanentCondition1, "a level 4 blue Digimon"),
  81. new JogressConditionElement(PermanentCondition2, "a level 4 green Digimon"),
  82. };
  83. JogressCondition jogressCondition = new JogressCondition(elements, 0);
  84. return jogressCondition;
  85. }
  86. return null;
  87. }
  88. }
  89. if (timing == EffectTiming.OnEnterFieldAnyone)
  90. {
  91. ActivateClass activateClass = new ActivateClass();
  92. activateClass.SetUpICardEffect("Suspend 1 Digimon, this Digimon gains DP + 3000 and it can attack to opponent's 1 Digimon", CanUseCondition, card);
  93. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  94. cardEffects.Add(activateClass);
  95. string EffectDiscription()
  96. {
  97. return "[When Digivolving] If DNA digivolving, suspend 1 of your opponent's Digimon, and this Digimon gets +3000 DP for the turn. Then, you may attack your opponent's Digimon with this Digimon.";
  98. }
  99. bool CanSelectPermanentCondition(Permanent permanent)
  100. {
  101. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  102. }
  103. bool CanUseCondition(Hashtable hashtable)
  104. {
  105. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  106. }
  107. bool CanActivateCondition(Hashtable hashtable)
  108. {
  109. if (CardEffectCommons.IsExistOnBattleArea(card))
  110. {
  111. bool isJogress = CardEffectCommons.IsJogress(hashtable);
  112. if (isJogress)
  113. {
  114. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  115. {
  116. return true;
  117. }
  118. }
  119. if (card.PermanentOfThisCard().CanAttack(activateClass))
  120. {
  121. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, (permanent) => permanent.IsDigimon && card.PermanentOfThisCard().CanAttackTargetDigimon(permanent, activateClass)))
  122. {
  123. return true;
  124. }
  125. }
  126. }
  127. return false;
  128. }
  129. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  130. {
  131. bool isJogress = CardEffectCommons.IsJogress(_hashtable);
  132. if (isJogress)
  133. {
  134. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  135. {
  136. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  137. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  138. selectPermanentEffect.SetUp(
  139. selectPlayer: card.Owner,
  140. canTargetCondition: CanSelectPermanentCondition,
  141. canTargetCondition_ByPreSelecetedList: null,
  142. canEndSelectCondition: null,
  143. maxCount: maxCount,
  144. canNoSelect: false,
  145. canEndNotMax: false,
  146. selectPermanentCoroutine: null,
  147. afterSelectPermanentCoroutine: null,
  148. mode: SelectPermanentEffect.Mode.Tap,
  149. cardEffect: activateClass);
  150. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  151. }
  152. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: card.PermanentOfThisCard(), changeValue: 3000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  153. }
  154. Permanent selectedPermanent = card.PermanentOfThisCard();
  155. if (selectedPermanent != null)
  156. {
  157. if (selectedPermanent.CanAttack(activateClass))
  158. {
  159. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  160. selectAttackEffect.SetUp(
  161. attacker: selectedPermanent,
  162. canAttackPlayerCondition: () => false,
  163. defenderCondition: (permanent) => true,
  164. cardEffect: activateClass);
  165. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  166. }
  167. }
  168. }
  169. }
  170. if (timing == EffectTiming.OnEndBattle)
  171. {
  172. ActivateClass activateClass = new ActivateClass();
  173. activateClass.SetUpICardEffect("Trash the top card of opponent's security", CanUseCondition, card);
  174. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  175. activateClass.SetIsInheritedEffect(true);
  176. activateClass.SetHashString("TrashSecurity_BT12_055");
  177. cardEffects.Add(activateClass);
  178. string EffectDiscription()
  179. {
  180. return "[Your Turn][Once Per Turn] If one of your Digimon that has [Imperialdramon] in its name or a [Free] trait deletes an opponent's Digimon in battle, trash the top card of your opponent's security stack.";
  181. }
  182. bool PermanentCondition(Permanent permanent)
  183. {
  184. if (CardEffectCommons.IsOwnerPermanent(permanent, card))
  185. {
  186. if (permanent.TopCard.ContainsCardName("Imperialdramon"))
  187. {
  188. return true;
  189. }
  190. if (permanent.TopCard.CardTraits.Contains("Free"))
  191. {
  192. return true;
  193. }
  194. }
  195. return false;
  196. }
  197. bool CanUseCondition(Hashtable hashtable)
  198. {
  199. if (CardEffectCommons.IsExistOnBattleArea(card))
  200. {
  201. if (CardEffectCommons.IsOwnerTurn(card))
  202. {
  203. bool WinnerCondition(Permanent permanent) => PermanentCondition(permanent);
  204. bool LoserCondition(Permanent permanent) => CardEffectCommons.IsOpponentPermanent(permanent, card);
  205. if (CardEffectCommons.CanTriggerWhenDeleteOpponentDigimonByBattle(hashtable: hashtable, winnerCondition: WinnerCondition, loserCondition: LoserCondition, isOnlyWinnerSurvive: false))
  206. {
  207. return true;
  208. }
  209. }
  210. }
  211. return false;
  212. }
  213. bool CanActivateCondition(Hashtable hashtable)
  214. {
  215. if (CardEffectCommons.IsExistOnBattleArea(card))
  216. {
  217. return true;
  218. }
  219. return false;
  220. }
  221. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  222. {
  223. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  224. player: card.Owner.Enemy,
  225. destroySecurityCount: 1,
  226. cardEffect: activateClass,
  227. fromTop: true).DestroySecurity());
  228. }
  229. }
  230. return cardEffects;
  231. }
  232. }
  233. }