示例#1
0
        static bool GetValueCore(out int point, out int percent, EnumBoostType boostType, ISkillTarget owner, params int[] buffIds)
        {
            point   = 0;
            percent = 0;
            IBoostBuff boost = null;

            switch (boostType)
            {
            case EnumBoostType.AmpValue:
                if (owner.TryGetAmpValue(ref boost, buffIds))
                {
                    point   = boost.Point;
                    percent = boost.Percent;
                }
                break;

            case EnumBoostType.EaseValue:
                if (owner.TryGetEaseValue(ref boost, buffIds))
                {
                    point   = boost.Point;
                    percent = boost.Percent;
                }
                break;
            }
            return(point != 0 || percent != 0);
        }
示例#2
0
        static bool GetRateCore(out int rate, int inRate, EnumBoostType boostType, ISkillTarget owner, params int[] buffIds)
        {
            rate = inRate;
            IBoostBuff boost = null;

            switch (boostType)
            {
            case EnumBoostType.AmpRate:
                if (owner.TryGetAmpRate(ref boost, buffIds))
                {
                    rate = Convert.ToInt32(inRate + boost.Point + inRate * boost.AsPercent);
                }
                break;

            case EnumBoostType.EaseRate:
                if (owner.TryGetEaseRate(ref boost, buffIds))
                {
                    rate = Convert.ToInt32(inRate + boost.Point + inRate * boost.AsPercent);
                }
                break;

            case EnumBoostType.AntiRate:
                if (owner.TryGetAntiRate(ref boost, buffIds))
                {
                    rate = boost.Percent;
                }
                return(rate > 0);
            }
            return(rate != inRate);
        }
示例#3
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));
        }
