public bool CanUse(ISkillArgs args) { if (condition != null && !condition.Meet(args)) { if (notReadyAction != null) { notReadyAction.Act(args); } return(false); } return(true); }
public override void DoAction(IEventArgs args) { FreeRuleEventArgs fr = (FreeRuleEventArgs)args; if (!StringUtil.IsNullOrEmpty(entity)) { object obj = fr.GetEntity(FreeUtil.ReplaceVar(entity, args)); if (obj is FreeMoveEntity) { fr.TempUse("entity", (FreeEntityData)((FreeMoveEntity)obj).freeData.FreeData); action.Act(args); fr.Resume("entity"); } } else { foreach (FreeMoveEntity free in ((Contexts)(fr.GameContext)).freeMove.GetEntities()) { if (free.hasFreeData && free.freeData.FreeData != null) { fr.TempUse("entity", (FreeEntityData)free.freeData.FreeData); if (condition == null || condition.Meet(args)) { if (action != null) { action.Act(args); } } fr.Resume("entity"); } } } }
public virtual void TimeElapse(IEventArgs args, int time) { IList <long> remove = new List <long>(); int countInt = FreeUtil.ReplaceInt(count, args); int timeInt = FreeUtil.ReplaceInt(this.time, args); List <long> sList = new List <long>(map.Keys); foreach (long s in sList) { if (currentCount[s] < countInt) { currentTime[s] = currentTime[s] - time; if (currentTime[s] <= 0) { SetArg(args, s); if (condition != null && !condition.Meet(args)) { remove.Add(s); ResumeArg(args, s); continue; } if (condition == null || condition.Meet(args)) { action.Act(args); //Debug.LogError("time-game-action " + this.time + " " + this.name); } ResumeArg(args, s); currentCount[s] = currentCount[s] + 1; currentTime[s] = timeInt; } } else { remove.Add(s); } } foreach (long s_1 in remove) { map.Remove(s_1); vMap.Remove(s_1); currentCount.Remove(s_1); currentTime.Remove(s_1); } }
public virtual void SetHonor(IEventArgs args, FreeData[] fds) { if (ids == null) { ids = new HashSet <int>(); } if (con == null || (condition != null && condition.Contains(FreeUtil.VAR_START) && condition.Contains(FreeUtil.VAR_END))) { if (!StringUtil.IsNullOrEmpty(condition)) { con = new ExpParaCondition(condition); } } ids.Clear(); IList <PlayerHonorAction.PlayerValue> pvs = new List <PlayerHonorAction.PlayerValue>(); foreach (FreeData fd in fds) { args.TempUse("player", fd); try { if (con == null || con.Meet(args)) { PlayerHonorAction.PlayerValue pv = new PlayerHonorAction.PlayerValue(fd, FreeUtil.ReplaceDouble(formula, args), desc); pvs.Add(pv); } } catch (Exception e) { throw new GameConfigExpception(e.Message); } finally { args.Resume("player"); } } pvs.Sort(); int order = GetOrder(args); if (order > 0) { if (order <= pvs.Count) { ids.Add((int)pvs[order - 1].data.Player.playerInfo.PlayerId); } } else { foreach (PlayerHonorAction.PlayerValue pv in pvs) { ids.Add((int)pv.data.Player.playerInfo.PlayerId); } } }
public override TriggerStatus Triggered(ISkillArgs args) { if (condition.Meet(args)) { return(IsInter(args)); } else { return(TriggerStatus.Failed); } }
public virtual bool Meet(IEventArgs args) { if (con == null || (condition != null && condition.Contains(FreeUtil.VAR_START) && condition.Contains(FreeUtil.VAR_END))) { con = new ExpParaCondition(condition); } if (con != null) { return(con.Meet(args)); } return(false); }
public virtual bool Meet(IEventArgs args) { if (con == null || (condition != null && (condition.IndexOf(FreeUtil.VAR_START_CHAR) > -1) && (condition.IndexOf(FreeUtil.VAR_END_CHAR) > -1))) { con = new ExpParaCondition(condition); } if (con != null) { return(con.Meet(args)); } return(false); }
private void RealEat(PlayerEntity player, ISkillArgs skill) { if (!this.disable && (bufCondition == null || bufCondition.Meet(skill))) { ShowEffect(skill, player); skill.TempUse("buf", this); if (creator != null) { skill.TempUse("creator", (FreeData)this.creator.freeData.FreeData); } pos.SetX(player.position.Value.x); pos.SetY(player.position.Value.y); pos.SetZ(player.position.Value.z); if (region.In(skill, pos)) { if (!ins.Contains(player.playerInfo.PlayerId)) { if (enterAction != null) { enterAction.Act(skill); } ins.Add(player.playerInfo.PlayerId); } if (trigger == null || trigger.Triggered(skill) == ISkillTrigger.TriggerStatus.Success) { if (eatAction != null) { eatAction.Act(skill); if (consume) { skill.FreeContext.Bufs.RemoveBuf(skill, this.realKey); } } } } else { if (ins.Contains(player.playerInfo.PlayerId)) { if (leaveAction != null) { leaveAction.Act(skill); } ins.Remove(player.playerInfo.PlayerId); } } if (creator != null) { skill.Resume("creator"); } skill.Resume("buf"); } }
public override void DoAction(IEventArgs args) { Initial(); if (index >= 0 && index < actions.Count) { IGameAction action = actions[index]; args.FreeContext.AiSuccess = false; args.FreeContext.OrderComplete = false; action.Act(args); if (frame != null) { frame.Act(args); } if (args.FreeContext.AiSuccess) { index++; } args.FreeContext.AiSuccess = false; if (index == actions.Count) { currentCount++; if (currentCount >= args.GetInt(repeat) && args.GetInt(repeat) > 0) { args.FreeContext.AiSuccess = true; } else { index = 0; } } if (!args.FreeContext.AiSuccess && condition != null && condition.Meet(args)) { index = actions.Count; args.FreeContext.AiSuccess = true; } if (args.FreeContext.OrderComplete) { args.FreeContext.AiSuccess = true; } args.FreeContext.OrderComplete = false; } }
public bool Meet(IEventArgs args) { if (code < conditions.Length) { IParaCondition con = conditions[code]; if (con != null) { return(con.Meet(args)); } } return(false); }
public override void DoAction(IEventArgs args) { if (StringUtil.IsNullOrEmpty(key)) { key = BaseEventArgs.DEFAULT; } IParable unit = args.GetUnit(key); if (unit != null) { IPara sort = unit.GetParameters().Get(sorter); if (sort != null) { ParaListSet pls = (ParaListSet)sort; if (action != null) { Iterator <ParaList> it = pls.Iterator(); int i = 1; while (it.HasNext()) { ParaList pl = it.Next(); args.TempUse("element", new SimpleParable(pl)); args.GetDefault().GetParameters().TempUse(new IntPara("index", i++)); if (condition == null || condition.Meet(args)) { if (action != null) { action.Act(args); } if (FreeUtil.ReplaceBool(remove, args)) { it.Remove(); } } args.GetDefault().GetParameters().Resume("index"); args.Resume("element"); } if (i == 1) { if (noneAction != null) { noneAction.Act(args); } } } } } }
public virtual bool IsCanDrop(ItemPosition ip, IEventArgs args) { if (StringUtil.IsNullOrEmpty(canDrop)) { return(true); } if (canDropCondition == null || ((canDrop.IndexOf(FreeUtil.VAR_START_CHAR) > -1) && (canDrop.IndexOf(FreeUtil.VAR_END_CHAR) > -1))) { canDropCondition = new ExpParaCondition(canDrop); } args.TempUse("item", ip); bool can = canDropCondition.Meet(args); args.Resume("item"); return(can); }
public virtual bool Meet(IEventArgs args) { IParaCondition con = args.ComponentMap.GetCondition(name); if (con != null) { return(con.Meet(args)); } else { if (defaultCondition != null) { return(defaultCondition.Meet(args)); } } return(false); }
public virtual bool In(IEventArgs args, UnitPosition entity) { if (!StringUtil.IsNullOrEmpty(con)) { if (condition == null || (con.Contains(FreeUtil.VAR_START) && con.Contains(FreeUtil.VAR_END))) { condition = new ExpParaCondition(con); } } bool @in = IsIn(args, entity); if (@in) { return(condition == null || condition.Meet(args)); } return(false); }
public virtual bool Meet(IEventArgs args) { bool flag = false; if (condition1 != null) { flag = condition1.Meet(args); } if (flag == false) { return(false); } bool flag2 = false; if (condition2 != null) { flag2 = condition2.Meet(args); } return(flag && flag2); }
public override void DoAction(IEventArgs args) { // if (condition != null) { // System.out.println(condition + " is " + condition.meet(args)); // } if (condition == null || condition.Meet(args)) { if (trueAction != null) { trueAction.Act(args); } } else { if (falseAction != null) { falseAction.Act(args); } } }
public override void DoAction(IEventArgs args) { FreeRuleEventArgs fr = (FreeRuleEventArgs)args; foreach (FreeMoveEntity free in ((Contexts)(fr.GameContext)).freeMove.GetEntities()) { if (free.hasFreeData && free.freeData.FreeData != null) { fr.TempUse("entity", (FreeEntityData)free.freeData.FreeData); if (condition == null || condition.Meet(args)) { if (action != null) { action.Act(args); } } fr.Resume("entity"); } } }
public override void DoAction(IEventArgs args) { Initial(); if (index >= 0 && index < actions.Count) { IGameAction action = actions[index]; args.FreeContext.AiSuccess = false; action.Act(args); if (args.FreeContext.AiSuccess) { index++; } args.FreeContext.AiSuccess = false; if (index == actions.Count) { currentCount++; if (currentCount >= repeat && repeat > 0) { args.FreeContext.AiSuccess = true; } else { index = 0; } } if (!args.FreeContext.AiSuccess && condition != null && condition.Meet(args)) { args.FreeContext.AiSuccess = true; } } }
public override void DoAction(IEventArgs args) { long serverTime = args.Rule.ServerTime; if (!string.IsNullOrEmpty(time) && realTime == 0) { realTime = args.GetInt(time); } if (startTime == 0) { startTime = serverTime; timePara = new IntPara(Time, 0); } timePara.SetValue(serverTime - startTime); args.TempUsePara(timePara); if (action != null) { action.Act(args); } if (realTime > 0 && serverTime - startTime >= realTime) { args.FreeContext.AiSuccess = true; startTime = 0; } if (condition != null && condition.Meet(args)) { args.FreeContext.AiSuccess = true; startTime = 0; } args.ResumePara(Time); }
public bool Meet(IEventArgs args) { return(!condition.Meet(args)); }
public virtual bool IsInterrupted(ISkillArgs args) { return(condition != null && condition.Meet(args)); }
private void RealEat(PlayerEntity player, ISkillArgs skill) { if (!this.disable && (bufCondition == null || bufCondition.Meet(skill))) { ShowEffect(skill, player); skill.TempUse("buf", this); if (creator != null) { skill.TempUse("creator", (FreeData)this.creator.freeData.FreeData); } pos.SetX(player.position.Value.x); pos.SetY(player.position.Value.y); pos.SetZ(player.position.Value.z); if (region.In(skill, pos)) { if (!ins.Contains(player.playerInfo.PlayerId)) { if (enterAction != null) { enterAction.Act(skill); } ins.Add(player.playerInfo.PlayerId); } if (trigger == null || trigger.Triggered(skill) == ISkillTrigger.TriggerStatus.Success) { if (eatAction != null) { // record parentkey IPosSelector posCenter = GetPos(region.GetCenter(skill)); skill.GetDefault().GetParameters().TempUse(new IntPara("posindex", posCenter.Select(skill).GetRandomindex())); eatAction.Act(skill); skill.GetDefault().GetParameters().RemovePara("posindex"); // handle if (posindex >= 0) { skill.GetDefault().GetParameters().TempUse(new IntPara("resetpos", posindex)); skill.Triggers.Trigger(FreeTriggerConstant.PLAYER_EAT_BUF, skill); skill.GetDefault().GetParameters().RemovePara("resetpos"); } if (consume) { skill.FreeContext.Bufs.RemoveBuf(skill, this.realKey); } } } } else { if (ins.Contains(player.playerInfo.PlayerId)) { if (leaveAction != null) { leaveAction.Act(skill); } ins.Remove(player.playerInfo.PlayerId); } } if (creator != null) { skill.Resume("creator"); } skill.Resume("buf"); } }
public override ISkillTrigger.TriggerStatus Triggered(ISkillArgs args) { if (realTime == 0) { realTime = FreeUtil.ReplaceInt(time, args); } if (args.GetInput().IsPressed(key) && startTime == 0 && condition != null && !condition.Meet(args)) { return(ISkillTrigger.TriggerStatus.Failed); } if (interrupter != null && interrupter.IsInterrupted(args)) { if (startTime > 0) { startTime = 0; if (interAction != null) { interAction.Act(args); } return(ISkillTrigger.TriggerStatus.Interrupted); } startTime = 0; } if (args.GetInput().IsPressed(key)) { if (startTime == 0 && release) { startTime = Runtime.CurrentTimeMillis(false); if (castAction != null) { castAction.Act(args); } } release = false; } else { release = true; } if (startTime > 0 && Runtime.CurrentTimeMillis(false) - startTime >= realTime) { startTime = 0; return(ISkillTrigger.TriggerStatus.Success); } return(ISkillTrigger.TriggerStatus.Failed); }