EX11_039.cs 4.8 KB

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