BT4_083.cs 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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_083 : 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 2 and trash 1 card 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 2>. (Draw 2 cards from your deck.) Then trash 1 card from 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. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 2, activateClass).Draw());
  45. if (card.Owner.HandCards.Count >= 1)
  46. {
  47. int discardCount = 1;
  48. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  49. selectHandEffect.SetUp(
  50. selectPlayer: card.Owner,
  51. canTargetCondition: (cardSource) => true,
  52. canTargetCondition_ByPreSelecetedList: null,
  53. canEndSelectCondition: null,
  54. maxCount: discardCount,
  55. canNoSelect: false,
  56. canEndNotMax: false,
  57. isShowOpponent: true,
  58. selectCardCoroutine: null,
  59. afterSelectCardCoroutine: null,
  60. mode: SelectHandEffect.Mode.Discard,
  61. cardEffect: activateClass);
  62. yield return StartCoroutine(selectHandEffect.Activate());
  63. }
  64. }
  65. }
  66. return cardEffects;
  67. }
  68. }