BT4_089.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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 BT4_089 : 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("Draw 2 and Play 1 Option", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[When Digivolving] Trigger <Draw 2>. (Draw 2 cards from your deck.) Then, you may use a purple Option card with a memory cost of 6 or less in your hand without paying its memory cost.";
  22. }
  23. bool CanSelectCardCondition(CardSource cardSource)
  24. {
  25. if (cardSource.IsOption)
  26. {
  27. if (cardSource.GetCostItself <= 6)
  28. {
  29. if (cardSource.HasUseCost)
  30. {
  31. if (!cardSource.CanNotPlayThisOption)
  32. {
  33. if (cardSource.HasCardColor(CardColor.Purple))
  34. {
  35. return true;
  36. }
  37. }
  38. }
  39. }
  40. }
  41. return false;
  42. }
  43. bool CanUseCondition(Hashtable hashtable)
  44. {
  45. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  46. }
  47. bool CanActivateCondition(Hashtable hashtable)
  48. {
  49. if (CardEffectCommons.IsExistOnBattleArea(card))
  50. {
  51. if (card.Owner.LibraryCards.Count >= 1)
  52. {
  53. return true;
  54. }
  55. if (card.Owner.HandCards.Count >= 1)
  56. {
  57. return true;
  58. }
  59. }
  60. return false;
  61. }
  62. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  63. {
  64. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 2, activateClass).Draw());
  65. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  66. {
  67. List<CardSource> selectedCards = new List<CardSource>();
  68. int maxCount = 1;
  69. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  70. selectHandEffect.SetUp(
  71. selectPlayer: card.Owner,
  72. canTargetCondition: CanSelectCardCondition,
  73. canTargetCondition_ByPreSelecetedList: null,
  74. canEndSelectCondition: null,
  75. maxCount: maxCount,
  76. canNoSelect: true,
  77. canEndNotMax: false,
  78. isShowOpponent: true,
  79. selectCardCoroutine: SelectCardCoroutine,
  80. afterSelectCardCoroutine: null,
  81. mode: SelectHandEffect.Mode.Custom,
  82. cardEffect: activateClass);
  83. selectHandEffect.SetUpCustomMessage(
  84. "Select 1 option card to use.",
  85. "The opponent is selecting 1 option card to use.");
  86. selectHandEffect.SetUpCustomMessage_ShowCard("Used Card");
  87. yield return StartCoroutine(selectHandEffect.Activate());
  88. IEnumerator SelectCardCoroutine(CardSource cardSource)
  89. {
  90. selectedCards.Add(cardSource);
  91. yield return null;
  92. }
  93. yield return ContinuousController.instance.StartCoroutine(
  94. CardEffectCommons.PlayOptionCards(
  95. cardSources: selectedCards,
  96. activateClass: activateClass,
  97. payCost: false,
  98. root: SelectCardEffect.Root.Hand
  99. )
  100. );
  101. }
  102. }
  103. }
  104. return cardEffects;
  105. }
  106. }