EX4_054.cs 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.EX4
  6. {
  7. public class EX4_054 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return (targetPermanent.TopCard.ContainsCardName("Terriermon") || targetPermanent.TopCard.ContainsCardName("Lopmon")) && targetPermanent.TopCard.HasLevel && targetPermanent.Level == 3;
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null));
  19. }
  20. if (timing == EffectTiming.OnAllyAttack)
  21. {
  22. cardEffects.Add(CardEffectFactory.AllianceSelfEffect(isInheritedEffect: false, card: card, condition: null));
  23. }
  24. if (timing == EffectTiming.OnEndAttack)
  25. {
  26. ActivateClass activateClass = new ActivateClass();
  27. activateClass.SetUpICardEffect("Return 1 card from trash to hand", CanUseCondition, card);
  28. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  29. activateClass.SetIsInheritedEffect(true);
  30. activateClass.SetHashString("Salvage_EX4_054");
  31. cardEffects.Add(activateClass);
  32. string EffectDiscription()
  33. {
  34. return "[End of Attack][Once Per Turn] If you have another suspended Digimon in play, return 1 green Digimon card from your trash to your hand.";
  35. }
  36. bool CanSelectCardCondition(CardSource cardSource)
  37. {
  38. if (cardSource != null)
  39. {
  40. if (cardSource.IsDigimon)
  41. {
  42. if (cardSource.Owner == card.Owner)
  43. {
  44. if (cardSource.HasCardColor(CardColor.Green))
  45. {
  46. return true;
  47. }
  48. }
  49. }
  50. }
  51. return false;
  52. }
  53. bool CanUseCondition(Hashtable hashtable)
  54. {
  55. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  56. }
  57. bool CanActivateCondition(Hashtable hashtable)
  58. {
  59. if (CardEffectCommons.IsExistOnBattleArea(card))
  60. {
  61. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsDigimon && permanent != card.PermanentOfThisCard() && permanent.IsSuspended))
  62. {
  63. return true;
  64. }
  65. }
  66. return false;
  67. }
  68. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  69. {
  70. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  71. {
  72. int maxCount = Math.Min(1, card.Owner.TrashCards.Count(CanSelectCardCondition));
  73. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  74. selectCardEffect.SetUp(
  75. canTargetCondition: CanSelectCardCondition,
  76. canTargetCondition_ByPreSelecetedList: null,
  77. canEndSelectCondition: null,
  78. canNoSelect: () => false,
  79. selectCardCoroutine: null,
  80. afterSelectCardCoroutine: null,
  81. message: "Select 1 card to add to your hand.",
  82. maxCount: maxCount,
  83. canEndNotMax: false,
  84. isShowOpponent: true,
  85. mode: SelectCardEffect.Mode.AddHand,
  86. root: SelectCardEffect.Root.Trash,
  87. customRootCardList: null,
  88. canLookReverseCard: true,
  89. selectPlayer: card.Owner,
  90. cardEffect: activateClass);
  91. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  92. }
  93. }
  94. }
  95. return cardEffects;
  96. }
  97. }
  98. }