BT25_037.cs 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // Pegasusmon
  4. namespace DCGO.CardEffects.BT25
  5. {
  6. public class BT25_037 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alternate Digivolutions
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.EqualsCardName("Patamon");
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null));
  19. }
  20. if (timing == EffectTiming.None)
  21. {
  22. static bool PermanentCondition(Permanent targetPermanent)
  23. {
  24. return targetPermanent.TopCard.HasTSTraits;
  25. }
  26. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(PermanentCondition, 2, false, card, null, level: 3));
  27. }
  28. #endregion
  29. #region Armor Purge
  30. if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
  31. {
  32. cardEffects.Add(CardEffectFactory.ArmorPurgeEffect(card: card));
  33. }
  34. #endregion
  35. #region Shared OP / WD
  36. string SharedEffectName = "Add top sec to hand, then may place 1 traited card to top/bot sec";
  37. CardEffectFactory.ActivateClassesForSharedEffects
  38. (ref cardEffects, timing, card,
  39. SharedEffectName,
  40. SharedActivateCoroutine,
  41. SharedEffectDescription,
  42. optional: false,
  43. onPlay: true,
  44. whenDigivolving: true);
  45. string SharedEffectDescription(string tag) => $"[{tag}] Add your top security card to the hand. Then, you may place 1 [Angel], [Archangel] [Three Great Angels] or [Iliad] trait Digimon card or 1 [TS] trait Tamer card from your hand as the top or bottom security card.";
  46. bool CanSelectCardCondition(CardSource cardSource)
  47. {
  48. return (cardSource.IsDigimon
  49. && (cardSource.EqualsTraits("Angel")
  50. || cardSource.EqualsTraits("Archangel")
  51. || cardSource.EqualsTraits("Three Great Angels")
  52. || cardSource.EqualsTraits("Iliad")))
  53. || (cardSource.IsTamer
  54. && cardSource.HasTSTraits);
  55. }
  56. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  57. {
  58. if (card.Owner.SecurityCards.Count > 0)
  59. {
  60. CardSource topCard = card.Owner.SecurityCards[0];
  61. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddHandCards(new List<CardSource>() { topCard }, false, activateClass));
  62. yield return ContinuousController.instance.StartCoroutine(new IReduceSecurity(
  63. player: card.Owner,
  64. refSkillInfos: ref ContinuousController.instance.nullSkillInfos,
  65. activateClass).ReduceSecurity());
  66. }
  67. if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition)
  68. && card.Owner.CanAddSecurity(activateClass))
  69. {
  70. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  71. selectHandEffect.SetUp(
  72. selectPlayer: card.Owner,
  73. canTargetCondition: CanSelectCardCondition,
  74. canTargetCondition_ByPreSelecetedList: null,
  75. canEndSelectCondition: null,
  76. maxCount: 1,
  77. canNoSelect: true,
  78. canEndNotMax: false,
  79. isShowOpponent: true,
  80. selectCardCoroutine: SelectCardCoroutine,
  81. afterSelectCardCoroutine: null,
  82. mode: SelectHandEffect.Mode.Custom,
  83. cardEffect: activateClass);
  84. selectHandEffect.SetUpCustomMessage("Select 1 card to place at the top or bottom of security.", "The opponent is selecting 1 card to place at the top or bottom of security.");
  85. selectHandEffect.SetUpCustomMessage_ShowCard("Selected Card");
  86. yield return StartCoroutine(selectHandEffect.Activate());
  87. IEnumerator SelectCardCoroutine(CardSource cardSource)
  88. {
  89. if (cardSource != null)
  90. {
  91. List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
  92. {
  93. new SelectionElement<bool>(message: $"Security Top", value : true, spriteIndex: 0),
  94. new SelectionElement<bool>(message: $"Security Bottom", value : false, spriteIndex: 1),
  95. };
  96. string selectPlayerMessage = "Choose security position?";
  97. string notSelectPlayerMessage = "The opponent is choosing security position";
  98. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
  99. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  100. bool position = GManager.instance.userSelectionManager.SelectedBoolValue;
  101. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddSecurityCard(cardSource, toTop: position));
  102. }
  103. }
  104. }
  105. }
  106. #endregion
  107. return cardEffects;
  108. }
  109. }
  110. }