/// <summary> /// 处理成对的(技能+Buffer)对倍率的影响 /// a的感染+b的流血 /// a的蔓延+b的中毒 /// a的趁热+b的灼烧 /// a的劈石(碎石击/断岩击)+b的石化 /// a的崩裂(石锥/钟乳)+b的冰冻 /// a的淡定(冰刃箭/玄冰箭)+b的混乱 /// </summary> /// <param name="target">接受攻击者</param> /// <returns></returns> protected virtual double BufferAddAttack(FightObject target) { if (m_a.FixBuffer == null || m_a.FixBuffer.Count == 0) { return 0; } double p = 0; foreach (var buffer in m_a.FixBuffer) { GameConfig gc = buffer.Value.Item2; if (gc.SubType != SkillSub.AddAttack) continue; int level = buffer.Value.Item1; //受影响的BufferID(灼烧/石化/中毒/混乱/流血/冰冻) string id = gc.Value.GetStringOrDefault("BufferID"); if (target.ExistsBuffer(id)) { var d = gc.Value.GetVariantOrDefault(level.ToString()); if (d != null) { object bei; //AllAttack:double.所有攻击都可提升的伤害倍数 if (d.TryGetValue("AllAttack", out bei)) { p += Convert.ToDouble(bei); } else if ((m_a.Action.Parameter != null) && d.TryGetValue(m_a.Action.Parameter, out bei)) { p += Convert.ToDouble(bei); } } } } return p; }
/// <summary> /// 攻击 /// </summary> /// <param name="target">接受攻击者</param> /// <returns></returns> public override ActionResult Attack(FightObject target) { ActionResult result = new ActionResult(target.ID); bool meingZhong = CheckMingZhong(target); if (meingZhong) { if (m_Par != null) { if (m_Par.Config.SubType == SkillSub.Attack) { m_Par.UseC = target.ExistsBuffer(m_Par.BufferID); } else { m_Par.UseC = false; } } //计算倍率.. double beiShu = CalculatedRate(target, result); // int gongJi = GetGongJi(target); double xiShou = GetXiShou(target); // 战斗公式 int w = (int)(gongJi * (1 - xiShou) * beiShu); w -= target.Life.KangShangHai; // B是否进行了防御 bool fangyu = CheckFangYu(target); if (fangyu) { result.ActionFlag |= ActionFlag.FangYu; //w = w * 6 / 10; w = w >> 1; //50% } WriteShangHai(result, target, w); bool fanji = CheckFanJi(target); if (fanji) { result.ActionFlag |= ActionFlag.FanJi; result.Value["FanJi"] = FanAttack(target); } ChangeShengMing(result, m_a, target); // 添加附带的Buffer. TryAddBuffer(result, target); return result; } else { //闪避 result.ActionFlag |= ActionFlag.ShanBi; } return result; }
/// <summary> /// 检查反击 /// (合击/保护别人/已死亡时,不能产生反击) /// 混乱/冰冻/石化时不能反击 /// </summary> /// <param name="target">接受攻击者</param> /// <returns></returns> protected virtual bool CheckFanJi(FightObject target) { if (m_heji || target.ProtectOther || target.HP <= 0) { return false; } if (target.ExistsBuffer(BufferType.HunLuan) || target.ExistsBuffer(BufferType.BingDong) || target.ExistsBuffer(BufferType.ShiHua)) { return false; } return RandomHit(target.Life.FanJiLv); }