ST10_09.cs 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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 ST10_09 : 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.SecuritySkill)
  14. {
  15. cardEffects.Add(CardEffectFactory.PlaySelfDigimonAfterBattleSecurityEffect(card: card));
  16. }
  17. if (timing == EffectTiming.OnEnterFieldAnyone)
  18. {
  19. ActivateClass activateClass = new ActivateClass();
  20. activateClass.SetUpICardEffect("Return 1 card from trash to hand", CanUseCondition, card);
  21. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  22. cardEffects.Add(activateClass);
  23. string EffectDiscription()
  24. {
  25. return "[On Play] Return 1 purple level 5 or lower Digimon card from your trash to your hand.";
  26. }
  27. bool CanSelectCardCondition(CardSource cardSource)
  28. {
  29. if (cardSource != null)
  30. {
  31. if (cardSource.IsDigimon)
  32. {
  33. if (cardSource.Owner == card.Owner)
  34. {
  35. if (cardSource.Level <= 5)
  36. {
  37. if (cardSource.HasCardColor(CardColor.Purple))
  38. {
  39. if (cardSource.HasLevel)
  40. {
  41. return true;
  42. }
  43. }
  44. }
  45. }
  46. }
  47. }
  48. return false;
  49. }
  50. bool CanUseCondition(Hashtable hashtable)
  51. {
  52. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  53. }
  54. bool CanActivateCondition(Hashtable hashtable)
  55. {
  56. if (CardEffectCommons.IsExistOnBattleArea(card))
  57. {
  58. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  59. {
  60. return true;
  61. }
  62. }
  63. return false;
  64. }
  65. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  66. {
  67. if (isExistOnField(card))
  68. {
  69. if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard()))
  70. {
  71. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  72. {
  73. int maxCount = Math.Min(1, card.Owner.TrashCards.Count(CanSelectCardCondition));
  74. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  75. selectCardEffect.SetUp(
  76. canTargetCondition: CanSelectCardCondition,
  77. canTargetCondition_ByPreSelecetedList: null,
  78. canEndSelectCondition: null,
  79. canNoSelect: () => false,
  80. selectCardCoroutine: null,
  81. afterSelectCardCoroutine: null,
  82. message: "Select 1 card to add to your hand.",
  83. maxCount: maxCount,
  84. canEndNotMax: false,
  85. isShowOpponent: true,
  86. mode: SelectCardEffect.Mode.AddHand,
  87. root: SelectCardEffect.Root.Trash,
  88. customRootCardList: null,
  89. canLookReverseCard: true,
  90. selectPlayer: card.Owner,
  91. cardEffect: activateClass);
  92. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  93. }
  94. }
  95. }
  96. }
  97. }
  98. return cardEffects;
  99. }
  100. }