EX7_025.cs 5.0 KB

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