using System.Collections.Generic; using System; public class ChangeLinkCostClass : ICardEffect, IChangeLinkCostEffect { Func _changeCostFunc { get; set; } Func _cardSourceCondition { get; set; } Func _permanentCondition { get; set; } Func _rootCondition { get; set; } Func _isUpDown { get; set; } public void SetUpChangeLinkCostClass(Func changeCostFunc, Func cardSourceCondition, Func permanentCondition, Func rootCondition, Func isUpDown) { _changeCostFunc = changeCostFunc; _cardSourceCondition = cardSourceCondition; _permanentCondition = permanentCondition; _rootCondition = rootCondition; _isUpDown = isUpDown; } public int GetCost(int cost, CardSource cardSource, Permanent permanent, SelectCardEffect.Root root) { if (cardSource != null && CardCondition(cardSource) && PermanentCondition(permanent) && _changeCostFunc != null && _rootCondition != null && _rootCondition(root)) { int newCost = _changeCostFunc(cardSource, permanent, cost, root); cost = newCost; } return cost; } public bool CardCondition(CardSource cardSource) { return _cardSourceCondition != null && _cardSourceCondition(cardSource); } public bool PermanentCondition(Permanent permanent) { return _permanentCondition != null && _permanentCondition(permanent); } public bool IsUpDown() { return _isUpDown != null && _isUpDown(); } }