BT4_088.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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 BT4_088 : 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.OnLoseSecurity)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Trash the top card of opponent's security", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  18. activateClass.SetHashString("TrashSecurity_BT4_088");
  19. cardEffects.Add(activateClass);
  20. string EffectDiscription()
  21. {
  22. return "[Opponent's Turn][Once Per Turn] When a card is removed from your security stack, trash the top card of your opponent's security stack.";
  23. }
  24. bool CanUseCondition(Hashtable hashtable)
  25. {
  26. if (CardEffectCommons.IsExistOnBattleArea(card))
  27. {
  28. if (CardEffectCommons.IsOpponentTurn(card))
  29. {
  30. if (CardEffectCommons.CanTriggerWhenLoseSecurity(hashtable, player => player == card.Owner))
  31. {
  32. return true;
  33. }
  34. }
  35. }
  36. return false;
  37. }
  38. bool CanActivateCondition(Hashtable hashtable)
  39. {
  40. if (CardEffectCommons.IsExistOnBattleArea(card))
  41. {
  42. return true;
  43. }
  44. return false;
  45. }
  46. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  47. {
  48. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  49. player: card.Owner.Enemy,
  50. destroySecurityCount: 1,
  51. cardEffect: activateClass,
  52. fromTop: true).DestroySecurity());
  53. }
  54. }
  55. if (timing == EffectTiming.OnDestroyedAnyone)
  56. {
  57. ActivateClass activateClass = new ActivateClass();
  58. activateClass.SetUpICardEffect("Opponent trashes 2 cards from hand", CanUseCondition, card);
  59. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  60. cardEffects.Add(activateClass);
  61. string EffectDiscription()
  62. {
  63. return "[On Deletion] Your opponent trashes 2 cards in their hand.";
  64. }
  65. bool CanUseCondition(Hashtable hashtable)
  66. {
  67. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  68. }
  69. bool CanActivateCondition(Hashtable hashtable)
  70. {
  71. if (CardEffectCommons.CanActivateOnDeletion(card, activateClass))
  72. {
  73. if (card.Owner.Enemy.HandCards.Count >= 1)
  74. {
  75. return true;
  76. }
  77. }
  78. return false;
  79. }
  80. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  81. {
  82. if (card.Owner.Enemy.HandCards.Count >= 1)
  83. {
  84. int discardCount = Math.Min(2, card.Owner.Enemy.HandCards.Count);
  85. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  86. selectHandEffect.SetUp(
  87. selectPlayer: card.Owner.Enemy,
  88. canTargetCondition: (cardSource) => true,
  89. canTargetCondition_ByPreSelecetedList: null,
  90. canEndSelectCondition: null,
  91. maxCount: discardCount,
  92. canNoSelect: false,
  93. canEndNotMax: false,
  94. isShowOpponent: true,
  95. selectCardCoroutine: null,
  96. afterSelectCardCoroutine: null,
  97. mode: SelectHandEffect.Mode.Discard,
  98. cardEffect: activateClass);
  99. yield return StartCoroutine(selectHandEffect.Activate());
  100. }
  101. }
  102. }
  103. return cardEffects;
  104. }
  105. }