Jamming.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System;
  4. using System.Linq;
  5. using UnityEngine;
  6. public partial class CardEffectCommons
  7. {
  8. #region Target 1 Digimon gains [Jamming]
  9. public static IEnumerator GainJamming(Permanent targetPermanent, EffectDuration effectDuration, ICardEffect activateClass)
  10. {
  11. if (targetPermanent == null) yield break;
  12. if (!IsPermanentExistsOnBattleArea(targetPermanent)) yield break;
  13. if (activateClass == null) yield break;
  14. if (activateClass.EffectSourceCard == null) yield break;
  15. CardSource card = activateClass.EffectSourceCard;
  16. bool PermanentCondition(Permanent permanent) => permanent == targetPermanent;
  17. bool CanUseCondition()
  18. {
  19. if (IsPermanentExistsOnBattleArea(targetPermanent))
  20. {
  21. if (!targetPermanent.TopCard.CanNotBeAffected(activateClass))
  22. {
  23. return true;
  24. }
  25. }
  26. return false;
  27. }
  28. CanNotBeDestroyedByBattleClass jamming = CardEffectFactory.JammingStaticEffect(permanentCondition: PermanentCondition, isInheritedEffect: false, card: card, condition: CanUseCondition);
  29. AddEffectToPermanent(targetPermanent: targetPermanent, effectDuration: effectDuration, card: card, cardEffect: jamming, timing: EffectTiming.None);
  30. if (!targetPermanent.TopCard.CanNotBeAffected(activateClass))
  31. {
  32. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateBuffEffect(targetPermanent));
  33. }
  34. }
  35. #endregion
  36. }