BT6_099.cs 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System.Linq;
  5. using Photon;
  6. using System;
  7. using Photon.Pun;
  8. public class BT6_099 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. if (timing == EffectTiming.OptionSkill)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  17. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[Main] Trash the top card of your security stack. Then, 1 of your opponent's Digimon gets -5000 DP for the turn.";
  22. }
  23. bool CanSelectPermanentCondition(Permanent permanent)
  24. {
  25. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  26. }
  27. bool CanUseCondition(Hashtable hashtable)
  28. {
  29. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  30. }
  31. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  32. {
  33. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  34. player: card.Owner,
  35. destroySecurityCount: 1,
  36. cardEffect: activateClass,
  37. fromTop: true).DestroySecurity());
  38. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  39. {
  40. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  41. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  42. selectPermanentEffect.SetUp(
  43. selectPlayer: card.Owner,
  44. canTargetCondition: CanSelectPermanentCondition,
  45. canTargetCondition_ByPreSelecetedList: null,
  46. canEndSelectCondition: null,
  47. maxCount: maxCount,
  48. canNoSelect: false,
  49. canEndNotMax: false,
  50. selectPermanentCoroutine: SelectPermanentCoroutine,
  51. afterSelectPermanentCoroutine: null,
  52. mode: SelectPermanentEffect.Mode.Custom,
  53. cardEffect: activateClass);
  54. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -5000.", "The opponent is selecting 1 Digimon that will get DP -5000.");
  55. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  56. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  57. {
  58. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -5000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  59. }
  60. }
  61. }
  62. }
  63. if (timing == EffectTiming.SecuritySkill)
  64. {
  65. ActivateClass activateClass = new ActivateClass();
  66. activateClass.SetUpICardEffect($"Add this card to hand", CanUseCondition, card);
  67. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  68. activateClass.SetIsSecurityEffect(true);
  69. cardEffects.Add(activateClass);
  70. string EffectDiscription()
  71. {
  72. return "[Security] Add this card to its owner's hand.";
  73. }
  74. bool CanUseCondition(Hashtable hashtable)
  75. {
  76. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  77. }
  78. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  79. {
  80. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.AddThisCardToHand(card, activateClass));
  81. }
  82. }
  83. return cardEffects;
  84. }
  85. }