EX11_009.cs 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // Tyrannomon
  4. namespace DCGO.CardEffects.EX11
  5. {
  6. public class EX11_009 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alternate Digivolution
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.IsLevel3
  17. && targetPermanent.TopCard.EqualsTraits("Reptile");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  20. permanentCondition: PermanentCondition,
  21. digivolutionCost: 2,
  22. ignoreDigivolutionRequirement: false,
  23. card: card,
  24. condition: null)
  25. );
  26. }
  27. #endregion
  28. #region When Digivolving
  29. if (timing == EffectTiming.OnEnterFieldAnyone)
  30. {
  31. ActivateClass activateClass = new ActivateClass();
  32. activateClass.SetUpICardEffect("Play 1 [Ryutaro Williams] from your hand", CanUseCondition, card);
  33. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  34. cardEffects.Add(activateClass);
  35. string EffectDiscription()
  36. {
  37. return "[When Digivolving] If you have 1 or fewer Tamers, you may play 1 [Ryutaro Williams] from your hand without paying the cost.";
  38. }
  39. bool HasTamers(Permanent permanent)
  40. {
  41. return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card)
  42. && permanent.IsTamer;
  43. }
  44. bool HasRyutaroWilliams(CardSource source)
  45. {
  46. return source.EqualsCardName("Ryutaro Williams")
  47. && CardEffectCommons.CanPlayAsNewPermanent(source, false, activateClass);
  48. }
  49. bool CanUseCondition(Hashtable hashtable)
  50. {
  51. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  52. && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  53. }
  54. bool CanActivateCondition(Hashtable hashtable)
  55. {
  56. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  57. && CardEffectCommons.MatchConditionOwnersPermanentCount(card, HasTamers) <= 1;
  58. }
  59. IEnumerator ActivateCoroutine(Hashtable hashtable)
  60. {
  61. List<CardSource> selectedCards = new List<CardSource>();
  62. if (CardEffectCommons.HasMatchConditionOwnersHand(card, HasRyutaroWilliams))
  63. {
  64. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  65. selectHandEffect.SetUp(
  66. selectPlayer: card.Owner,
  67. canTargetCondition: HasRyutaroWilliams,
  68. canTargetCondition_ByPreSelecetedList: null,
  69. canEndSelectCondition: null,
  70. maxCount: 1,
  71. canNoSelect: false,
  72. canEndNotMax: false,
  73. isShowOpponent: true,
  74. selectCardCoroutine: SelectCardCoroutine,
  75. afterSelectCardCoroutine: null,
  76. mode: SelectHandEffect.Mode.Custom,
  77. cardEffect: activateClass);
  78. yield return StartCoroutine(selectHandEffect.Activate());
  79. }
  80. IEnumerator SelectCardCoroutine(CardSource cardSource)
  81. {
  82. selectedCards.Add(cardSource);
  83. yield return null;
  84. }
  85. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  86. }
  87. }
  88. #endregion
  89. #region All Turns - ESS
  90. if (timing == EffectTiming.None)
  91. {
  92. bool Condition()
  93. {
  94. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  95. }
  96. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(changeValue: 1000, isInheritedEffect: true, card: card, condition: Condition));
  97. }
  98. #endregion
  99. return cardEffects;
  100. }
  101. }
  102. }