BT12_082.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT12
  6. {
  7. public class BT12_082 : 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.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.CardNames.Contains("Baalmon");
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false, card: card, condition: null));
  19. }
  20. if (timing == EffectTiming.OnEnterFieldAnyone)
  21. {
  22. ActivateClass activateClass = new ActivateClass();
  23. activateClass.SetUpICardEffect("Return 1 [X Antibody] from trash to hand", CanUseCondition, card);
  24. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  25. cardEffects.Add(activateClass);
  26. string EffectDiscription()
  27. {
  28. return "[When Digivolving] Return 1 [X Antibody] card from your trash to your hand.";
  29. }
  30. bool CanSelectCardCondition(CardSource cardSource)
  31. {
  32. if (cardSource != null)
  33. {
  34. if (cardSource.Owner == card.Owner)
  35. {
  36. if (cardSource.CardNames.Contains("X Antibody"))
  37. {
  38. return true;
  39. }
  40. if (cardSource.CardNames.Contains("XAntibody"))
  41. {
  42. return true;
  43. }
  44. }
  45. }
  46. return false;
  47. }
  48. bool CanUseCondition(Hashtable hashtable)
  49. {
  50. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  51. }
  52. bool CanActivateCondition(Hashtable hashtable)
  53. {
  54. if (CardEffectCommons.IsExistOnBattleArea(card))
  55. {
  56. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  57. {
  58. return true;
  59. }
  60. }
  61. return false;
  62. }
  63. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  64. {
  65. if (isExistOnField(card))
  66. {
  67. if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard()))
  68. {
  69. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  70. {
  71. int maxCount = Math.Min(1, card.Owner.TrashCards.Count(CanSelectCardCondition));
  72. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  73. selectCardEffect.SetUp(
  74. canTargetCondition: CanSelectCardCondition,
  75. canTargetCondition_ByPreSelecetedList: null,
  76. canEndSelectCondition: null,
  77. canNoSelect: () => false,
  78. selectCardCoroutine: null,
  79. afterSelectCardCoroutine: null,
  80. message: "Select 1 [X Antibody] to add to your hand.",
  81. maxCount: maxCount,
  82. canEndNotMax: false,
  83. isShowOpponent: true,
  84. mode: SelectCardEffect.Mode.AddHand,
  85. root: SelectCardEffect.Root.Trash,
  86. customRootCardList: null,
  87. canLookReverseCard: true,
  88. selectPlayer: card.Owner,
  89. cardEffect: activateClass);
  90. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  91. }
  92. }
  93. }
  94. }
  95. }
  96. if (timing == EffectTiming.OnEnterFieldAnyone)
  97. {
  98. ActivateClass activateClass = new ActivateClass();
  99. activateClass.SetUpICardEffect("Trash 3 cards from deck top or delete a level 4 or lower Digimon", CanUseCondition, card);
  100. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  101. cardEffects.Add(activateClass);
  102. string EffectDiscription()
  103. {
  104. return "[When Digivolving] Trash the top 3 cards of your deck. If this Digimon has [Baalmon] or [X Antibody] in its digivolution cards, delete 1 of your opponent's level 4 or lower Digimon instead.";
  105. }
  106. bool CanSelectPermanentCondition(Permanent permanent)
  107. {
  108. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  109. {
  110. if (permanent.Level <= 4)
  111. {
  112. if (permanent.TopCard.HasLevel)
  113. {
  114. return true;
  115. }
  116. }
  117. }
  118. return false;
  119. }
  120. bool CanUseCondition(Hashtable hashtable)
  121. {
  122. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  123. }
  124. bool CanActivateCondition(Hashtable hashtable)
  125. {
  126. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  127. {
  128. if (card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => cardSource.CardNames.Contains("Baalmon") || cardSource.CardNames.Contains("X Antibody") || cardSource.CardNames.Contains("XAntibody")) >= 1)
  129. {
  130. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  131. {
  132. return true;
  133. }
  134. }
  135. else
  136. {
  137. if (card.Owner.LibraryCards.Count >= 1)
  138. {
  139. return true;
  140. }
  141. }
  142. }
  143. return false;
  144. }
  145. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  146. {
  147. if (card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => cardSource.CardNames.Contains("Baalmon") || cardSource.CardNames.Contains("X Antibody") || cardSource.CardNames.Contains("XAntibody")) >= 1)
  148. {
  149. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  150. {
  151. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  152. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  153. selectPermanentEffect.SetUp(
  154. selectPlayer: card.Owner,
  155. canTargetCondition: CanSelectPermanentCondition,
  156. canTargetCondition_ByPreSelecetedList: null,
  157. canEndSelectCondition: null,
  158. maxCount: maxCount,
  159. canNoSelect: false,
  160. canEndNotMax: false,
  161. selectPermanentCoroutine: null,
  162. afterSelectPermanentCoroutine: null,
  163. mode: SelectPermanentEffect.Mode.Destroy,
  164. cardEffect: activateClass);
  165. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  166. }
  167. }
  168. else
  169. {
  170. if (card.Owner.LibraryCards.Count >= 1)
  171. yield return ContinuousController.instance.StartCoroutine(new IAddTrashCardsFromLibraryTop(3, card.Owner, activateClass).AddTrashCardsFromLibraryTop());
  172. }
  173. }
  174. }
  175. if (timing == EffectTiming.None)
  176. {
  177. bool Condition()
  178. {
  179. if (CardEffectCommons.IsExistOnBattleArea(card))
  180. {
  181. if (CardEffectCommons.IsOwnerTurn(card))
  182. {
  183. if (card.PermanentOfThisCard().TopCard.ContainsTraits("Wizard"))
  184. {
  185. return true;
  186. }
  187. if (card.PermanentOfThisCard().TopCard.ContainsTraits("Demon Lord"))
  188. {
  189. return true;
  190. }
  191. if (card.PermanentOfThisCard().TopCard.ContainsTraits("DemonLord"))
  192. {
  193. return true;
  194. }
  195. }
  196. }
  197. return false;
  198. }
  199. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(changeValue: 2000, isInheritedEffect: true, card: card, condition: Condition));
  200. }
  201. return cardEffects;
  202. }
  203. }
  204. }