BT10_023.cs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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. namespace DCGO.CardEffects.BT10
  9. {
  10. public class BT10_023 : CEntity_Effect
  11. {
  12. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  13. {
  14. List<ICardEffect> cardEffects = new List<ICardEffect>();
  15. if (timing == EffectTiming.OnEnterFieldAnyone)
  16. {
  17. ActivateClass activateClass = new ActivateClass();
  18. activateClass.SetUpICardEffect("Draw 2", CanUseCondition, card);
  19. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  20. cardEffects.Add(activateClass);
  21. string EffectDiscription()
  22. {
  23. return "[When Digivolving] If you have 6 or fewer cards in your hand, <Draw 2>. (Draw 2 cards from your deck.)";
  24. }
  25. bool CanUseCondition(Hashtable hashtable)
  26. {
  27. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  28. }
  29. bool CanActivateCondition(Hashtable hashtable)
  30. {
  31. if (CardEffectCommons.IsExistOnBattleArea(card))
  32. {
  33. if (card.Owner.LibraryCards.Count >= 1)
  34. {
  35. if (card.Owner.HandCards.Count <= 6)
  36. {
  37. return true;
  38. }
  39. }
  40. }
  41. return false;
  42. }
  43. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  44. {
  45. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 2, activateClass).Draw());
  46. }
  47. }
  48. if (timing == EffectTiming.OnAllyAttack)
  49. {
  50. ActivateClass activateClass = new ActivateClass();
  51. activateClass.SetUpICardEffect("Trash 2 cards from hand to unsuspend this Digimon", CanUseCondition, card);
  52. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  53. activateClass.SetHashString("Unsuspend_BT10_023");
  54. cardEffects.Add(activateClass);
  55. string EffectDiscription()
  56. {
  57. return "[When Attacking][Once Per Turn] If you have 8 or more cards in your hand, by trashing 2 cards in your hand, unsuspend this Digimon.";
  58. }
  59. bool CanUseCondition(Hashtable hashtable)
  60. {
  61. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  62. }
  63. bool CanActivateCondition(Hashtable hashtable)
  64. {
  65. if (CardEffectCommons.IsExistOnBattleArea(card))
  66. {
  67. if (card.Owner.HandCards.Count >= 8)
  68. {
  69. return true;
  70. }
  71. }
  72. return false;
  73. }
  74. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  75. {
  76. if (card.Owner.HandCards.Count >= 2)
  77. {
  78. int discardCount = 2;
  79. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  80. selectHandEffect.SetUp(
  81. selectPlayer: card.Owner,
  82. canTargetCondition: (cardSource) => true,
  83. canTargetCondition_ByPreSelecetedList: null,
  84. canEndSelectCondition: null,
  85. maxCount: discardCount,
  86. canNoSelect: false,
  87. canEndNotMax: false,
  88. isShowOpponent: true,
  89. selectCardCoroutine: null,
  90. afterSelectCardCoroutine: null,
  91. mode: SelectHandEffect.Mode.Discard,
  92. cardEffect: activateClass);
  93. yield return StartCoroutine(selectHandEffect.Activate());
  94. Permanent selectedPermanent = card.PermanentOfThisCard();
  95. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { selectedPermanent }, activateClass).Unsuspend());
  96. }
  97. }
  98. }
  99. return cardEffects;
  100. }
  101. }
  102. }