EX7_055.cs 5.4 KB

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