BT16_013.cs 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT16
  5. {
  6. public class BT16_013 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Counter Timing
  12. if (timing == EffectTiming.OnCounterTiming)
  13. {
  14. cardEffects.Add(CardEffectFactory.BlastDigivolveEffect(card: card, condition: null));
  15. }
  16. #endregion
  17. #region Digivolution Condition
  18. if (timing == EffectTiming.None)
  19. {
  20. bool PermanentCondition(Permanent targetPermanent)
  21. {
  22. if ((targetPermanent.TopCard.CardNames.Contains("Silphymon") && targetPermanent.Level == 5))
  23. {
  24. return true;
  25. }
  26. return false;
  27. }
  28. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  29. }
  30. #endregion
  31. #region On Play
  32. if (timing == EffectTiming.OnEnterFieldAnyone)
  33. {
  34. ActivateClass activateClass = new ActivateClass();
  35. activateClass.SetUpICardEffect("DP -5000 to opponent's all Digimon", CanUseCondition, card);
  36. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  37. cardEffects.Add(activateClass);
  38. string EffectDiscription()
  39. {
  40. return "[On Play] All of your opponent's Digimon get -5000DP for the turn.";
  41. }
  42. bool CanUseCondition(Hashtable hashtable)
  43. {
  44. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  45. }
  46. bool CanActivateCondition(Hashtable hashtable)
  47. {
  48. if (CardEffectCommons.IsExistOnBattleArea(card))
  49. {
  50. return true;
  51. }
  52. return false;
  53. }
  54. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  55. {
  56. bool PermanentCondition(Permanent permanent)
  57. {
  58. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  59. }
  60. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDPPlayerEffect(
  61. permanentCondition: PermanentCondition,
  62. changeValue: -5000,
  63. effectDuration: EffectDuration.UntilEachTurnEnd,
  64. activateClass: activateClass));
  65. }
  66. }
  67. #endregion
  68. #region When Digivolving
  69. if (timing == EffectTiming.OnEnterFieldAnyone)
  70. {
  71. ActivateClass activateClass = new ActivateClass();
  72. activateClass.SetUpICardEffect("DP -5000 to opponent's all Digimon", CanUseCondition, card);
  73. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  74. cardEffects.Add(activateClass);
  75. string EffectDiscription()
  76. {
  77. return "[When Digivolving] All of your opponent's Digimon get -5000DP for the turn.";
  78. }
  79. bool CanUseCondition(Hashtable hashtable)
  80. {
  81. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  82. }
  83. bool CanActivateCondition(Hashtable hashtable)
  84. {
  85. if (CardEffectCommons.IsExistOnBattleArea(card))
  86. {
  87. return true;
  88. }
  89. return false;
  90. }
  91. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  92. {
  93. bool PermanentCondition(Permanent permanent)
  94. {
  95. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  96. }
  97. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDPPlayerEffect(
  98. permanentCondition: PermanentCondition,
  99. changeValue: -5000,
  100. effectDuration: EffectDuration.UntilEachTurnEnd,
  101. activateClass: activateClass));
  102. }
  103. }
  104. #endregion
  105. #region All Turns
  106. if (timing == EffectTiming.OnLoseSecurity)
  107. {
  108. ActivateClass activateClass = new ActivateClass();
  109. activateClass.SetUpICardEffect("Delete 1 Digimon with 8000 DP or less.", CanUseCondition, card);
  110. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  111. activateClass.SetHashString("Delete8000DPorLess_BT16_013");
  112. cardEffects.Add(activateClass);
  113. string EffectDiscription()
  114. {
  115. return "[All Turns] [Once Per Turn] When a card is removed from a security stack, delete 1 of your opponent's Digimon with 8000 DP or less. If this effect didn't delete, this Digimon gains [Security A +1] until the end of your turn.";
  116. }
  117. bool CanUseCondition(Hashtable hashtable)
  118. {
  119. if (CardEffectCommons.IsExistOnBattleArea(card))
  120. {
  121. if (CardEffectCommons.CanTriggerWhenLoseSecurity(hashtable, player => player == card.Owner) || CardEffectCommons.CanTriggerWhenLoseSecurity(hashtable, player => player == card.Owner.Enemy))
  122. {
  123. return true;
  124. }
  125. }
  126. return false;
  127. }
  128. bool CanSelectPermanentCondition(Permanent permanent)
  129. {
  130. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  131. {
  132. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(8000, activateClass))
  133. {
  134. return true;
  135. }
  136. }
  137. return false;
  138. }
  139. bool CanActivateCondition(Hashtable hashtable)
  140. {
  141. if (CardEffectCommons.IsExistOnBattleArea(card))
  142. {
  143. return true;
  144. }
  145. return false;
  146. }
  147. IEnumerator ActivateCoroutine(Hashtable hashtable)
  148. {
  149. List<Permanent> deleteTargetPermanents = new List<Permanent>();
  150. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  151. {
  152. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  153. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  154. selectPermanentEffect.SetUp(
  155. selectPlayer: card.Owner,
  156. canTargetCondition: CanSelectPermanentCondition,
  157. canTargetCondition_ByPreSelecetedList: null,
  158. canEndSelectCondition: null,
  159. maxCount: maxCount,
  160. canNoSelect: false,
  161. canEndNotMax: false,
  162. selectPermanentCoroutine: null,
  163. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
  164. mode: SelectPermanentEffect.Mode.Custom,
  165. cardEffect: activateClass);
  166. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
  167. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  168. IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
  169. {
  170. foreach (Permanent permanent in permanents)
  171. {
  172. deleteTargetPermanents.Add(permanent);
  173. }
  174. yield return null;
  175. }
  176. }
  177. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: deleteTargetPermanents, activateClass: activateClass, successProcess: null, failureProcess: FailureProcess));
  178. IEnumerator FailureProcess()
  179. {
  180. if (CardEffectCommons.IsExistOnBattleArea(card))
  181. {
  182. Permanent selectedPermanent = card.PermanentOfThisCard();
  183. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonSAttack(selectedPermanent, 1, EffectDuration.UntilOwnerTurnEnd, activateClass));
  184. }
  185. }
  186. }
  187. }
  188. #endregion
  189. return cardEffects;
  190. }
  191. }
  192. }