BT19_060.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT19
  5. {
  6. public class BT19_060: 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 [Ryo Akiyama] Tamer from hand", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, 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 [Ryo Akiyama] from your hand without paying the cost.";
  22. }
  23. bool CanUseCondition(Hashtable hashtable)
  24. {
  25. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  26. }
  27. bool IsRyoCardCondition(CardSource cardSource)
  28. {
  29. return cardSource.IsTamer &&
  30. cardSource.EqualsCardName("Ryo Akiyama") &&
  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, IsRyoCardCondition) &&
  37. card.Owner.GetBattleAreaPermanents().Count(permanent => permanent.IsTamer) <= 1;
  38. }
  39. IEnumerator ActivateCoroutine(Hashtable hashtable)
  40. {
  41. if (CardEffectCommons.HasMatchConditionOwnersHand(card, IsRyoCardCondition))
  42. {
  43. List<CardSource> selectedCards = new List<CardSource>();
  44. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  45. selectHandEffect.SetUp(
  46. selectPlayer: card.Owner,
  47. canTargetCondition: IsRyoCardCondition,
  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 ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  65. cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false,
  66. root: SelectCardEffect.Root.Hand, activateETB: true));
  67. }
  68. }
  69. }
  70. }
  71. #endregion
  72. #region All Turns - ESS
  73. if (timing == EffectTiming.None)
  74. {
  75. bool Condition()
  76. {
  77. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  78. }
  79. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(changeValue: 1000, isInheritedEffect: true, card: card, condition: Condition));
  80. }
  81. #endregion
  82. return cardEffects;
  83. }
  84. }
  85. }