EX11_054.cs 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // Owen Dreadnought
  4. namespace DCGO.CardEffects.EX11
  5. {
  6. public class EX11_054 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Start of turn set to 3
  12. if (timing == EffectTiming.OnStartTurn)
  13. {
  14. cardEffects.Add(CardEffectFactory.SetMemoryTo3TamerEffect(card));
  15. }
  16. #endregion
  17. #region All Turns
  18. if (timing == EffectTiming.OnEnterFieldAnyone)
  19. {
  20. ActivateClass activateClass = new();
  21. activateClass.SetUpICardEffect("By suspending this tamer, Draw 1 and give a Digimon with <Progress> +3k DP.", CanUseCondition, card);
  22. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  23. cardEffects.Add(activateClass);
  24. string EffectDescription()
  25. => "[All Turns] When your Digimon are played or digivolve, if any of them have the [Reptile] or [Dragonkin] trait, by suspending this Tamer, <Draw 1>. After, 1 of your Digimon with <Progress> gets +3000 DP for the turn.";
  26. bool CanUseCondition(Hashtable hashtable)
  27. {
  28. return CardEffectCommons.IsExistOnBattleArea(card)
  29. && (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentCondition)
  30. || CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, PermanentCondition));
  31. }
  32. bool PermanentCondition(Permanent permanent)
  33. {
  34. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  35. && (permanent.TopCard.EqualsTraits("Reptile") || permanent.TopCard.EqualsTraits("Dragonkin"));
  36. }
  37. bool CanActivateCondition(Hashtable hashtable)
  38. {
  39. return CardEffectCommons.IsExistOnBattleArea(card)
  40. && CardEffectCommons.CanActivateSuspendCostEffect(card);
  41. }
  42. bool CanSelectPermanentCondition(Permanent permanent)
  43. {
  44. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  45. && permanent.TopCard.EffectList(EffectTiming.None).Some(cardEffect => cardEffect.EffectName == "Progress");
  46. }
  47. IEnumerator ActivateCoroutine(Hashtable hashtable)
  48. {
  49. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(
  50. new List<Permanent>() { card.PermanentOfThisCard() },
  51. CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  52. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  53. List<Permanent> validTargets = card.Owner.GetBattleAreaDigimons().Filter(CanSelectPermanentCondition);
  54. Permanent selectedPermanent = null;
  55. if(validTargets.Count == 1)
  56. {
  57. selectedPermanent = validTargets[0];
  58. }
  59. else if (validTargets.Count > 1)
  60. {
  61. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  62. selectPermanentEffect.SetUp(
  63. selectPlayer: card.Owner,
  64. canTargetCondition: validTargets.Contains,
  65. canTargetCondition_ByPreSelecetedList: null,
  66. canEndSelectCondition: null,
  67. maxCount: 1,
  68. canNoSelect: false,
  69. canEndNotMax: false,
  70. selectPermanentCoroutine: SelectPermanentCoroutine,
  71. afterSelectPermanentCoroutine: null,
  72. mode: SelectPermanentEffect.Mode.Custom,
  73. cardEffect: activateClass);
  74. selectPermanentEffect.SetUpCustomMessage("Select a Digimon to gain 3000 DP.", "Opponent is selecting a Digimon to gain 3000 DP.");
  75. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  76. {
  77. selectedPermanent = permanent;
  78. yield return null;
  79. }
  80. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  81. }
  82. if (selectedPermanent != null)
  83. {
  84. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDPPlayerEffect(
  85. permanentCondition: permanent => permanent == selectedPermanent,
  86. changeValue: 3000,
  87. effectDuration: EffectDuration.UntilEachTurnEnd,
  88. activateClass: activateClass));
  89. }
  90. }
  91. }
  92. #endregion
  93. #region Security
  94. if (timing == EffectTiming.SecuritySkill)
  95. {
  96. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  97. }
  98. #endregion
  99. return cardEffects;
  100. }
  101. }
  102. }