示例#4
0
        public static bool IfAntiFoul(ISkillPlayer player)
        {
            if (null == player)
            {
                return(false);
            }
            IBoostBuff boost   = null;
            int        maxRate = SkillDefines.MAXStorePercent;

            if (player.TryGetAntiRate(ref boost, (int)EnumBoostRootType.AntiFoul))
            {
                int rate = boost.Percent;
                if (rate >= maxRate)
                {
                    return(true);
                }
                if (rate > 0 && rate < maxRate)
                {
                    if (player.SkillManager.SkillMatch.RandomPercent(maxRate) <= rate)
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
示例#5
0
        static bool GetLastCore(out int last, int inLast, EnumBoostType boostType, ISkillTarget owner, params int[] buffIds)
        {
            last = inLast;
            if (last <= 0)
            {
                return(false);
            }
            IBoostBuff boost = null;

            switch (boostType)
            {
            case EnumBoostType.AmpLast:
                if (owner.TryGetAmpLast(ref boost, buffIds))
                {
                    last = Convert.ToInt16(last + boost.Point + last * boost.AsPercent);
                }
                break;

            case EnumBoostType.EaseLast:
                if (owner.TryGetEaseLast(ref boost, buffIds))
                {
                    last = Convert.ToInt16(last + boost.Point + last * boost.AsPercent);
                }
                break;
            }
            return(last != inLast);
        }
示例#6
0
        public static bool IfPureBuff(IEffect effect, ISkill srcSkill, ISkillPlayer caster)
        {
            if (effect.PureFlag)
            {
                return(true);
            }
            IBoostBuff  boost   = null;
            int         maxRate = SkillDefines.MAXStorePercent;
            ISkillOwner owner   = caster ?? srcSkill.Owner;

            owner.TryGetPureBuff(ref boost);
            if (srcSkill.TryGetPureBuff(ref boost))
            {
                int rate = boost.Percent;
                if (rate >= maxRate)
                {
                    return(true);
                }
                if (rate > 0 && rate < maxRate)
                {
                    if (srcSkill.Context.RandomPercent(maxRate) <= rate)
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
示例#7
0
        /// <summary>
        /// 守门员脱手
        /// </summary>
        /// <param name="shooter">射门的球员</param>
        private void OutOfHand(IPlayer shooter)
        {
            bool   isOutHand = this.SkillLimitState == (int)EnumBlurBuffCode.OutHand;
            double speed     = shooter.Status.ShootStatus.ShootSpeed;

            if (!isOutHand)
            {
                double outhandRate = speed * 2 - _propCore[PlayerProperty.Handling] * 0.25;
                outhandRate = this.PropCore.GetActionRate(EnumBuffCode.OutHandRate, outhandRate);
                isOutHand   = _match.RandomPercent() < outhandRate;
            }
            if (!isOutHand)
            {
                _match.MissGoal(_manager.Opponent, false);
                return;
            }
            //免疫脱手
            IBoostBuff boost   = null;
            int        maxRate = SkillDefines.MAXStorePercent;

            if (this.TryGetAntiRate(ref boost, (int)EnumBlurBuffCode.OutHand))
            {
                double rate = boost.Percent;
                if (rate >= maxRate || rate > 0 && _match.RandomPercent(maxRate) <= rate)
                {
                    _match.MissGoal(_manager.Opponent, false);
                    return;
                }
            }
            //角球
            if (this.Status.DiveStatus.DiveDirection != (byte)Direction.Center &&
                _match.RandomPercent() <= Defines.Player.OUTHAND_CORNER_PERCENTAGE)
            {
                bool       isLeft = this.Status.DiveStatus.DiveDirection == (byte)Direction.Left;
                bool       isHome = this.Side == Base.Enum.Side.Home;
                Coordinate corner = new Coordinate(-1, isLeft ? 50 : Defines.Pitch.MAX_HEIGHT - 50);
                if (!isHome)
                {
                    corner = corner.Mirror();
                }
                Match.Football.Kick(corner, speed, this);
                Match.Status.IsNoBallHandler = true;
                return;
            }

            Double       y1 = Defines.Pitch.MAX_HEIGHT - shooter.Current.Y;
            const Double y2 = Defines.Pitch.MAX_HEIGHT / 2;
            const Double x  = Defines.Pitch.MAX_WIDTH / 2;

            Int32 y = _match.RandomInt32((Int32)y1, (Int32)y2);

            Match.Football.Kick(new Coordinate(x, y), speed * 0.6, this);
            Match.Status.IsNoBallHandler = true;
        }
示例#8
0
        public bool PlusBuff(IBoostBuff srcBuff)
        {
            var antiBuff = srcBuff as BoostAntiBuff;

            if (null == antiBuff)
            {
                return(false);
            }
            this.Point        += antiBuff.Point;
            this.Percent      += antiBuff.Percent;
            this.AntiSkillType = antiBuff.AntiSkillType;
            return(true);
        }
示例#9
0
 bool PlusBoostBuff(IBoostBuff dstBuff, IBoostEffect effect)
 {
     if (null == dstBuff || null == effect)
     {
         return(false);
     }
     if (effect.Times > 0)
     {
         dstBuff.Point   += effect.Point * effect.Times;
         dstBuff.Percent += effect.Percent * effect.Times;
     }
     else
     {
         dstBuff.Point   += effect.Point;
         dstBuff.Percent += effect.Percent;
     }
     return(true);
 }
示例#10
0
        public void AddFallDownBuff(int last)
        {
            IBoostBuff boost   = null;
            int        maxRate = SkillDefines.MAXStorePercent;

            if (this.TryGetAntiRate(ref boost, (int)EnumBlurBuffCode.Falldown))
            {
                double rate = boost.Percent;
                if (rate >= maxRate || rate > 0 && _match.RandomPercent(maxRate) <= rate)
                {
                    //this.AddInertiaBuff(1);
                    return;
                }
            }
            this.AddBuff(_manager.CreateBlurBuff(EnumBlurType.LockMotion, EnumBlurBuffCode.Falldown, last));
            this.SkillCore.AddShowModel(null, (short)EnumSkillModel.Falldown, (short)last);
            this.RaiseBlurEvent(new BlurEventArgs(_manager.RootSkill, this, this, EnumBlurType.LockMotion, EnumBlurBuffCode.Falldown));
        }
示例#11
0
        bool TryGetBuffCore(ref IBoostBuff buff, EnumBoostType boostType, params int[] buffIds)
        {
            SyncBuff(false);
            if (dicBuff.Count == 0)
            {
                return(null != buff && buff.ValuedFlag);
            }
            switch (boostType)
            {
            case EnumBoostType.SkillCD:
            case EnumBoostType.SkillRate:
            case EnumBoostType.PureBuff:
            case EnumBoostType.AntiDebuff:
                buffIds = new int[] { 0 };
                break;

            default:
                if (null == buffIds || buffIds.Length == 0)
                {
                    return(null != buff && buff.ValuedFlag);
                }
                break;
            }
            IBoostBuff inBuff;
            int        key = 0;

            foreach (var buffId in buffIds)
            {
                key = CastKey(boostType, buffId);
                if (dicBuff.TryGetValue(key, out inBuff))
                {
                    if (null == buff)
                    {
                        buff = inBuff.Clone();
                    }
                    else
                    {
                        buff.PlusBuff(inBuff);
                    }
                }
            }
            return(null != buff && buff.ValuedFlag);
        }
示例#12
0
        static bool GetValueCore(out int point, out int percent, int inPoint, int inPercent, EnumBoostType boostType, ISkillTarget owner, params int[] buffIds)
        {
            point   = inPoint;
            percent = inPercent;
            IBoostBuff boost = null;

            switch (boostType)
            {
            case EnumBoostType.AmpValue:
                if (owner.TryGetAmpValue(ref boost, buffIds))
                {
                    if (point != 0)
                    {
                        point = Convert.ToInt32(inPoint + boost.Point + inPoint * boost.AsPercent);
                    }
                    if (percent != 0)
                    {
                        percent = Convert.ToInt32(inPercent + boost.Point + inPercent * boost.AsPercent);
                    }
                }
                break;

            case EnumBoostType.EaseValue:
                if (owner.TryGetEaseValue(ref boost, buffIds))
                {
                    if (point != 0)
                    {
                        point = Convert.ToInt32(inPoint + boost.Point + inPoint * boost.AsPercent);
                    }
                    if (percent != 0)
                    {
                        percent = Convert.ToInt32(inPercent + boost.Point + inPercent * boost.AsPercent);
                    }
                }
                break;
            }
            return(point != inPoint || percent != inPercent);
        }
示例#13
0
 public bool TryGetAntiRate(ref IBoostBuff buff, params int[] buffIds)
 {
     return(TryGetBuffCore(ref buff, EnumBoostType.AntiRate, buffIds));
 }
示例#14
0
 public bool TryGetEaseValue(ref IBoostBuff buff, params int[] buffIds)
 {
     return(TryGetBuffCore(ref buff, EnumBoostType.EaseValue, buffIds));
 }
示例#15
0
 public bool TryGetAmpLast(ref IBoostBuff buff, params int[] buffIds)
 {
     return(TryGetBuffCore(ref buff, EnumBoostType.AmpLast, buffIds));
 }
示例#16
0
 public bool TryGetAntiDebuff(ref IBoostBuff buff)
 {
     return(TryGetBuffCore(ref buff, EnumBoostType.AntiDebuff));
 }
示例#17
0
 public bool TryGetPureBuff(ref IBoostBuff buff)
 {
     return(TryGetBuffCore(ref buff, EnumBoostType.PureBuff));
 }
示例#18
0
 public bool TryGetSkillRate(ref IBoostBuff buff)
 {
     return(TryGetBuffCore(ref buff, EnumBoostType.SkillRate));
 }
示例#19
0
 public bool TryGetEaseValue(ref IBoostBuff buff, params int[] buffIds)
 {
     this._owner.TryGetEaseValue(ref buff, buffIds);
     return(this.boostCore.TryGetEaseValue(ref buff, buffIds));
 }
示例#20
0
 public bool TryGetAntiDebuff(ref IBoostBuff buff)
 {
     this.SkillManager.TryGetAntiDebuff(ref buff);
     return(this.boostCore.TryGetAntiDebuff(ref buff));
 }
示例#21
0
 public bool TryGetSkillRate(ref IBoostBuff buff)
 {
     return(this.boostCore.TryGetSkillRate(ref buff));
 }
示例#22
0
 public bool TryGetEaseLast(ref IBoostBuff buff, params int[] buffIds)
 {
     return(this.boostCore.TryGetEaseLast(ref buff, buffIds));
 }
示例#23
0
 public bool TryGetAntiRate(ref IBoostBuff buff, params int[] buffIds)
 {
     this.SkillManager.TryGetAntiRate(ref buff, buffIds);
     return(this.boostCore.TryGetAntiRate(ref buff, buffIds));
 }
示例#24
0
 public bool PlusBuff(IBoostBuff srcBuff)
 {
     this.Point   += srcBuff.Point;
     this.Percent += srcBuff.Percent;
     return(true);
 }
示例#25
0
        public static bool IfAntiDebuff(IEffect effect, ISkill srcSkill, ISkillOwner target, bool incRoot, params int[] buffIds)
        {
            if (effect.PureFlag || !effect.DebuffFlag)
            {
                return(false);
            }
            IBoostBuff boost   = null;
            int        maxRate = SkillDefines.MAXStorePercent;
            int        rate    = 0;

            if (incRoot)
            {
                if (target.TryGetAntiDebuff(ref boost))
                {
                    rate = boost.Percent;
                    if (rate >= maxRate || rate > 0 && srcSkill.Context.RandomPercent(maxRate) <= rate)
                    {
                        return(true);
                    }
                    boost.Clear();
                }
            }
            if (null == buffIds || buffIds.Length == 0)
            {
                return(false);
            }
            if (target.TryGetAntiRate(ref boost, buffIds))
            {
                do
                {
                    var boostAnti = boost as IBoostAntiBuff;
                    if (null == boostAnti)
                    {
                        break;
                    }
                    var antiSKill = boostAnti.AntiSkillType;
                    if (null == antiSKill || antiSKill.Length == 0)
                    {
                        break;
                    }
                    int skillType = (int)srcSkill.RawSkill.SrcType;
                    for (int i = 0; i < antiSKill.Length; i++)
                    {
                        if (antiSKill[i] == skillType)
                        {
                            break;
                        }
                        else if (i == antiSKill.Length - 1)
                        {
                            return(false);
                        }
                    }
                }while (false);
                rate = boost.Percent;
                if (rate >= maxRate || rate > 0 && srcSkill.Context.RandomPercent(maxRate) <= rate)
                {
                    return(true);
                }
            }
            return(false);
        }
示例#26
0
 public bool TryGetSkillCD(ref IBoostBuff buff)
 {
     this._owner.TryGetSkillCD(ref buff);
     return(this.boostCore.TryGetSkillCD(ref buff));
 }
示例#27
0
 public bool TryGetAntiRate(ref IBoostBuff buff, params int[] buffIds)
 {
     return(this.boostCore.TryGetAntiRate(ref buff, buffIds));
 }
示例#28
0
 public bool TryGetAntiDebuff(ref IBoostBuff buff)
 {
     this._owner.TryGetAntiDebuff(ref buff);
     return(this.boostCore.TryGetAntiDebuff(ref buff));
 }
示例#29
0
 public bool TryGetPureBuff(ref IBoostBuff buff)
 {
     return(this.boostCore.TryGetPureBuff(ref buff));
 }
示例#30
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);
        }