BT3_102.cs 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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 BT3_102 : 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.OptionSkill)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  17. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[Main] Your opponent may trash the top card of their security stack. If they don't, trigger <Recovery +1 (Deck)>. (Place the top card of your deck on top of your security stack.)";
  22. }
  23. bool CanUseCondition(Hashtable hashtable)
  24. {
  25. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  26. }
  27. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  28. {
  29. if (card.Owner.Enemy.SecurityCards.Count > 0)
  30. {
  31. List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
  32. {
  33. new SelectionElement<bool>(message: $"Discard", value : true, spriteIndex: 0),
  34. new SelectionElement<bool>(message: $"Not Discard", value : false, spriteIndex: 1),
  35. };
  36. string selectPlayerMessage = "Will you discard the top card of your security?";
  37. string notSelectPlayerMessage = "The opponent is choosing whether to discard security.";
  38. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner.Enemy, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
  39. }
  40. else
  41. {
  42. GManager.instance.userSelectionManager.SetBool(false);
  43. }
  44. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  45. bool doDiscard = GManager.instance.userSelectionManager.SelectedBoolValue;
  46. if (!doDiscard)
  47. {
  48. yield return ContinuousController.instance.StartCoroutine(new IRecovery(card.Owner, 1, activateClass).Recovery());
  49. }
  50. else
  51. {
  52. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  53. player: card.Owner.Enemy,
  54. destroySecurityCount: 1,
  55. cardEffect: activateClass,
  56. fromTop: true).DestroySecurity());
  57. }
  58. }
  59. }
  60. return cardEffects;
  61. }
  62. }