BT22_062.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. // MetalTyrannomon
  6. namespace DCGO.CardEffects.BT22
  7. {
  8. public class BT22_062 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Alternative Digivolution Condition
  14. if (timing == EffectTiming.None)
  15. {
  16. bool PermanentCondition(Permanent targetPermanent)
  17. {
  18. return targetPermanent.TopCard.IsLevel5
  19. && targetPermanent.TopCard.ContainsCardName("Tyrannomon")
  20. && !targetPermanent.TopCard.HasXAntibodyTraits;
  21. }
  22. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  23. permanentCondition: PermanentCondition,
  24. digivolutionCost: 1,
  25. ignoreDigivolutionRequirement: false,
  26. card: card,
  27. condition: null)
  28. );
  29. }
  30. #endregion
  31. #region Collision
  32. if (timing == EffectTiming.OnCounterTiming)
  33. {
  34. cardEffects.Add(CardEffectFactory.CollisionSelfStaticEffect(false, card, null));
  35. }
  36. #endregion
  37. #region When Digivolving
  38. if (timing == EffectTiming.OnEnterFieldAnyone)
  39. {
  40. ActivateClass activateClass = new ActivateClass();
  41. activateClass.SetUpICardEffect("Gain 4K DP, then if [MetalTyrannomon]/[X Antibody] in sources, 1 digimon cant digivolve", CanUseCondition, card);
  42. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  43. cardEffects.Add(activateClass);
  44. string EffectDiscription()
  45. {
  46. return "[When Digivolving] This Digimon gets +4000 DP until your opponent's turn ends. Then, if [MetalTyrannomon] or [X Antibody] is in this Digimon's digivolution cards, 1 of your opponent's Digimon can't digivolve until their turn ends.";
  47. }
  48. bool CanUseCondition(Hashtable hashtable)
  49. {
  50. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  51. }
  52. bool CanActivateCondition(Hashtable hashtable)
  53. {
  54. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  55. }
  56. bool OpponentDigimon(Permanent permanent)
  57. {
  58. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  59. }
  60. IEnumerator ActivateCoroutine(Hashtable hashtable)
  61. {
  62. yield return ContinuousController.instance.StartCoroutine(
  63. CardEffectCommons.ChangeDigimonDP(card.PermanentOfThisCard(), 4000, EffectDuration.UntilOpponentTurnEnd, activateClass));
  64. if (card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => cardSource.EqualsCardName("MetalTyrannomon") || cardSource.EqualsCardName("X Antibody")) >= 1)
  65. {
  66. Permanent selectedPermanent = null;
  67. #region Select Permanent
  68. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOpponentsPermanentCount(card, OpponentDigimon));
  69. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  70. selectPermanentEffect.SetUp(
  71. selectPlayer: card.Owner,
  72. canTargetCondition: OpponentDigimon,
  73. canTargetCondition_ByPreSelecetedList: null,
  74. canEndSelectCondition: null,
  75. maxCount: maxCount,
  76. canNoSelect: false,
  77. canEndNotMax: false,
  78. selectPermanentCoroutine: SelectPermanentCoroutine,
  79. afterSelectPermanentCoroutine: null,
  80. mode: SelectPermanentEffect.Mode.Custom,
  81. cardEffect: activateClass);
  82. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  83. {
  84. selectedPermanent = permanent;
  85. yield return null;
  86. }
  87. selectPermanentEffect.SetUpCustomMessage("Select 1 opponent's Digimon that can't digivolve", "The opponent is selecting 1 Digimon that can't digivolve");
  88. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  89. #endregion
  90. if (selectedPermanent != null)
  91. {
  92. #region Setup CanNotDigivolveClass
  93. CanNotDigivolveClass canNotPutFieldClass = new CanNotDigivolveClass();
  94. canNotPutFieldClass.SetUpICardEffect("Can't Digivolve", _ => true, card);
  95. canNotPutFieldClass.SetUpCanNotEvolveClass(permanentCondition: PermanentCondition, cardCondition: CardCondition);
  96. bool PermanentCondition(Permanent permanent)
  97. {
  98. if (permanent == selectedPermanent)
  99. {
  100. if (permanent.TopCard != null)
  101. {
  102. if (permanent.IsDigimon)
  103. {
  104. if (!permanent.TopCard.CanNotBeAffected(canNotPutFieldClass))
  105. {
  106. return true;
  107. }
  108. }
  109. }
  110. }
  111. return false;
  112. }
  113. bool CardCondition(CardSource cardSource)
  114. {
  115. if (cardSource.Owner == card.Owner.Enemy)
  116. {
  117. if (cardSource.IsDigimon)
  118. {
  119. if (!cardSource.CanNotBeAffected(canNotPutFieldClass))
  120. {
  121. return true;
  122. }
  123. }
  124. }
  125. return false;
  126. }
  127. ICardEffect CanNotDigivolve(EffectTiming _timing)
  128. {
  129. if (_timing == EffectTiming.None)
  130. {
  131. return canNotPutFieldClass;
  132. }
  133. return null;
  134. }
  135. #endregion
  136. selectedPermanent.UntilOwnerTurnEndEffects.Add(CanNotDigivolve);
  137. ContinuousController.instance.PlaySE(GManager.instance.GetComponent<Effects>().DebuffSE);
  138. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
  139. }
  140. }
  141. }
  142. }
  143. #endregion
  144. #region ESS
  145. if (timing == EffectTiming.OnEndTurn)
  146. {
  147. ActivateClass activateClass = new ActivateClass();
  148. activateClass.SetUpICardEffect("1 of your opponent's digimon attacks", CanUseCondition, card);
  149. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  150. activateClass.SetHashString("BT22_062_EndOfOpponentTurn");
  151. activateClass.SetIsInheritedEffect(true);
  152. cardEffects.Add(activateClass);
  153. string EffectDiscription()
  154. {
  155. return "[End of Opponent's Turn] [Once Per Turn] You may choose 1 of your opponent's Digimon. Your opponent attacks with the chosen Digimon.";
  156. }
  157. bool CanUseCondition(Hashtable hashtable)
  158. {
  159. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  160. CardEffectCommons.IsOpponentTurn(card);
  161. }
  162. bool CanActivateCondition(Hashtable hashtable)
  163. {
  164. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  165. CardEffectCommons.HasMatchConditionOpponentsPermanent(card, OpponentDigimon);
  166. }
  167. bool OpponentDigimon(Permanent permanent)
  168. {
  169. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
  170. && permanent.CanAttack(activateClass);
  171. }
  172. IEnumerator ActivateCoroutine(Hashtable hashtable)
  173. {
  174. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, OpponentDigimon))
  175. {
  176. Permanent selectedPermanent = null;
  177. #region Select Permanent
  178. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOpponentsPermanentCount(card, OpponentDigimon));
  179. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  180. selectPermanentEffect.SetUp(
  181. selectPlayer: card.Owner,
  182. canTargetCondition: OpponentDigimon,
  183. canTargetCondition_ByPreSelecetedList: null,
  184. canEndSelectCondition: null,
  185. maxCount: maxCount,
  186. canNoSelect: true,
  187. canEndNotMax: false,
  188. selectPermanentCoroutine: SelectPermanentCoroutine,
  189. afterSelectPermanentCoroutine: null,
  190. mode: SelectPermanentEffect.Mode.Custom,
  191. cardEffect: activateClass);
  192. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  193. {
  194. selectedPermanent = permanent;
  195. yield return null;
  196. }
  197. selectPermanentEffect.SetUpCustomMessage("Select 1 opponent's Digimon that will attack", "The opponent is selecting 1 Digimon that will attack");
  198. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  199. #endregion
  200. if (selectedPermanent != null)
  201. {
  202. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  203. selectAttackEffect.SetUp(
  204. attacker: selectedPermanent,
  205. canAttackPlayerCondition: () => true,
  206. defenderCondition: (permanent) => true,
  207. cardEffect: activateClass);
  208. selectAttackEffect.SetCanNotSelectNotAttack();
  209. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  210. }
  211. }
  212. }
  213. }
  214. #endregion
  215. return cardEffects;
  216. }
  217. }
  218. }