EX7_053.cs 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.EX7
  6. {
  7. public class EX7_053 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region On Play
  13. if (timing == EffectTiming.OnEnterFieldAnyone)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Trash 1 card from hand and return 1 card from trash to hand", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[On Play] Trash 1 card in your hand. Then, you may return 1 Digimon card with the [Evil]/[Dark Dragon]/[Evil Dragon] trait from your trash to the hand.";
  22. }
  23. bool CanSelectCardCondition(CardSource cardSource)
  24. {
  25. if (cardSource != null)
  26. {
  27. if (cardSource.IsDigimon)
  28. {
  29. if (cardSource.Owner == card.Owner)
  30. {
  31. if (cardSource.EqualsTraits("Evil") || cardSource.EqualsTraits("Dark Dragon") || cardSource.EqualsTraits("Evil Dragon"))
  32. {
  33. return true;
  34. }
  35. }
  36. }
  37. }
  38. return false;
  39. }
  40. bool CanUseCondition(Hashtable hashtable)
  41. {
  42. if(CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  43. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  44. return false;
  45. }
  46. bool CanActivateCondition(Hashtable hashtable)
  47. {
  48. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  49. }
  50. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  51. {
  52. if (card.Owner.HandCards.Count >= 1)
  53. {
  54. int discardCount = 1;
  55. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  56. selectHandEffect.SetUp(
  57. selectPlayer: card.Owner,
  58. canTargetCondition: (cardSource) => true,
  59. canTargetCondition_ByPreSelecetedList: null,
  60. canEndSelectCondition: null,
  61. maxCount: discardCount,
  62. canNoSelect: false,
  63. canEndNotMax: false,
  64. isShowOpponent: true,
  65. selectCardCoroutine: null,
  66. afterSelectCardCoroutine: null,
  67. mode: SelectHandEffect.Mode.Discard,
  68. cardEffect: activateClass);
  69. yield return StartCoroutine(selectHandEffect.Activate());
  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: () => true,
  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. #endregion
  97. #region Inherit
  98. if (timing == EffectTiming.OnDestroyedAnyone)
  99. {
  100. cardEffects.Add(CardEffectFactory.RetaliationSelfEffect(isInheritedEffect: true, card: card, condition: null));
  101. }
  102. #endregion
  103. return cardEffects;
  104. }
  105. }
  106. }