BT8_069.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  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 BT8_069 : 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.OnEnterFieldAnyone)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Place a Card to digivolution cards to delete 1 Digimon with 7 or less Cost", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[When Digivolving] You may place 1 card with [X-Antibody] in its traits from your hand under this Digimon as its bottom digivolution card to delete 1 of your opponent's Digimon with a play cost of 7 or less.";
  22. }
  23. bool CanSelectCardCondition(CardSource cardSource)
  24. {
  25. if (cardSource != null)
  26. {
  27. if (cardSource.Owner == card.Owner)
  28. {
  29. if (cardSource.HasXAntibodyTraits)
  30. {
  31. return true;
  32. }
  33. }
  34. }
  35. return false;
  36. }
  37. bool CanSelectPermanentCondition(Permanent permanent)
  38. {
  39. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  40. {
  41. if (permanent.TopCard.GetCostItself <= 7)
  42. {
  43. if (permanent.TopCard.HasPlayCost)
  44. {
  45. return true;
  46. }
  47. }
  48. }
  49. return false;
  50. }
  51. bool CanUseCondition(Hashtable hashtable)
  52. {
  53. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  54. }
  55. bool CanActivateCondition(Hashtable hashtable)
  56. {
  57. if (CardEffectCommons.IsExistOnBattleArea(card))
  58. {
  59. if (card.Owner.HandCards.Count >= 1)
  60. {
  61. return true;
  62. }
  63. }
  64. return false;
  65. }
  66. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  67. {
  68. if (isExistOnField(card))
  69. {
  70. if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard()))
  71. {
  72. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  73. {
  74. List<CardSource> selectedCards = new List<CardSource>();
  75. int maxCount = 1;
  76. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  77. selectHandEffect.SetUp(
  78. selectPlayer: card.Owner,
  79. canTargetCondition: CanSelectCardCondition,
  80. canTargetCondition_ByPreSelecetedList: null,
  81. canEndSelectCondition: null,
  82. maxCount: maxCount,
  83. canNoSelect: true,
  84. canEndNotMax: false,
  85. isShowOpponent: true,
  86. selectCardCoroutine: SelectCardCoroutine,
  87. afterSelectCardCoroutine: null,
  88. mode: SelectHandEffect.Mode.Custom,
  89. cardEffect: activateClass);
  90. selectHandEffect.SetUpCustomMessage("Select 1 card to place on bottom of digivolution cards.", "The opponent is selecting 1 card to place on bottom of digivolution cards.");
  91. yield return StartCoroutine(selectHandEffect.Activate());
  92. IEnumerator SelectCardCoroutine(CardSource cardSource)
  93. {
  94. selectedCards.Add(cardSource);
  95. yield return null;
  96. }
  97. if (selectedCards.Count >= 1)
  98. {
  99. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(selectedCards, activateClass));
  100. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  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: CanEndSelectCondition,
  109. maxCount: maxCount,
  110. canNoSelect: false,
  111. canEndNotMax: false,
  112. selectPermanentCoroutine: null,
  113. afterSelectPermanentCoroutine: null,
  114. mode: SelectPermanentEffect.Mode.Destroy,
  115. cardEffect: activateClass);
  116. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  117. bool CanEndSelectCondition(List<Permanent> permanents)
  118. {
  119. if (permanents.Count <= 0)
  120. {
  121. return false;
  122. }
  123. return true;
  124. }
  125. }
  126. }
  127. }
  128. }
  129. }
  130. }
  131. }
  132. if (timing == EffectTiming.OnAddDigivolutionCards)
  133. {
  134. ActivateClass activateClass = new ActivateClass();
  135. activateClass.SetUpICardEffect("This Digimon gets DP +2000 and can't be deleted by effects", CanUseCondition, card);
  136. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  137. activateClass.SetHashString("DP+2000_BT8_069");
  138. cardEffects.Add(activateClass);
  139. string EffectDiscription()
  140. {
  141. return "[Your Turn][Once Per Turn] When one of your effects places a digivolution card under one of your Digimon, this Digimon gets +2000 DP and can't be deleted by your opponent's effects until the end of your opponent's next turn.";
  142. }
  143. bool CanUseCondition(Hashtable hashtable)
  144. {
  145. if (CardEffectCommons.IsExistOnBattleArea(card))
  146. {
  147. if (CardEffectCommons.IsOwnerTurn(card))
  148. {
  149. if (CardEffectCommons.CanTriggerOnAddDigivolutionCard(
  150. hashtable: hashtable,
  151. permanentCondition: permanent => CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card),
  152. cardEffectCondition: cardEffect => cardEffect.EffectSourceCard != null && cardEffect.EffectSourceCard.Owner == card.Owner,
  153. cardCondition: null))
  154. {
  155. return true;
  156. }
  157. }
  158. }
  159. return false;
  160. }
  161. bool CanActivateCondition(Hashtable hashtable)
  162. {
  163. return CardEffectCommons.IsExistOnBattleArea(card);
  164. }
  165. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  166. {
  167. if (CardEffectCommons.IsExistOnBattleArea(card))
  168. {
  169. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  170. targetPermanent: card.PermanentOfThisCard(),
  171. changeValue: 2000,
  172. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  173. activateClass: activateClass));
  174. bool CardEffectCondition(ICardEffect cardEffect)
  175. {
  176. return CardEffectCommons.IsOpponentEffect(cardEffect, card);
  177. }
  178. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotBeDeletedByEffect(
  179. targetPermanent: card.PermanentOfThisCard(),
  180. cardEffectCondition: CardEffectCondition,
  181. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  182. activateClass: activateClass,
  183. effectName: "Can't be deleted by opponent's effects"));
  184. }
  185. }
  186. }
  187. if (timing == EffectTiming.OnEndAttack)
  188. {
  189. ActivateClass activateClass = new ActivateClass();
  190. activateClass.SetUpICardEffect("Unsuspend this Digimon", CanUseCondition, card);
  191. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  192. activateClass.SetIsInheritedEffect(true);
  193. activateClass.SetHashString("Unsuspend_BT8_069");
  194. cardEffects.Add(activateClass);
  195. string EffectDiscription()
  196. {
  197. return "[End of Attack][Once Per Turn] If this Digimon has [Alphamon] in its name, unsuspend it.";
  198. }
  199. bool CanUseCondition(Hashtable hashtable)
  200. {
  201. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  202. }
  203. bool CanActivateCondition(Hashtable hashtable)
  204. {
  205. if (CardEffectCommons.IsExistOnBattleArea(card))
  206. {
  207. if (card.PermanentOfThisCard().TopCard.ContainsCardName("Alphamon"))
  208. {
  209. return true;
  210. }
  211. }
  212. return false;
  213. }
  214. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  215. {
  216. Permanent selectedPermanent = card.PermanentOfThisCard();
  217. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { selectedPermanent }, activateClass).Unsuspend());
  218. }
  219. }
  220. return cardEffects;
  221. }
  222. }