P_077.cs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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 P_077 : 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.OnDiscardLibrary)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "When this card is trashed from your deck, gain 1 memory.";
  22. }
  23. bool CanUseCondition(Hashtable hashtable)
  24. {
  25. return CardEffectCommons.CanTriggerWhenSelfDiscardLibrary(hashtable, card);
  26. }
  27. bool CanActivateCondition(Hashtable hashtable)
  28. {
  29. if (CardEffectCommons.IsExistOnTrash(card))
  30. {
  31. if (card.Owner.CanAddMemory(activateClass))
  32. {
  33. return true;
  34. }
  35. }
  36. return false;
  37. }
  38. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  39. {
  40. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  41. }
  42. }
  43. if (timing == EffectTiming.OnAllyAttack)
  44. {
  45. ActivateClass activateClass = new ActivateClass();
  46. activateClass.SetUpICardEffect("Place 1 card from hand to the top of deck", CanUseCondition, card);
  47. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  48. activateClass.SetIsInheritedEffect(true);
  49. cardEffects.Add(activateClass);
  50. string EffectDiscription()
  51. {
  52. return "[When Attacking] You may reveal 1 purple card from your hand and place it on top of your deck.";
  53. }
  54. bool CanSelectCardCondition(CardSource cardSource)
  55. {
  56. return cardSource.HasCardColor(CardColor.Purple);
  57. }
  58. bool CanUseCondition(Hashtable hashtable)
  59. {
  60. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  61. }
  62. bool CanActivateCondition(Hashtable hashtable)
  63. {
  64. if (CardEffectCommons.IsExistOnBattleArea(card))
  65. {
  66. if (card.Owner.HandCards.Count >= 1)
  67. {
  68. return true;
  69. }
  70. }
  71. return false;
  72. }
  73. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  74. {
  75. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  76. {
  77. int maxCount = 1;
  78. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  79. selectHandEffect.SetUp(
  80. selectPlayer: card.Owner,
  81. canTargetCondition: CanSelectCardCondition,
  82. canTargetCondition_ByPreSelecetedList: null,
  83. canEndSelectCondition: null,
  84. maxCount: maxCount,
  85. canNoSelect: true,
  86. canEndNotMax: false,
  87. isShowOpponent: true,
  88. selectCardCoroutine: null,
  89. afterSelectCardCoroutine: null,
  90. mode: SelectHandEffect.Mode.PutLibraryTop,
  91. cardEffect: activateClass);
  92. yield return StartCoroutine(selectHandEffect.Activate());
  93. }
  94. }
  95. }
  96. return cardEffects;
  97. }
  98. }