BT25_054.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // GreatGrizzlymon
  4. namespace DCGO.CardEffects.BT25
  5. {
  6. public class BT25_054 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alternative Digivolve Condition
  12. if (timing == EffectTiming.None)
  13. {
  14. static bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.HasTSTraits;
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(PermanentCondition, 3, false, card, null, level: 4));
  19. }
  20. #endregion
  21. #region Blocker
  22. if (timing == EffectTiming.None)
  23. {
  24. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  25. }
  26. #endregion
  27. #region Shared OP / WD
  28. string SharedEffectName = "Taunt 1 enemy digimon";
  29. CardEffectFactory.ActivateClassesForSharedEffects
  30. (ref cardEffects, timing, card,
  31. SharedEffectName,
  32. SharedActivateCoroutine,
  33. SharedEffectDescription,
  34. optional: false,
  35. onPlay: true,
  36. whenDigivolving: true);
  37. string SharedEffectDescription(string tag) => $"[{tag}] Give 1 of your opponent's Digimon \"[Start of Your Main Phase] This Digimon attacks.\" until their turn ends.";
  38. bool CanSelectPermanentCondition(Permanent permanent)
  39. {
  40. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  41. }
  42. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  43. {
  44. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  45. {
  46. Permanent selectedPermanent = null;
  47. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  48. selectPermanentEffect.SetUp(
  49. selectPlayer: card.Owner,
  50. canTargetCondition: CanSelectPermanentCondition,
  51. canTargetCondition_ByPreSelecetedList: null,
  52. canEndSelectCondition: null,
  53. maxCount: 1,
  54. canNoSelect: false,
  55. canEndNotMax: false,
  56. selectPermanentCoroutine: SelectPermanentCoroutine,
  57. afterSelectPermanentCoroutine: null,
  58. mode: SelectPermanentEffect.Mode.Custom,
  59. cardEffect: activateClass);
  60. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to taunt.",
  61. "The opponent is selecting 1 Digimon to taunt.");
  62. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  63. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  64. {
  65. selectedPermanent = permanent;
  66. yield return null;
  67. }
  68. if (selectedPermanent != null)
  69. {
  70. ActivateClass activateClassDebuff = new ActivateClass();
  71. activateClassDebuff.SetUpICardEffect("This Digimon attacks", CanUseConditionDebuff,
  72. selectedPermanent.TopCard);
  73. activateClassDebuff.SetUpActivateClass(CanActivateConditionDebuff, ActivateCoroutineDebuff, -1, false,
  74. EffectDescriptionDebuff());
  75. activateClassDebuff.SetEffectSourcePermanent(selectedPermanent);
  76. selectedPermanent.UntilOwnerTurnEndEffects.Add(GetCardEffect);
  77. selectedPermanent.UntilOwnerTurnEndEffects.Add(GetDetailEffect);
  78. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  79. {
  80. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>()
  81. .CreateDebuffEffect(selectedPermanent));
  82. }
  83. string EffectDescriptionDebuff()
  84. {
  85. return "[Start of Your Main Phase] This Digimon attacks.";
  86. }
  87. bool CanUseConditionDebuff(Hashtable hashtable1)
  88. {
  89. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(selectedPermanent, card) &&
  90. CardEffectCommons.IsOpponentTurn(card) &&
  91. !selectedPermanent.TopCard.CanNotBeAffected(activateClass);
  92. }
  93. bool CanActivateConditionDebuff(Hashtable hashtable1)
  94. {
  95. return CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(selectedPermanent) &&
  96. !selectedPermanent.TopCard.CanNotBeAffected(activateClass);
  97. }
  98. IEnumerator ActivateCoroutineDebuff(Hashtable hashtableDebuff)
  99. {
  100. if (selectedPermanent.CanAttack(activateClassDebuff))
  101. {
  102. SelectAttackEffect selectAttackEffect =
  103. GManager.instance.GetComponent<SelectAttackEffect>();
  104. selectAttackEffect.SetUp(
  105. attacker: selectedPermanent,
  106. canAttackPlayerCondition: () => true,
  107. defenderCondition: _ => true,
  108. cardEffect: activateClassDebuff);
  109. selectAttackEffect.SetCanNotSelectNotAttack();
  110. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  111. }
  112. }
  113. ICardEffect GetCardEffect(EffectTiming timingDebuff)
  114. {
  115. return timingDebuff == EffectTiming.OnStartMainPhase ? activateClassDebuff : null;
  116. }
  117. bool CanShowDebuffCondition(Hashtable hashtable1)
  118. {
  119. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(selectedPermanent, card) &&
  120. !selectedPermanent.TopCard.CanNotBeAffected(activateClass);
  121. }
  122. ICardEffect GetDetailEffect(EffectTiming timing)
  123. {
  124. if (timing == EffectTiming.None)
  125. {
  126. return CardEffectFactory.AddDetailClass(CanShowDebuffCondition, permanent => permanent == selectedPermanent, EffectDescriptionDebuff(), true, card);
  127. }
  128. return null;
  129. }
  130. }
  131. }
  132. }
  133. #endregion
  134. #region All Turns
  135. if (timing == EffectTiming.OnEndBattle)
  136. {
  137. ActivateClass activateClass = new ActivateClass();
  138. activateClass.SetUpICardEffect("Digivolve into [Callismon]/[Marsmon]", CanUseCondition, card);
  139. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  140. activateClass.SetIsSkippable(true);
  141. cardEffects.Add(activateClass);
  142. string EffectDescription()
  143. {
  144. return "[All Turns] When this Digimon wins a battle, it may digivolve into [Callismon] or [Marsmon] in the hand without paying the cost.";
  145. }
  146. bool CanUseCondition(Hashtable hashtable)
  147. {
  148. bool WinnerCondition(Permanent permanent) => permanent.cardSources.Contains(card);
  149. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  150. && CardEffectCommons.CanTriggerWhenWinBattle(hashtable: hashtable, winnerCondition: WinnerCondition);
  151. }
  152. bool CanActivateCondition(Hashtable hashtable)
  153. {
  154. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  155. && CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition);
  156. }
  157. bool CanSelectCardCondition(CardSource cardSource)
  158. {
  159. return (cardSource.EqualsCardName("Callismon")
  160. || cardSource.EqualsCardName("Marsmon"))
  161. && cardSource.CanPlayCardTargetFrame(card.PermanentOfThisCard().PermanentFrame, false, activateClass);
  162. }
  163. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  164. {
  165. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  166. card.PermanentOfThisCard(),
  167. digivolvingCard => CanSelectCardCondition(digivolvingCard),
  168. payCost: false,
  169. reduceCostTuple: null,
  170. fixedCostTuple: null,
  171. ignoreDigivolutionRequirementFixedCost: -1,
  172. isHand: true,
  173. activateClass: activateClass,
  174. successProcess: null
  175. ));
  176. }
  177. }
  178. #endregion
  179. #region All Turns Inherited
  180. if (timing == EffectTiming.OnEndBattle)
  181. {
  182. ActivateClass activateClass = new ActivateClass();
  183. activateClass.SetUpICardEffect("Trash top card of enemy security", CanUseCondition, card);
  184. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  185. activateClass.SetIsInheritedEffect(true);
  186. activateClass.SetHashString("BT25_054_Inherited");
  187. cardEffects.Add(activateClass);
  188. string EffectDescription()
  189. {
  190. return "[All Turns][Once Per Turn] When this Digimon deletes your opponent's Digimon in battle, trash their top card security card.";
  191. }
  192. bool CanUseCondition(Hashtable hashtable)
  193. {
  194. bool WinnerCondition(Permanent permanent) => permanent.cardSources.Contains(card);
  195. bool LoserCondition(Permanent permanent) => CardEffectCommons.IsOpponentPermanent(permanent, card);
  196. return CardEffectCommons.IsExistOnBattleArea(card)
  197. && CardEffectCommons.CanTriggerWhenDeleteOpponentDigimonByBattle(hashtable: hashtable, winnerCondition: WinnerCondition, loserCondition: LoserCondition, isOnlyWinnerSurvive: false);
  198. }
  199. bool CanActivateCondition(Hashtable hashtable)
  200. {
  201. return CardEffectCommons.IsExistOnBattleArea(card);
  202. }
  203. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  204. {
  205. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  206. player: card.Owner.Enemy,
  207. destroySecurityCount: 1,
  208. cardEffect: activateClass,
  209. fromTop: true).DestroySecurity());
  210. }
  211. }
  212. #endregion
  213. return cardEffects;
  214. }
  215. }
  216. }