| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- using System.Collections;
- using System.Collections.Generic;
- using System;
- using System.Linq;
- using UnityEngine;
- public partial class CardEffectCommons
- {
- #region Target 1 Digimon can't attack
- public static IEnumerator GainCanNotAttack(
- Permanent targetPermanent,
- Func<Permanent, bool> defenderCondition,
- EffectDuration effectDuration,
- ICardEffect activateClass,
- string effectName)
- {
- if (targetPermanent == null) yield break;
- if (!IsPermanentExistsOnBattleArea(targetPermanent)) yield break;
- if (activateClass == null) yield break;
- if (activateClass.EffectSourceCard == null) yield break;
- CardSource card = activateClass.EffectSourceCard;
- bool AttackerCondition(Permanent attacker) => attacker == targetPermanent;
- bool DefenderCondition(Permanent defender)
- {
- if (defenderCondition == null || defenderCondition(defender))
- {
- return true;
- }
- return false;
- }
- bool CanUseCondition()
- {
- if (IsPermanentExistsOnBattleArea(targetPermanent))
- {
- if (!targetPermanent.TopCard.CanNotBeAffected(activateClass))
- {
- return true;
- }
- }
- return false;
- }
- CanNotAttackTargetDefendingPermanentClass canNotAttackClass = CardEffectFactory.CanNotAttackStaticEffect(
- attackerCondition: AttackerCondition,
- defenderCondition: DefenderCondition,
- isInheritedEffect: false,
- card: card,
- condition: CanUseCondition,
- effectName: effectName);
- AddEffectToPermanent(
- targetPermanent: targetPermanent,
- effectDuration: effectDuration,
- card: card,
- cardEffect: canNotAttackClass,
- timing: EffectTiming.None);
- if (!targetPermanent.TopCard.CanNotBeAffected(activateClass))
- {
- yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(targetPermanent));
- }
- }
- #endregion
- }
|