BT2_038.cs 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System.Linq;
  5. using Photon;
  6. using System;
  7. using Photon.Pun;
  8. public class BT2_038 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. if (timing == EffectTiming.OnEnterFieldAnyone)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Play 1 Tamer from hand", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[When Digivolving] You may play 1 yellow Tamer card from your hand without paying its memory cost. Any [On Play] effects on the Tamer played with this effect don't activate. ";
  22. }
  23. bool CanSelectCardCondition(CardSource cardSource)
  24. {
  25. if (cardSource.IsTamer)
  26. {
  27. if (cardSource.HasCardColor(CardColor.Yellow))
  28. {
  29. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  30. {
  31. return true;
  32. }
  33. }
  34. }
  35. return false;
  36. }
  37. bool CanUseCondition(Hashtable hashtable)
  38. {
  39. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  40. }
  41. bool CanActivateCondition(Hashtable hashtable)
  42. {
  43. if (CardEffectCommons.IsExistOnBattleArea(card))
  44. {
  45. if (card.Owner.HandCards.Count >= 1)
  46. {
  47. return true;
  48. }
  49. }
  50. return false;
  51. }
  52. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  53. {
  54. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  55. {
  56. List<CardSource> selectedCards = new List<CardSource>();
  57. int maxCount = 1;
  58. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  59. selectHandEffect.SetUp(
  60. selectPlayer: card.Owner,
  61. canTargetCondition: CanSelectCardCondition,
  62. canTargetCondition_ByPreSelecetedList: null,
  63. canEndSelectCondition: null,
  64. maxCount: maxCount,
  65. canNoSelect: true,
  66. canEndNotMax: false,
  67. isShowOpponent: true,
  68. selectCardCoroutine: SelectCardCoroutine,
  69. afterSelectCardCoroutine: null,
  70. mode: SelectHandEffect.Mode.Custom,
  71. cardEffect: activateClass);
  72. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  73. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  74. yield return StartCoroutine(selectHandEffect.Activate());
  75. IEnumerator SelectCardCoroutine(CardSource cardSource)
  76. {
  77. selectedCards.Add(cardSource);
  78. yield return null;
  79. }
  80. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  81. cardSources: selectedCards,
  82. activateClass: activateClass,
  83. payCost: false,
  84. isTapped: false,
  85. root: SelectCardEffect.Root.Hand,
  86. activateETB: false));
  87. }
  88. }
  89. }
  90. if (timing == EffectTiming.None)
  91. {
  92. bool Condition()
  93. {
  94. if (CardEffectCommons.IsExistOnBattleArea(card))
  95. {
  96. if (CardEffectCommons.IsOwnerTurn(card))
  97. {
  98. if (CardEffectCommons.MatchConditionOwnersPermanentCount(card, (permanent) =>
  99. permanent.IsTamer && permanent.TopCard.CardColors.Contains(CardColor.Yellow)) >= 3)
  100. {
  101. return true;
  102. }
  103. }
  104. }
  105. return false;
  106. }
  107. cardEffects.Add(CardEffectFactory.ChangeSelfSAttackStaticEffect(changeValue: 1, isInheritedEffect: true, card: card, condition: Condition));
  108. }
  109. return cardEffects;
  110. }
  111. }