BT15_003.cs 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT15
  4. {
  5. public class BT15_003 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. if (timing == EffectTiming.OnAllyAttack)
  11. {
  12. ActivateClass activateClass = new ActivateClass();
  13. activateClass.SetUpICardEffect("Trash the top or bottom of your security to gain Memory +1", CanUseCondition, card);
  14. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  15. activateClass.SetIsInheritedEffect(true);
  16. activateClass.SetHashString("TrashSecuirtyToGainMemory+1_BT15_003");
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[When Attacking][Once Per Turn] By trashing the top or bottom card of your security stack, gain 1 memory.";
  21. }
  22. bool CanUseCondition(Hashtable hashtable)
  23. {
  24. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  25. }
  26. bool CanActivateCondition(Hashtable hashtable)
  27. {
  28. if (CardEffectCommons.IsExistOnBattleArea(card))
  29. {
  30. if (card.Owner.SecurityCards.Count >= 1)
  31. {
  32. return true;
  33. }
  34. }
  35. return false;
  36. }
  37. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  38. {
  39. if (card.Owner.SecurityCards.Count >= 1)
  40. {
  41. List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
  42. {
  43. new SelectionElement<bool>(message: $"Security Top", value : true, spriteIndex: 0),
  44. new SelectionElement<bool>(message: $"Security Bottom", value : false, spriteIndex: 1),
  45. };
  46. string selectPlayerMessage = "Which will you trash the top or bottom card of the security?";
  47. string notSelectPlayerMessage = "The opponent is selecting whether to trash the top or bottom card of security.";
  48. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
  49. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  50. bool fromTop = GManager.instance.userSelectionManager.SelectedBoolValue;
  51. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  52. card.Owner,
  53. 1,
  54. activateClass,
  55. fromTop).DestroySecurity());
  56. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  57. }
  58. }
  59. }
  60. return cardEffects;
  61. }
  62. }
  63. }