BT16_006.cs 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT16
  4. {
  5. public class BT16_006 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Inherit
  11. if (timing == EffectTiming.OnDestroyedAnyone)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Trash a card to gain 1 memory.", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  16. activateClass.SetIsInheritedEffect(true);
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[On Deletion] By trashing 1 card in your hand, gain 1 memory.";
  21. }
  22. bool CanUseCondition(Hashtable hashtable)
  23. {
  24. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  25. }
  26. bool CanActivateCondition(Hashtable hashtable)
  27. {
  28. if (CardEffectCommons.CanActivateOnDeletion(card, activateClass))
  29. {
  30. if (card.Owner.HandCards.Count >= 1)
  31. {
  32. return true;
  33. }
  34. }
  35. return false;
  36. }
  37. IEnumerator ActivateCoroutine(Hashtable hashtable)
  38. {
  39. if (card.Owner.HandCards.Count >= 1)
  40. {
  41. bool discarded = false;
  42. int discardCount = 1;
  43. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  44. selectHandEffect.SetUp(
  45. selectPlayer: card.Owner,
  46. canTargetCondition: (cardSource) => true,
  47. canTargetCondition_ByPreSelecetedList: null,
  48. canEndSelectCondition: null,
  49. maxCount: discardCount,
  50. canNoSelect: true,
  51. canEndNotMax: false,
  52. isShowOpponent: true,
  53. selectCardCoroutine: null,
  54. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  55. mode: SelectHandEffect.Mode.Discard,
  56. cardEffect: activateClass);
  57. yield return StartCoroutine(selectHandEffect.Activate());
  58. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  59. {
  60. if (cardSources.Count >= 1)
  61. {
  62. discarded = true;
  63. yield return null;
  64. }
  65. }
  66. if (discarded)
  67. {
  68. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  69. }
  70. }
  71. }
  72. }
  73. #endregion
  74. return cardEffects;
  75. }
  76. }
  77. }