BT2_092.cs 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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 BT2_092 : 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] Up to 2 of your Digimon gain <Security Attack +1> (This Digimon checks 1 additional security card) for the turn.";
  22. }
  23. bool CanSelectPermanentCondition(Permanent permanent)
  24. {
  25. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  26. }
  27. bool CanUseCondition(Hashtable hashtable)
  28. {
  29. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  30. }
  31. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  32. {
  33. int maxCount = Math.Min(2, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  34. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  35. selectPermanentEffect.SetUp(
  36. selectPlayer: card.Owner,
  37. canTargetCondition: CanSelectPermanentCondition,
  38. canTargetCondition_ByPreSelecetedList: null,
  39. canEndSelectCondition: CanEndSelectCondition,
  40. maxCount: maxCount,
  41. canNoSelect: false,
  42. canEndNotMax: true,
  43. selectPermanentCoroutine: SelectPermanentCoroutine,
  44. afterSelectPermanentCoroutine: null,
  45. mode: SelectPermanentEffect.Mode.Custom,
  46. cardEffect: activateClass);
  47. selectPermanentEffect.SetUpCustomMessage(customMessageArray: CardEffectCommons.customPermanentMessageArray_ChangeSAttack(changeValue: +1, maxCount: maxCount));
  48. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  49. bool CanEndSelectCondition(List<Permanent> permanents)
  50. {
  51. if (CardEffectCommons.HasNoElement(permanents))
  52. {
  53. return false;
  54. }
  55. return true;
  56. }
  57. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  58. {
  59. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonSAttack(targetPermanent: permanent, changeValue: 1, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  60. }
  61. }
  62. }
  63. return cardEffects;
  64. }
  65. }