ST21_07.cs 4.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.ST21
  4. {
  5. public class ST21_07 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Alternate Digivolution Requirement
  11. if (timing == EffectTiming.None)
  12. {
  13. static bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. return targetPermanent.TopCard.HasAdventureTraits && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 2;
  16. }
  17. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false, card: card, condition: null));
  18. }
  19. #endregion
  20. #region On Play
  21. if (timing == EffectTiming.OnEnterFieldAnyone)
  22. {
  23. ActivateClass activateClass = new ActivateClass();
  24. activateClass.SetUpICardEffect("Trash 1 [Adventure], <Draw 2>", CanUseCondition, card);
  25. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  26. cardEffects.Add(activateClass);
  27. string EffectDescription()
  28. {
  29. return "[On Play] By trashing 1 card with the [ADVENTURE] trait in your hand, <Draw 2>. (Draw 2 cards from your deck.)";
  30. }
  31. bool CanUseCondition(Hashtable hashtable)
  32. {
  33. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  34. }
  35. bool HasAdventureTrait(CardSource cardSource)
  36. => cardSource.HasAdventureTraits;
  37. bool CanActivateCondition(Hashtable hashtable)
  38. {
  39. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  40. CardEffectCommons.HasMatchConditionOwnersHand(card, HasAdventureTrait);
  41. }
  42. IEnumerator ActivateCoroutine(Hashtable hashtable)
  43. {
  44. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  45. selectHandEffect.SetUp(
  46. canTargetCondition: HasAdventureTrait,
  47. canTargetCondition_ByPreSelecetedList: null,
  48. canEndSelectCondition: null,
  49. canNoSelect: true,
  50. selectCardCoroutine: null,
  51. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  52. maxCount: 1,
  53. canEndNotMax: false,
  54. isShowOpponent: true,
  55. mode: SelectHandEffect.Mode.Discard,
  56. selectPlayer: card.Owner,
  57. cardEffect: activateClass);
  58. selectHandEffect.SetUpCustomMessage("Select 1 card with the [ADVENTURE] trait to discard.",
  59. "The opponent is selecting 1 card with the [ADVENTURE] trait to discard.");
  60. yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
  61. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  62. {
  63. if (cardSources.Count > 0)
  64. {
  65. yield return ContinuousController.instance.StartCoroutine(
  66. new DrawClass(card.Owner, 2, activateClass).Draw());
  67. }
  68. }
  69. }
  70. }
  71. #endregion
  72. #region All Turn - ESS
  73. if (timing == EffectTiming.None)
  74. {
  75. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(changeValue: 1000, isInheritedEffect: true, card: card, condition: null));
  76. }
  77. #endregion
  78. return cardEffects;
  79. }
  80. }
  81. }