Exemplo n.º 1
0
        public bool Invoke(ISkillPlayer caster)
        {
            EnumSkillState skillState = this.SkillState;

            if (skillState == EnumSkillState.Effecting)
            {
                this.Repeat(caster);
                return(false);
            }
            if (skillState != EnumSkillState.Activate)
            {
                return(false);
            }
            short rate = this.RawSkill.Rate;

            if (rate >= 0 && rate < 100)
            {
                IBoostBuff boost = null;
                if (this.TryGetSkillRate(ref boost))
                {
                    rate = Convert.ToInt16(rate + boost.AsPoint + rate * boost.AsPercent);
                }
                if (rate <= 0)
                {
                    return(false);
                }
                if (rate < 100 && this._context.RandomPercent() > rate)
                {
                    return(false);
                }
            }
            return(InvokeCore(caster, true, true, true));
        }
Exemplo n.º 2
0
        public bool Invoke()
        {
            EnumSkillState skillState = this.SkillState;

            if (skillState == EnumSkillState.Effecting)
            {
                this.Repeat();
                return(false);
            }
            if (skillState != EnumSkillState.Activate)
            {
                return(false);
            }
            ISkillOwner owner = null;

            if (null == this._casters || this._casters.Count == 0)
            {
                owner = this.Owner;
            }
            else if (this._casters.Count == 1)
            {
                owner = this._casters[0];
            }
            byte paralFlag = this.RawSkill.ParalFlag;
            bool checkFlag = null != owner && null != owner.SkillCore;

            if (checkFlag && !owner.SkillCore.GetInvokeFlag(paralFlag))
            {
                return(false);
            }
            short rate = this.RawSkill.Rate;

            if (rate >= 0 && rate < 100)
            {
                IBoostBuff boost = null;
                if (this.TryGetSkillRate(ref boost))
                {
                    rate = Convert.ToInt16(rate + boost.AsPoint + rate * boost.AsPercent);
                }
                if (rate <= 0)
                {
                    return(false);
                }
                if (rate < 100 && this._context.RandomPercent() > rate)
                {
                    return(false);
                }
            }
            if (checkFlag)
            {
                if (null == this._casters || this._casters.Count == 0)
                {
                    return(InvokeCore(null, true, false, true));
                }
                else if (this._casters.Count == 1)
                {
                    return(InvokeCore(_casters[0], true, false, true));
                }
            }
            foreach (var caster in this._casters)
            {
                if (InvokeCore(caster, true, true, true))
                {
                    return(true);
                }
            }
            return(false);
        }