EX11_015.cs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. // Frigimon
  5. namespace DCGO.CardEffects.EX11
  6. {
  7. public class EX11_015 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternate Digivolution Requirement
  13. if (timing == EffectTiming.None)
  14. {
  15. static bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.EqualsTraits("Ice-Snow") && targetPermanent.TopCard.IsLevel3;
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null));
  20. }
  21. #endregion
  22. #region When Digivolving
  23. if (timing == EffectTiming.OnEnterFieldAnyone)
  24. {
  25. ActivateClass activateClass = new ActivateClass();
  26. activateClass.SetUpICardEffect("Play 1 [Suzune Kazuki] from hand", CanUseCondition, card);
  27. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  28. cardEffects.Add(activateClass);
  29. string EffectDescription()
  30. {
  31. return
  32. "[When Digivolving] If you have 1 or fewer Tamers, you may play 1 [Suzune Kazuki] from your hand without paying the cost.";
  33. }
  34. bool CanUseCondition(Hashtable hashtable)
  35. {
  36. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card)
  37. && CardEffectCommons.IsExistOnBattleArea(card);
  38. }
  39. bool IsTamerCardCondition(CardSource cardSource)
  40. {
  41. return cardSource.IsTamer
  42. && cardSource.EqualsCardName("Suzune Kazuki")
  43. && CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass);
  44. }
  45. bool CanActivateCondition(Hashtable hashtable)
  46. {
  47. return CardEffectCommons.IsExistOnBattleArea(card)
  48. && CardEffectCommons.HasMatchConditionOwnersHand(card, IsTamerCardCondition)
  49. && card.Owner.GetBattleAreaPermanents().Count(permanent => permanent.IsTamer) <= 1;
  50. }
  51. IEnumerator ActivateCoroutine(Hashtable hashtable)
  52. {
  53. List<CardSource> selectedCards = new List<CardSource>();
  54. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  55. selectHandEffect.SetUp(
  56. selectPlayer: card.Owner,
  57. canTargetCondition: IsTamerCardCondition,
  58. canTargetCondition_ByPreSelecetedList: null,
  59. canEndSelectCondition: null,
  60. maxCount: 1,
  61. canNoSelect: true,
  62. canEndNotMax: false,
  63. isShowOpponent: true,
  64. selectCardCoroutine: SelectCardCoroutine,
  65. afterSelectCardCoroutine: null,
  66. mode: SelectHandEffect.Mode.Custom,
  67. cardEffect: activateClass);
  68. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  69. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  70. yield return StartCoroutine(selectHandEffect.Activate());
  71. IEnumerator SelectCardCoroutine(CardSource cardSource)
  72. {
  73. selectedCards.Add(cardSource);
  74. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  75. cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false,
  76. root: SelectCardEffect.Root.Hand, activateETB: true));
  77. }
  78. }
  79. }
  80. #endregion
  81. #region Inherited Effect - Jamming
  82. if (timing == EffectTiming.None)
  83. {
  84. cardEffects.Add(CardEffectFactory.JammingSelfStaticEffect(
  85. isInheritedEffect: true,
  86. card: card,
  87. condition: null));
  88. }
  89. #endregion
  90. return cardEffects;
  91. }
  92. }
  93. }