BT17_055.cs 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System;
  4. namespace DCGO.CardEffects.BT17
  5. {
  6. public class BT17_055 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region When Digivolving
  12. if (timing == EffectTiming.OnEnterFieldAnyone)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("<De-Digivolve 1>, 1 of our opponents 8 cost or less can't attack players", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[When Digivolving] <De-Digivolve 1> 1 of your opponent’s Digimon. Then, 1 of their Digimon with a play cost of 8 or less can’t attack players until the next end of their turn.";
  21. }
  22. bool IsOpponentsDigimon(Permanent permanent)
  23. {
  24. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  25. }
  26. bool IsOpponentsEightCostDigimon(Permanent permanent)
  27. {
  28. if(CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  29. {
  30. if(permanent.TopCard.HasPlayCost && permanent.TopCard.GetCostItself <= 8)
  31. {
  32. return true;
  33. }
  34. }
  35. return false;
  36. }
  37. bool CanUseCondition(Hashtable hashtable)
  38. {
  39. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  40. {
  41. if (CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card))
  42. {
  43. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, IsOpponentsDigimon))
  44. return true;
  45. }
  46. }
  47. return false;
  48. }
  49. bool CanActivateCondition(Hashtable hashtable)
  50. {
  51. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  52. }
  53. IEnumerator ActivateCoroutine(Hashtable hashtable)
  54. {
  55. if (CardEffectCommons.HasMatchConditionPermanent(IsOpponentsDigimon))
  56. {
  57. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(IsOpponentsDigimon));
  58. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  59. selectPermanentEffect.SetUp(
  60. selectPlayer: card.Owner,
  61. canTargetCondition: IsOpponentsDigimon,
  62. canTargetCondition_ByPreSelecetedList: null,
  63. canEndSelectCondition: null,
  64. maxCount: maxCount,
  65. canNoSelect: false,
  66. canEndNotMax: false,
  67. selectPermanentCoroutine: SelectDeDigivolvePermanent,
  68. afterSelectPermanentCoroutine: null,
  69. mode: SelectPermanentEffect.Mode.Custom,
  70. cardEffect: activateClass);
  71. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  72. }
  73. if (CardEffectCommons.HasMatchConditionPermanent(IsOpponentsEightCostDigimon))
  74. {
  75. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(IsOpponentsEightCostDigimon));
  76. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  77. selectPermanentEffect.SetUp(
  78. selectPlayer: card.Owner,
  79. canTargetCondition: IsOpponentsEightCostDigimon,
  80. canTargetCondition_ByPreSelecetedList: null,
  81. canEndSelectCondition: null,
  82. maxCount: maxCount,
  83. canNoSelect: false,
  84. canEndNotMax: false,
  85. selectPermanentCoroutine: SelectCantAttackPermanent,
  86. afterSelectPermanentCoroutine: null,
  87. mode: SelectPermanentEffect.Mode.Custom,
  88. cardEffect: activateClass);
  89. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  90. }
  91. IEnumerator SelectDeDigivolvePermanent(Permanent permanent)
  92. {
  93. if(permanent != null)
  94. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(permanent, 1, activateClass).Degeneration());
  95. }
  96. IEnumerator SelectCantAttackPermanent(Permanent permanent)
  97. {
  98. bool DefenderCondition(Permanent Defender)
  99. {
  100. return Defender == null;
  101. }
  102. if (permanent != null)
  103. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotAttack(
  104. targetPermanent: permanent,
  105. defenderCondition: DefenderCondition,
  106. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  107. activateClass: activateClass,
  108. effectName: "Can't Attack Player"));
  109. }
  110. }
  111. }
  112. #endregion
  113. #region ESS
  114. if (timing == EffectTiming.OnEnterFieldAnyone)
  115. {
  116. ActivateClass activateClass = new ActivateClass();
  117. activateClass.SetUpICardEffect("<De-Digivolve 1> 1 of your opponent's Digimon", CanUseCondition, card);
  118. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  119. activateClass.SetIsInheritedEffect(true);
  120. activateClass.SetHashString("DeDigivolve_BT17_055");
  121. cardEffects.Add(activateClass);
  122. string EffectDiscription()
  123. {
  124. return "[All Turns] [Once Per Turn] When one of your other Digimon with [Diaboromon] in its name is played, <De-Digivolve 1> 1 of your opponent's Digimon.";
  125. }
  126. bool IsOpponentsDigimon(Permanent permanent)
  127. {
  128. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  129. }
  130. bool IsDiaboromon(Permanent permanent)
  131. {
  132. if(CardEffectCommons.IsOwnerPermanent(permanent, card))
  133. {
  134. if (permanent.IsDigimon)
  135. {
  136. return permanent.TopCard.ContainsCardName("Diaboromon");
  137. }
  138. }
  139. return false;
  140. }
  141. bool CanUseCondition(Hashtable hashtable)
  142. {
  143. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  144. {
  145. if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, IsDiaboromon))
  146. {
  147. return true;
  148. }
  149. }
  150. return false;
  151. }
  152. bool CanActivateCondition(Hashtable hashtable)
  153. {
  154. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  155. }
  156. IEnumerator ActivateCoroutine(Hashtable hashtable)
  157. {
  158. if (CardEffectCommons.HasMatchConditionPermanent(IsOpponentsDigimon))
  159. {
  160. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(IsOpponentsDigimon));
  161. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  162. selectPermanentEffect.SetUp(
  163. selectPlayer: card.Owner,
  164. canTargetCondition: IsOpponentsDigimon,
  165. canTargetCondition_ByPreSelecetedList: null,
  166. canEndSelectCondition: null,
  167. maxCount: maxCount,
  168. canNoSelect: false,
  169. canEndNotMax: false,
  170. selectPermanentCoroutine: SelectDeDigivolvePermanent,
  171. afterSelectPermanentCoroutine: null,
  172. mode: SelectPermanentEffect.Mode.Custom,
  173. cardEffect: activateClass);
  174. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  175. }
  176. IEnumerator SelectDeDigivolvePermanent(Permanent permanent)
  177. {
  178. if (permanent != null)
  179. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(permanent, 1, activateClass).Degeneration());
  180. }
  181. }
  182. }
  183. #endregion
  184. return cardEffects;
  185. }
  186. }
  187. }