示例#1
0
 public virtual void AddCondition(string name, IParaCondition condition)
 {
     if (!conditionMap.ContainsKey(name))
     {
         conditionMap[name] = new Stack <IParaCondition>();
     }
     this.conditionMap[name].Push(condition);
 }
            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);
                    }
                }
            }
示例#3
0
 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);
 }
示例#4
0
 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 bool Meet(IEventArgs args)
        {
            if (code < conditions.Length)
            {
                IParaCondition con = conditions[code];
                if (con != null)
                {
                    return(con.Meet(args));
                }
            }

            return(false);
        }
示例#6
0
        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);
        }
示例#7
0
        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)
        {
            IParaCondition con = args.ComponentMap.GetCondition(name);

            if (con != null)
            {
                return(con.Meet(args));
            }
            else
            {
                if (defaultCondition != null)
                {
                    return(defaultCondition.Meet(args));
                }
            }
            return(false);
        }
示例#9
0
        public virtual void OnCreate(IEventArgs skill)
        {
            startTime      = skill.Rule.ServerTime;
            this.ins       = new HashSet <long>();
            this.showedIds = new HashSet <long>();
            this.realKey   = FreeUtil.ReplaceVar(key, skill);
            this.realTime  = FreeUtil.ReplaceInt(time, skill);
            this.paras     = new SimpleParaList();

            skill.TempUse("buf", this);
            bool hasCreator = false;

            if (creator != null && creator.hasFreeData)
            {
                skill.TempUse("creator", (FreeData)this.creator.freeData.FreeData);
                hasCreator = true;
            }
            AddParas(skill);
            if (createAction != null)
            {
                createAction.Act(skill);
            }
            if (effectAction != null)
            {
                effectAction.SetSelector(GetPos(region.GetCenter(skill)));
                effectAction.SetKey("bufeffect_" + realKey);
            }
            else
            {
                if (show == null)
                {
                    show = new FreeEffectShowAction();
                    show.SetKey(effect);
                    show.SetPos(GetPos(region.GetCenter(skill)));
                }
            }
            skill.Resume("buf");
            if (creator != null && hasCreator)
            {
                skill.Resume("creator");
            }
            if (!StringUtil.IsNullOrEmpty(condition))
            {
                bufCondition = new ExpParaCondition(FreeUtil.ReplaceVar(condition, skill));
            }
        }
示例#10
0
 public virtual void SetCondition(IParaCondition condition)
 {
     this.condition = condition;
 }
示例#11
0
 public ConAction(IParaCondition condition, IGameAction action)
     : base()
 {
     this.condition = condition;
     this.action    = action;
 }
示例#12
0
 public virtual void TempUseCondition(string name, IParaCondition condition)
 {
     AddCondition(name, condition);
 }
示例#13
0
        public virtual bool OnCreate(IEventArgs skill)
        {
            startTime = skill.Rule.ServerTime;

            this.ins       = new HashSet <long>();
            this.showedIds = new HashSet <long>();
            this.realKey   = FreeUtil.ReplaceVar(key, skill);
            this.realTime  = FreeUtil.ReplaceInt(time, skill);
            this.paras     = new SimpleParaList();

            this.posindex = -1;
            ParaList list = skill.GetDefault().GetParameters();

            if (list.HasPara("posindex"))
            {
                posindex = (int)list.Get("posindex").GetValue();
            }
            skill.TempUse("buf", this);

            IPosSelector pos = GetPos(region.GetCenter(skill));

            if (pos.Select(skill).GetInvalid())
            {
                return(false);
            }

            bool hasCreator = false;

            if (creator != null && creator.hasFreeData)
            {
                skill.TempUse("creator", (FreeData)this.creator.freeData.FreeData);
                hasCreator = true;
            }
            AddParas(skill);
            if (createAction != null)
            {
                createAction.Act(skill);
            }
            if (effectAction != null)
            {
                effectAction.SetSelector(pos);
                effectAction.SetKey("bufeffect_" + realKey);
            }
            else
            {
                if (show == null)
                {
                    show = new FreeEffectShowAction();
                    show.SetKey(effect);
                    show.SetPos(pos);
                }
            }
            skill.Resume("buf");
            if (creator != null && hasCreator)
            {
                skill.Resume("creator");
            }
            if (!StringUtil.IsNullOrEmpty(condition))
            {
                bufCondition = new ExpParaCondition(FreeUtil.ReplaceVar(condition, skill));
            }
            return(true);
        }