using System.Collections; using System.Collections.Generic; using UnityEngine; using System; public class CanNotBeDestroyedByBattleClass : ICardEffect, ICanNotBeDestroyedByBattleEffect { public void SetUpCanNotBeDestroyedByBattleClass(Func canNotBeDestroyedByBattleCondition, Func permanentCondition) { _canNotBeDestroyedByBattleCondition = canNotBeDestroyedByBattleCondition; _permanentCondition = permanentCondition; } Func _canNotBeDestroyedByBattleCondition = null; Func _permanentCondition = null; public bool CanNotBeDestroyedByBattle(Permanent permanent, Permanent attackingPermanent, Permanent defendingPermanent, CardSource defendingCard) { if (_canNotBeDestroyedByBattleCondition != null) { if (CardEffectCommons.IsPermanentExistsOnBattleArea(permanent)) { if (PermanentCondition(permanent)) { if (_canNotBeDestroyedByBattleCondition(permanent, attackingPermanent, defendingPermanent, defendingCard)) { return true; } } } } return false; } public bool PermanentCondition(Permanent permanent) { if (_permanentCondition != null) { if (CardEffectCommons.IsPermanentExistsOnBattleArea(permanent)) { if (_permanentCondition(permanent)) { return true; } } } return false; } }