ST6_04.cs 4.2 KB

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