BT22_052.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. //Leopardmon Ace
  5. namespace DCGO.CardEffects.BT22
  6. {
  7. public class BT22_052 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternative Digivolution Condition
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.IsLevel5 && targetPermanent.TopCard.HasCSTraits;
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  20. permanentCondition: PermanentCondition,
  21. digivolutionCost: 3,
  22. ignoreDigivolutionRequirement: false,
  23. card: card,
  24. condition: null)
  25. );
  26. }
  27. #endregion
  28. #region Blast Digivolve
  29. if (timing == EffectTiming.OnCounterTiming)
  30. {
  31. cardEffects.Add(CardEffectFactory.BlastDigivolveEffect(card: card, condition: null));
  32. }
  33. #endregion
  34. #region On Play/When Digivolving Shared
  35. bool CanSelectCardCondition(CardSource cardSource)
  36. {
  37. if (CardEffectCommons.IsExistOnHand(cardSource))
  38. {
  39. if (cardSource.IsDigimon)
  40. {
  41. if (cardSource.HasDP && cardSource.CardDP <= 5000)
  42. {
  43. return true;
  44. }
  45. }
  46. }
  47. return false;
  48. }
  49. bool SelectPermanentCondition(Permanent permanent)
  50. {
  51. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  52. {
  53. if (permanent.TopCard.HasLevel && permanent.TopCard.Level >= 3)
  54. {
  55. return true;
  56. }
  57. }
  58. return false;
  59. }
  60. #endregion
  61. #region On Play
  62. if (timing == EffectTiming.OnEnterFieldAnyone)
  63. {
  64. ActivateClass activateClass = new ActivateClass();
  65. activateClass.SetUpICardEffect("Play 1 Digimon from hand, Then gain blocker", CanUseCondition, card);
  66. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  67. cardEffects.Add(activateClass);
  68. string EffectDiscription()
  69. {
  70. return "[On Play] You may play 1 5000 DP or lower Digimon card from your hand without paying the cost. Then, all of your level 3 or higher Digimon gain <Blocker> (At blocker timing, by suspending this Digimon, it becomes the attack target.) until your opponent's turn ends.";
  71. }
  72. bool CanSelectCondition(CardSource cardSource)
  73. {
  74. if (CanSelectCardCondition(cardSource))
  75. {
  76. return CardEffectCommons.CanPlayAsNewPermanent(cardSource, false, activateClass);
  77. }
  78. return false;
  79. }
  80. bool CanUseCondition(Hashtable hashtable)
  81. {
  82. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  83. CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  84. }
  85. bool CanActivateCondition(Hashtable hashtable)
  86. {
  87. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  88. }
  89. IEnumerator ActivateCoroutine(Hashtable hashtable)
  90. {
  91. if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCondition))
  92. {
  93. List<CardSource> selectedCards = new List<CardSource>();
  94. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  95. selectHandEffect.SetUp(
  96. selectPlayer: card.Owner,
  97. canTargetCondition: CanSelectCondition,
  98. canTargetCondition_ByPreSelecetedList: null,
  99. canEndSelectCondition: null,
  100. maxCount: 1,
  101. canNoSelect: true,
  102. canEndNotMax: false,
  103. isShowOpponent: true,
  104. selectCardCoroutine: SelectCardCoroutine,
  105. afterSelectCardCoroutine: null,
  106. mode: SelectHandEffect.Mode.Custom,
  107. cardEffect: activateClass);
  108. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  109. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  110. yield return StartCoroutine(selectHandEffect.Activate());
  111. IEnumerator SelectCardCoroutine(CardSource cardSource)
  112. {
  113. selectedCards.Add(cardSource);
  114. yield return null;
  115. }
  116. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  117. }
  118. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainBlockerPlayerEffect(permanentCondition: SelectPermanentCondition, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  119. }
  120. }
  121. #endregion
  122. #region When Digivolving
  123. if (timing == EffectTiming.OnEnterFieldAnyone)
  124. {
  125. ActivateClass activateClass = new ActivateClass();
  126. activateClass.SetUpICardEffect("Play 1 Digimon from hand, Then gain blocker", CanUseCondition, card);
  127. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  128. cardEffects.Add(activateClass);
  129. string EffectDiscription()
  130. {
  131. return "[When Digivolving] You may play 1 5000 DP or lower Digimon card from your hand without paying the cost. Then, all of your level 3 or higher Digimon gain <Blocker> (At blocker timing, by suspending this Digimon, it becomes the attack target.) until your opponent's turn ends.";
  132. }
  133. bool CanSelectCondition(CardSource cardSource)
  134. {
  135. if (CanSelectCardCondition(cardSource))
  136. {
  137. return CardEffectCommons.CanPlayAsNewPermanent(cardSource, false, activateClass);
  138. }
  139. return false;
  140. }
  141. bool CanUseCondition(Hashtable hashtable)
  142. {
  143. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  144. CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  145. }
  146. bool CanActivateCondition(Hashtable hashtable)
  147. {
  148. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  149. }
  150. IEnumerator ActivateCoroutine(Hashtable hashtable)
  151. {
  152. if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCondition))
  153. {
  154. List<CardSource> selectedCards = new List<CardSource>();
  155. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  156. selectHandEffect.SetUp(
  157. selectPlayer: card.Owner,
  158. canTargetCondition: CanSelectCondition,
  159. canTargetCondition_ByPreSelecetedList: null,
  160. canEndSelectCondition: null,
  161. maxCount: 1,
  162. canNoSelect: true,
  163. canEndNotMax: false,
  164. isShowOpponent: true,
  165. selectCardCoroutine: SelectCardCoroutine,
  166. afterSelectCardCoroutine: null,
  167. mode: SelectHandEffect.Mode.Custom,
  168. cardEffect: activateClass);
  169. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  170. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  171. yield return StartCoroutine(selectHandEffect.Activate());
  172. IEnumerator SelectCardCoroutine(CardSource cardSource)
  173. {
  174. selectedCards.Add(cardSource);
  175. yield return null;
  176. }
  177. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  178. }
  179. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainBlockerPlayerEffect(permanentCondition: SelectPermanentCondition, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  180. }
  181. }
  182. #endregion
  183. #region All Turns - OPT
  184. if (timing == EffectTiming.WhenRemoveField)
  185. {
  186. ActivateClass activateClass = new ActivateClass();
  187. activateClass.SetUpICardEffect("Memory +2", CanUseCondition, card);
  188. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  189. activateClass.SetHashString("AllTurn_BT22-052");
  190. cardEffects.Add(activateClass);
  191. string EffectDiscription()
  192. {
  193. return "[All Turns] [Once Per Turn] When any of your other Digimon would leave the battle area, gain 2 memory.";
  194. }
  195. bool PermanentCondition(Permanent permanent)
  196. {
  197. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  198. permanent != card.PermanentOfThisCard();
  199. }
  200. bool CanUseCondition(Hashtable hashtable)
  201. {
  202. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  203. CardEffectCommons.CanTriggerWhenPermanentRemoveField(hashtable, PermanentCondition);
  204. }
  205. bool CanActivateCondition(Hashtable hashtable)
  206. {
  207. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  208. }
  209. IEnumerator ActivateCoroutine(Hashtable hashtable)
  210. {
  211. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(2, activateClass));
  212. }
  213. }
  214. #endregion
  215. return cardEffects;
  216. }
  217. }
  218. }