EX12_010.cs 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // Greymon
  4. namespace DCGO.CardEffects.EX12
  5. {
  6. public class EX12_010 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alternative Digivolution Condition
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.ContainsCardName("Agumon")
  17. || targetPermanent.TopCard.EqualsTraits("ME")
  18. || targetPermanent.TopCard.EqualsTraits("VB");
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  21. permanentCondition: PermanentCondition,
  22. digivolutionCost: 2,
  23. ignoreDigivolutionRequirement: false,
  24. card: card,
  25. condition: null,
  26. level: 3)
  27. );
  28. }
  29. #endregion
  30. #region Raid
  31. if (timing == EffectTiming.OnAllyAttack)
  32. {
  33. cardEffects.Add(CardEffectFactory.RaidSelfEffect(isInheritedEffect: false, card: card, condition: null));
  34. }
  35. #endregion
  36. #region Shared OP/WA
  37. string SharedEffectName = "May return 1 [Greymon] in name/[ME]/[VB] trait Digimon card from trash to hand";
  38. CardEffectFactory.ActivateClassesForSharedEffects
  39. (ref cardEffects, timing, card,
  40. SharedEffectName,
  41. SharedActivateCoroutine,
  42. SharedEffectDescription,
  43. additionalActivateCondition: AdditionalActivateCondition,
  44. optional: false,
  45. isSkippable: true,
  46. onPlay: true,
  47. whenDigivolving: true);
  48. string SharedEffectDescription(string tag)
  49. {
  50. return $"[{tag}] You may return 1 Digimon card with [Greymon] in its name or the [ME] or [VB] trait from your trash to the hand.";
  51. }
  52. bool AdditionalActivateCondition(Hashtable hashtable, ActivateClass activateClass)
  53. {
  54. return CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition);
  55. }
  56. bool CanSelectCardCondition(CardSource cardSource)
  57. {
  58. return cardSource.IsDigimon
  59. && (cardSource.ContainsCardName("Greymon")
  60. || cardSource.EqualsTraits("ME")
  61. || cardSource.EqualsTraits("VB"));
  62. }
  63. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  64. {
  65. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  66. selectCardEffect.SetUp(
  67. canTargetCondition: CanSelectCardCondition,
  68. canTargetCondition_ByPreSelecetedList: null,
  69. canEndSelectCondition: null,
  70. canNoSelect: () => true,
  71. selectCardCoroutine: null,
  72. afterSelectCardCoroutine: null,
  73. message: "Select 1 card to add to your hand.",
  74. maxCount: 1,
  75. canEndNotMax: false,
  76. isShowOpponent: true,
  77. mode: SelectCardEffect.Mode.AddHand,
  78. root: SelectCardEffect.Root.Trash,
  79. customRootCardList: null,
  80. canLookReverseCard: true,
  81. selectPlayer: card.Owner,
  82. cardEffect: activateClass);
  83. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  84. }
  85. #endregion
  86. #region Inherited Raid
  87. if (timing == EffectTiming.OnAllyAttack)
  88. {
  89. cardEffects.Add(CardEffectFactory.RaidSelfEffect(isInheritedEffect: true, card: card, condition: null));
  90. }
  91. #endregion
  92. return cardEffects;
  93. }
  94. }
  95. }