示例#1
0
 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");
     }
 }
示例#2
0
        public override ISkillTrigger.TriggerStatus Triggered(ISkillArgs args)
        {
            ISkillTrigger trigger = args.ComponentMap.GetSkillTrigger(name);

            if (trigger != null)
            {
                return(trigger.Triggered(args));
            }
            else
            {
                if (defaultTrigger != null)
                {
                    return(defaultTrigger.Triggered(args));
                }
            }
            return(ISkillTrigger.TriggerStatus.Failed);
        }
示例#3
0
        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");
            }
        }