P_027.cs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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 P_027 : 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.OnDeclaration)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Use 1 Option from hand", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[Main] <Digi-Burst 2> (Trash 2 of this Digimon's digivolution cards to activate the effect below.) - Use a purple Option card with a memory cost of 7 or less in your hand without paying its memory cost.";
  22. }
  23. bool CanSelectCardCondition(CardSource cardSource)
  24. {
  25. return cardSource.IsOption &&
  26. cardSource.HasCardColor(CardColor.Purple) &&
  27. cardSource.HasUseCost && cardSource.GetCostItself <= 7 &&
  28. !cardSource.CanNotPlayThisOption;
  29. }
  30. bool CanUseCondition(Hashtable hashtable)
  31. {
  32. if (CardEffectCommons.IsExistOnBattleArea(card))
  33. {
  34. if (new IDigiBurst(card.PermanentOfThisCard(), 2, activateClass).CanDigiBurst())
  35. {
  36. return true;
  37. }
  38. }
  39. return false;
  40. }
  41. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  42. {
  43. yield return ContinuousController.instance.StartCoroutine(new IDigiBurst(card.PermanentOfThisCard(), 2, activateClass).DigiBurst());
  44. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  45. {
  46. List<CardSource> selectedCards = new List<CardSource>();
  47. int maxCount = 1;
  48. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  49. selectHandEffect.SetUp(
  50. selectPlayer: card.Owner,
  51. canTargetCondition: CanSelectCardCondition,
  52. canTargetCondition_ByPreSelecetedList: null,
  53. canEndSelectCondition: null,
  54. maxCount: maxCount,
  55. canNoSelect: true,
  56. canEndNotMax: false,
  57. isShowOpponent: true,
  58. selectCardCoroutine: SelectCardCoroutine,
  59. afterSelectCardCoroutine: null,
  60. mode: SelectHandEffect.Mode.Custom,
  61. cardEffect: activateClass);
  62. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  63. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  64. yield return StartCoroutine(selectHandEffect.Activate());
  65. IEnumerator SelectCardCoroutine(CardSource cardSource)
  66. {
  67. selectedCards.Add(cardSource);
  68. yield return null;
  69. }
  70. yield return ContinuousController.instance.StartCoroutine(
  71. CardEffectCommons.PlayOptionCards(
  72. cardSources: selectedCards,
  73. activateClass: activateClass,
  74. payCost: false,
  75. root: SelectCardEffect.Root.Hand
  76. )
  77. );
  78. }
  79. }
  80. }
  81. return cardEffects;
  82. }
  83. }