BT7_069.cs 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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 BT7_069 : 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.OnDestroyedAnyone)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Draw 3 and trash 2 cards from hand", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[On Deletion] Trigger <Draw 3>. (Draw 3 cards from your deck.) Then, trash 2 cards in your hand.";
  22. }
  23. bool CanUseCondition(Hashtable hashtable)
  24. {
  25. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  26. }
  27. bool CanActivateCondition(Hashtable hashtable)
  28. {
  29. if (CardEffectCommons.IsExistOnTrash(card))
  30. {
  31. if (card.Owner.LibraryCards.Count >= 1)
  32. {
  33. return true;
  34. }
  35. if (card.Owner.HandCards.Count >= 1)
  36. {
  37. return true;
  38. }
  39. }
  40. return false;
  41. }
  42. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  43. {
  44. //if (CardEffectCommons.IsExistOnTrash(card))
  45. {
  46. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 3, activateClass).Draw());
  47. if (card.Owner.HandCards.Count >= 1)
  48. {
  49. int discardCount = 2;
  50. if (card.Owner.HandCards.Count < discardCount)
  51. {
  52. discardCount = card.Owner.HandCards.Count;
  53. }
  54. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  55. selectHandEffect.SetUp(
  56. selectPlayer: card.Owner,
  57. canTargetCondition: (cardSource) => true,
  58. canTargetCondition_ByPreSelecetedList: null,
  59. canEndSelectCondition: null,
  60. maxCount: discardCount,
  61. canNoSelect: false,
  62. canEndNotMax: false,
  63. isShowOpponent: true,
  64. selectCardCoroutine: null,
  65. afterSelectCardCoroutine: null,
  66. mode: SelectHandEffect.Mode.Discard,
  67. cardEffect: activateClass);
  68. yield return StartCoroutine(selectHandEffect.Activate());
  69. }
  70. }
  71. }
  72. }
  73. return cardEffects;
  74. }
  75. }