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); }
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); }
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)); }
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); }
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); }
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); }
/// <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; }
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); }
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); }
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)); }
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); }
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); }
public bool TryGetAntiRate(ref IBoostBuff buff, params int[] buffIds) { return(TryGetBuffCore(ref buff, EnumBoostType.AntiRate, buffIds)); }
public bool TryGetEaseValue(ref IBoostBuff buff, params int[] buffIds) { return(TryGetBuffCore(ref buff, EnumBoostType.EaseValue, buffIds)); }
public bool TryGetAmpLast(ref IBoostBuff buff, params int[] buffIds) { return(TryGetBuffCore(ref buff, EnumBoostType.AmpLast, buffIds)); }
public bool TryGetAntiDebuff(ref IBoostBuff buff) { return(TryGetBuffCore(ref buff, EnumBoostType.AntiDebuff)); }
public bool TryGetPureBuff(ref IBoostBuff buff) { return(TryGetBuffCore(ref buff, EnumBoostType.PureBuff)); }
public bool TryGetSkillRate(ref IBoostBuff buff) { return(TryGetBuffCore(ref buff, EnumBoostType.SkillRate)); }
public bool TryGetEaseValue(ref IBoostBuff buff, params int[] buffIds) { this._owner.TryGetEaseValue(ref buff, buffIds); return(this.boostCore.TryGetEaseValue(ref buff, buffIds)); }
public bool TryGetAntiDebuff(ref IBoostBuff buff) { this.SkillManager.TryGetAntiDebuff(ref buff); return(this.boostCore.TryGetAntiDebuff(ref buff)); }
public bool TryGetSkillRate(ref IBoostBuff buff) { return(this.boostCore.TryGetSkillRate(ref buff)); }
public bool TryGetEaseLast(ref IBoostBuff buff, params int[] buffIds) { return(this.boostCore.TryGetEaseLast(ref buff, buffIds)); }
public bool TryGetAntiRate(ref IBoostBuff buff, params int[] buffIds) { this.SkillManager.TryGetAntiRate(ref buff, buffIds); return(this.boostCore.TryGetAntiRate(ref buff, buffIds)); }
public bool PlusBuff(IBoostBuff srcBuff) { this.Point += srcBuff.Point; this.Percent += srcBuff.Percent; return(true); }
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); }
public bool TryGetSkillCD(ref IBoostBuff buff) { this._owner.TryGetSkillCD(ref buff); return(this.boostCore.TryGetSkillCD(ref buff)); }
public bool TryGetAntiRate(ref IBoostBuff buff, params int[] buffIds) { return(this.boostCore.TryGetAntiRate(ref buff, buffIds)); }
public bool TryGetAntiDebuff(ref IBoostBuff buff) { this._owner.TryGetAntiDebuff(ref buff); return(this.boostCore.TryGetAntiDebuff(ref buff)); }
public bool TryGetPureBuff(ref IBoostBuff buff) { return(this.boostCore.TryGetPureBuff(ref buff)); }
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); }