public (bool remove, string mess) Perform(ActionEvent evt, Player player, [CanBeNull] MapElementInfo info, NVector pos) { bool remove = false; FDataAction action = DataAction(); Assert.IsNotNull(action, $"Action {id} is missing."); Assert.IsNotNull(info, $"MapElementInfo is missing."); //has ap? if (cost > info.data.ap) { return(false, $"Action {action.Name()} need {cost - info.data.ap} AP more. Please wait a round to refill your AP."); } //check pref if (evt != ActionEvent.NextRound) { Debug.Log($"call {evt} {action.id} with {req.reqs.Count} reqs"); } //can use? if (!req.Check(player, info, pos)) { return(false, req.Desc(player, info, pos)); } //has a counter? if (triggerCount > 0) { triggerCount--; //wait? if (triggerCount > 0 && triggerWait) { return(false, null); } //finish && remove? if (triggerCount <= 0) { remove = true; } } //todo play sound and animation? if (!String.IsNullOrEmpty(action.animation)) { L.b.animations.Create(action.animation, pos); } info.data.ap -= cost; PerformAction().PerformCheck(evt, player, info, pos, this); return(remove, null); }
public (bool remove, string mess) Perform(ActionEvent evt, Player player) { bool remove = false; FDataAction action = DataAction(); Assert.IsNotNull(action, $"Action {id} is missing."); //check pref Debug.Log($"call {action.id}"); //can use? if (!req.Check(player)) { return(false, req.Desc(player)); } //has a counter? if (triggerCount > 0) { triggerCount--; //wait? if (triggerCount > 0 && triggerWait) { return(false, null); } //finish && remove? if (triggerCount <= 0) { remove = true; } } PerformAction().PerformCheck(evt, player, this); return(remove, null); }