BT13_082.cs 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT13
  5. {
  6. public class BT13_082 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. if (timing == EffectTiming.None)
  12. {
  13. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  14. }
  15. if (timing == EffectTiming.OnDestroyedAnyone)
  16. {
  17. ActivateClass activateClass = new ActivateClass();
  18. activateClass.SetUpICardEffect("Opponent trashes 1 card from hand", CanUseCondition, card);
  19. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  20. activateClass.SetIsInheritedEffect(true);
  21. cardEffects.Add(activateClass);
  22. string EffectDiscription()
  23. {
  24. return "[On Deletion] If deleted outside of a battle, your opponent trashes 1 card in their hand.";
  25. }
  26. bool CanUseCondition(Hashtable hashtable)
  27. {
  28. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  29. }
  30. bool CanActivateCondition(Hashtable hashtable)
  31. {
  32. if (CardEffectCommons.CanActivateOnDeletion(card, activateClass))
  33. {
  34. if (!CardEffectCommons.IsByBattle(hashtable))
  35. {
  36. if (card.Owner.Enemy.HandCards.Count >= 1)
  37. {
  38. return true;
  39. }
  40. }
  41. }
  42. return false;
  43. }
  44. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  45. {
  46. if (card.Owner.Enemy.HandCards.Count >= 1)
  47. {
  48. int discardCount = Math.Min(1, card.Owner.HandCards.Count);
  49. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  50. selectHandEffect.SetUp(
  51. selectPlayer: card.Owner.Enemy,
  52. canTargetCondition: (cardSource) => true,
  53. canTargetCondition_ByPreSelecetedList: null,
  54. canEndSelectCondition: null,
  55. maxCount: discardCount,
  56. canNoSelect: false,
  57. canEndNotMax: false,
  58. isShowOpponent: true,
  59. selectCardCoroutine: null,
  60. afterSelectCardCoroutine: null,
  61. mode: SelectHandEffect.Mode.Discard,
  62. cardEffect: activateClass);
  63. yield return StartCoroutine(selectHandEffect.Activate());
  64. }
  65. }
  66. }
  67. return cardEffects;
  68. }
  69. }
  70. }