You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1032 lines
46 KiB
1032 lines
46 KiB
//using System;
|
|
//using System.Collections.Generic;
|
|
//using System.Linq;
|
|
//using Sog;
|
|
//using ProtoCSStruct;
|
|
|
|
//namespace Battle
|
|
//{
|
|
// public class BattleParamCfg
|
|
// {
|
|
// public int minDmgRate;
|
|
// public int minR;
|
|
// public int maxR;
|
|
// public int baseCriPower;
|
|
// public int[] comboDecay;
|
|
// }
|
|
|
|
// public static class BattleControl
|
|
// {
|
|
// public static readonly int RandRange = 10000;
|
|
|
|
// // 战斗参数初始化
|
|
// public static bool _isInitCfg = false;
|
|
|
|
// // 战斗参数配置默认值
|
|
// private static BattleParamCfg _battleParamCfg = new BattleParamCfg
|
|
// {
|
|
// minDmgRate = 300,
|
|
// minR = 9000,
|
|
// maxR = 11001,
|
|
// baseCriPower = 20000,
|
|
// comboDecay = new int[] {10000, 6000, 4200, 3780, 3402}
|
|
// };
|
|
|
|
// public static BattleParamCfg GetBattleParamCfg()
|
|
// {
|
|
// return _battleParamCfg;
|
|
// }
|
|
|
|
// //战斗开始
|
|
// public static void BattleBegin(BattleObj battle)
|
|
// {
|
|
// LogBattleStart(battle);
|
|
// // 战斗开始前重算speed
|
|
// RecalcHeroSpeed(battle);
|
|
|
|
// foreach (BattleHero hero in battle.allCreatures)
|
|
// {
|
|
// BattleBuff.BattleBeginAddBuff(EffectEvent.BattleStart, battle, hero);
|
|
// }
|
|
// LogHeroOwnBuff(battle);
|
|
// var genid = battle.GenObjId();
|
|
// while (battle.Result == CSBattleResult.None && battle.round < battle.MaxRound)
|
|
// {
|
|
// if (battle.battleInfo.MainlandType == (int)MainlandType.KNightTrain)
|
|
// {
|
|
// //没有buff加属性 先这样
|
|
// }
|
|
// UpdateRound(battle);
|
|
// }
|
|
|
|
// // 50回合跑不出结果算失败
|
|
// if (battle.Result == CSBattleResult.None)
|
|
// {
|
|
// battle.Result = CSBattleResult.Failed;
|
|
// CreateBattleLog(battle, 0, 0, BattleEventType.BattleEnd, 0, (int)battle.Result, 0);
|
|
// }
|
|
// battle.battleInfo.OverRound = battle.round;
|
|
// BattleBuff.AttackBackBufferClear();
|
|
// }
|
|
|
|
// public static bool IsCriAtk(BattleObj battle, BattleHero caster, BattleHero target)
|
|
// {
|
|
// long cp = caster.prop.GetValueNoCheck(CSPropIDType.CriRate);
|
|
// long tp = target.prop.GetValueNoCheck(CSPropIDType.UnCriRate);
|
|
// long value = cp - tp;
|
|
// TraceLog.BattleTrace(battle.battleInfo.RoleA.RoleBase.Uid, battle.BattleId, 0, "本次暴击率为{0}, 我方暴击率{1}, 敌方忽视暴击{2}", value, cp, tp);
|
|
// return value > 0 && battle.Random.Next(RandRange) < value;
|
|
// }
|
|
|
|
// public static bool IsStunAtk(BattleObj battle, BattleHero caster, BattleHero target)
|
|
// {
|
|
// long cp = caster.prop.GetValueNoCheck(CSPropIDType.Stun);
|
|
// long tp = target.prop.GetValueNoCheck(CSPropIDType.UnStun);
|
|
// long value = cp - tp;
|
|
// int rand = battle.Random.Next(RandRange);
|
|
|
|
// TraceLog.Trace("BattleControl.IsStunAtk tp {0} cp {1} value {2} rand {3}", tp, cp, value, rand);
|
|
// TraceLog.BattleTrace(battle.battleInfo.RoleA.RoleBase.Uid, battle.BattleId, 0, "本次击晕率为{0}, 我方击晕率{1}, 敌方忽视击晕{2}", value, cp, tp);
|
|
// return value > 0 && rand < value;
|
|
// }
|
|
|
|
// public static bool IsComboAtk(BattleObj battle, BattleHero caster, BattleHero target)
|
|
// {
|
|
// long cp = caster.prop.GetValueNoCheck(CSPropIDType.Combo);
|
|
// long tp = target.prop.GetValueNoCheck(CSPropIDType.UnCombo);
|
|
|
|
// // 根据本回合连击次数进行衰减
|
|
// if (0 <= caster.roundComboNum && caster.roundComboNum < _battleParamCfg.comboDecay.Length)
|
|
// {
|
|
// cp = cp * _battleParamCfg.comboDecay[caster.roundComboNum] / 10000;
|
|
// }
|
|
// else
|
|
// {
|
|
// cp = 0;
|
|
// }
|
|
|
|
// long value = cp - tp;
|
|
// TraceLog.BattleTrace(battle.battleInfo.RoleA.RoleBase.Uid, battle.BattleId, 0, "本次连击率为{0}, 我方连击率{1}, 敌方忽视连击{2}",
|
|
// value, cp, tp);
|
|
// return value > 0 && battle.Random.Next(RandRange) < value;
|
|
// }
|
|
|
|
// public static bool IsDodge(BattleObj battle, BattleHero caster, BattleHero target)
|
|
// {
|
|
// if (target.hurt_willDodge)
|
|
// {
|
|
// target.hurt_willDodge = false;
|
|
// TraceLog.BattleTrace(battle.battleInfo.RoleA.RoleBase.Uid, battle.BattleId, 0, "本次必然闪避 caster={0}, target={1}", caster.objId, target.objId);
|
|
// return true;
|
|
// }
|
|
// long tp = target.prop.GetValueNoCheck(CSPropIDType.Dodge);
|
|
// long cp = caster.prop.GetValueNoCheck(CSPropIDType.UnDodge);
|
|
// long value = tp - cp;
|
|
// int rand = battle.Random.Next(RandRange);
|
|
|
|
// TraceLog.Trace("BattleControl.IsDodge tp {0} cp {1} value {2} rand {3}", tp, cp, value, rand);
|
|
// TraceLog.BattleTrace(battle.battleInfo.RoleA.RoleBase.Uid, battle.BattleId, 0, "本次闪避率为{0}, 我方闪避率{1}, 敌方忽视闪避{2}", value, cp, tp);
|
|
// return value > 0 && rand < value;
|
|
// }
|
|
|
|
// public static bool IsAtkBack(BattleObj battle, BattleHero caster, BattleHero target)
|
|
// {
|
|
// if (caster.hurt_willAtkBack)
|
|
// {
|
|
// caster.hurt_willAtkBack = false;
|
|
// TraceLog.BattleTrace(battle.battleInfo.RoleA.RoleBase.Uid, battle.BattleId, 0, "本次必然反击 caster={0}", caster.objId);
|
|
// return true;
|
|
// }
|
|
// long cp = caster.prop.GetValueNoCheck(CSPropIDType.AtkBack);
|
|
// long tp = target.prop.GetValueNoCheck(CSPropIDType.UnAtkBack);
|
|
// long value = cp - tp;
|
|
// TraceLog.BattleTrace(battle.battleInfo.RoleA.RoleBase.Uid, battle.BattleId, 0, "本次反击率为{0}, 反击率{1}, 忽视反击{2}", value, cp, tp);
|
|
// return value > 0 && battle.Random.Next(RandRange) < value;
|
|
// }
|
|
|
|
// // 欺凌, 目标生命值低于50%时, 额外造成伤害
|
|
// public static bool IsBullyAtk(BattleHero target)
|
|
// {
|
|
// long hp = target.prop.GetValueNoCheck(CSPropIDType.Hp);
|
|
// long hpMax = target.prop.GetValueNoCheck(CSPropIDType.HpMax);
|
|
// return hp * 2 < hpMax;
|
|
// }
|
|
|
|
// public static int CreateBattleLog(BattleObj battle, int casterId, int targetId,
|
|
// BattleEventType evtType, uint resultBits, long dmg, long heal, int spellId = 0, int effectIdx = 0)
|
|
// {
|
|
// ref var btlog = ref battle.battleInfo.BattleLog;
|
|
// if (btlog.Logs.Count < btlog.Logs.GetMaxCount())
|
|
// {
|
|
// if (btlog.Logs.Count > 0)
|
|
// {
|
|
// ref var _evtLog = ref GetBattleLog(battle, btlog.Logs.Count - 1);
|
|
// LogBattleAction(battle, ref _evtLog);
|
|
// }
|
|
// var evtLog = new BattleEventLogOne
|
|
// {
|
|
// CasterId = casterId,
|
|
// TargetId = targetId,
|
|
// EventType = evtType,
|
|
// ResultBit = resultBits,
|
|
// Damage = dmg,
|
|
// Heal = heal,
|
|
// SpellId = spellId,
|
|
// EffectIdx = effectIdx
|
|
// };
|
|
// LogBattleAction(battle, ref evtLog);
|
|
// btlog.Logs.Add(ref evtLog);
|
|
// return btlog.Logs.Count - 1;
|
|
// }
|
|
|
|
// TraceLog.Error("BattleControl.CreateBattleLog battle {0} event {1} not enough log space"
|
|
// , battle.BattleId, evtType);
|
|
// return -1;
|
|
// }
|
|
|
|
// public static int CreateBattleLog(BattleObj battle, int casterId, int targetId, BattleEventType evtType)
|
|
// {
|
|
// ref var btlog = ref battle.battleInfo.BattleLog;
|
|
// if (btlog.Logs.Count < btlog.Logs.GetMaxCount())
|
|
// {
|
|
// if(btlog.Logs.Count > 0)
|
|
// {
|
|
// ref var _evtLog = ref GetBattleLog(battle, btlog.Logs.Count - 1);
|
|
// LogBattleAction(battle, ref _evtLog);
|
|
// }
|
|
// var evtLog = new BattleEventLogOne {CasterId = casterId, TargetId = targetId, EventType = evtType};
|
|
// btlog.Logs.Add(ref evtLog);
|
|
|
|
// TraceLog.Trace("BattleControl.CreateBattleLog battle {0} logCount {1} event {2} casterId {3} targetId {4}", battle.BattleId, btlog.Logs.Count, evtType, casterId, targetId);
|
|
|
|
// return btlog.Logs.Count - 1;
|
|
// }
|
|
|
|
// TraceLog.Error("BattleControl.CreateBattleLog battle {0} event {1} not enough log space", battle.BattleId, evtType);
|
|
// return -1;
|
|
// }
|
|
|
|
// public static ref BattleEventLogOne GetBattleLog(BattleObj battle, int index)
|
|
// {
|
|
// return ref battle.battleInfo.BattleLog.Logs[index];
|
|
// }
|
|
|
|
// // reloadconfig时重新读表
|
|
// public static void OnReloadConfig()
|
|
// {
|
|
// _isInitCfg = false;
|
|
// }
|
|
|
|
// public static void InitBattleParamCfg()
|
|
// {
|
|
// if (_isInitCfg)
|
|
// {
|
|
// return;
|
|
// }
|
|
|
|
// _isInitCfg = true;
|
|
|
|
// // 最低伤害比例
|
|
// var desc = CommParamDescMgr.Instance.GetConfig((int)PandoraCommParam.MinDmgRate);
|
|
// if (desc != null)
|
|
// {
|
|
// _battleParamCfg.minDmgRate = desc.int_val;
|
|
// }
|
|
// else
|
|
// {
|
|
// TraceLog.Error("BattleControl.LoadBattleParamCfg MinDmgRate is null");
|
|
// }
|
|
|
|
// // 伤害随机浮动
|
|
// desc = CommParamDescMgr.Instance.GetConfig((int)PandoraCommParam.DmgRandRange);
|
|
// if (desc != null)
|
|
// {
|
|
// _battleParamCfg.minR = desc.int_list[0];
|
|
// _battleParamCfg.maxR = desc.int_list[1];
|
|
// }
|
|
// else
|
|
// {
|
|
// TraceLog.Error("BattleControl.LoadBattleParamCfg DmgRandRange is null");
|
|
// }
|
|
|
|
// // 暴击伤害
|
|
// desc = CommParamDescMgr.Instance.GetConfig((int)PandoraCommParam.BaseCriPower);
|
|
// if (desc != null)
|
|
// {
|
|
// _battleParamCfg.baseCriPower = desc.int_val;
|
|
// }
|
|
// else
|
|
// {
|
|
// TraceLog.Error("BattleControl.LoadBattleParamCfg BaseCriPower is null");
|
|
// }
|
|
|
|
// // 连击衰减
|
|
// desc = CommParamDescMgr.Instance.GetConfig((int)PandoraCommParam.ComboDecay);
|
|
// if (desc != null)
|
|
// {
|
|
// // TakeWhile取连续不为0的数字
|
|
// _battleParamCfg.comboDecay = desc.int_list.TakeWhile(t => t != 0).ToArray();
|
|
// }
|
|
// else
|
|
// {
|
|
// TraceLog.Error("BattleControl.LoadBattleParamCfg ComboDecay is null");
|
|
// }
|
|
// }
|
|
|
|
// public static long CalcDmg(BattleObj battle, BattleHero caster, BattleHero target, out long random)
|
|
// {
|
|
// long c_atk = caster.prop.GetValueNoCheck(CSPropIDType.Atk);
|
|
// long t_def = target.prop.GetValueNoCheck(CSPropIDType.Def);
|
|
|
|
// // 基础伤害
|
|
// long b1 = c_atk * _battleParamCfg.minDmgRate / 10000;
|
|
// long b2 = c_atk - t_def;
|
|
// long dmg = Math.Max(b1, b2);
|
|
// // 浮动系数
|
|
// long r = battle.Random.Next(_battleParamCfg.minR, _battleParamCfg.maxR);
|
|
// // 欺凌系数
|
|
// long bully = 10000;
|
|
// if (IsBullyAtk(target))
|
|
// {
|
|
// bully += caster.prop.GetValueNoCheck(CSPropIDType.Bully);
|
|
// }
|
|
|
|
// dmg = dmg * r / 10000 * bully / 10000;
|
|
|
|
// long dmgUp = caster.prop.GetValueNoCheck(CSPropIDType.DmgUp);
|
|
// long dmgDown = target.prop.GetValueNoCheck(CSPropIDType.DmgDown);
|
|
// dmg = (long)( Math.Max(((dmgUp - dmgDown) / 10_000F + 1), 0.2) * dmg);
|
|
// TraceLog.Trace("BattleControl.Dmg c_atk={0} t_def={1} b1={2} b2={3} r={4} bully={5} dmg {6}, dmgup {7}, dmgdown {8}", c_atk, t_def, b1, b2, r, bully, dmg, dmgUp, dmgDown);
|
|
// random = r;
|
|
// return dmg;
|
|
// }
|
|
|
|
// public static void ReflectDmg(BattleObj battle, BattleHero caster, BattleHero target, long dmg)
|
|
// {
|
|
// long reflectDmgRate = target.prop.GetValue(CSPropIDType.ReflectDamage);
|
|
|
|
// TraceLog.Trace("BattleControl.ReflectDmg into target {0}-{1} caster {2}-{3} dmg {4} reflectDmgRate {5}", target.objId, target.DescId, caster.objId, caster.DescId, dmg, reflectDmgRate);
|
|
|
|
// if (reflectDmgRate > 0)
|
|
// {
|
|
// long reflectDmg = dmg * reflectDmgRate / 10000;
|
|
|
|
// int logIdx = CreateBattleLog(battle, target.objId, caster.objId, BattleEventType.DmgBack); //反弹伤害
|
|
// if (logIdx == -1)
|
|
// {
|
|
// TraceLog.Error("BattleControl.ReflectDmg battle {0} failed, not enough log space", battle.BattleId);
|
|
// battle.battleInfo.BattleResult = CSBattleResult.Failed;
|
|
// return;
|
|
// }
|
|
|
|
// BattleBuffEffect.BuffDmg(battle, target, caster, logIdx, reflectDmg);
|
|
|
|
// TraceLog.Trace("BattleControl.ReflectDmg target {0}-{1} caster {2}-{3} dmg {4} reflectDmgRate {5} reflectDmg {6}", target.objId, target.DescId, caster.objId, caster.DescId, dmg, reflectDmgRate, reflectDmg);
|
|
// }
|
|
|
|
// return;
|
|
// }
|
|
|
|
// public static void Attack(BattleObj battle, BattleHero caster, BattleHero target, bool isAtkBack, out int innerLogIdx)
|
|
// {
|
|
// // 战斗事件日志, 客户端用来播放战斗动画
|
|
// int logIdx = CreateBattleLog(battle, caster.objId, target.objId,
|
|
// isAtkBack ? BattleEventType.AtkBack : BattleEventType.Attack);
|
|
// innerLogIdx = logIdx;
|
|
// if (logIdx == -1)
|
|
// {
|
|
// TraceLog.Error("BattleControl.Attack battle {0} failed, not enough log space", battle.BattleId);
|
|
// battle.battleInfo.BattleResult = CSBattleResult.Failed;
|
|
// return;
|
|
// }
|
|
// battle.curLogIdx = logIdx;
|
|
|
|
// long dmg = CalcDmg(battle, caster, target, out long random);
|
|
// Dictionary<string, long> param = new Dictionary<string, long>();
|
|
// param["dmg"] = dmg;
|
|
// TraceLog.Trace("BattleControl.Attack caster {0}-{1} target {2}-{3} isAtkBack {4} dmg {5}"
|
|
// , caster.objId, caster.DescId, target.objId, target.DescId, isAtkBack, dmg);
|
|
|
|
// ref var evtLog = ref GetBattleLog(battle, logIdx);
|
|
// evtLog.Damage = dmg;
|
|
// evtLog.RandomNum = random;
|
|
|
|
// BattleBuff.BuffEvent(EffectEvent.StartAttack, battle, caster, target, param);
|
|
|
|
// // 暴击不能闪避
|
|
// if (IsCriAtk(battle, caster, target))
|
|
// {
|
|
// long c_cp = caster.prop.GetValueNoCheck(CSPropIDType.CriPower);
|
|
// long t_uncp = target.prop.GetValueNoCheck(CSPropIDType.UnCriPower);
|
|
// // 暴击系数
|
|
// long criPower = Math.Max(10000, _battleParamCfg.baseCriPower + c_cp - t_uncp);
|
|
// dmg = dmg * criPower / 10000;
|
|
// TraceLog.Trace("BattleControl.Attack cri hit, criPower {0} dmg {1}", criPower, dmg);
|
|
|
|
// evtLog.Damage = dmg;
|
|
// evtLog.ResultBit = BitUtils.BitSet(evtLog.ResultBit, (int)BattleEventBit.Crit);
|
|
// param["dmg"] = dmg;
|
|
// BattleBuff.BuffEvent(EffectEvent.Crit, battle, caster, target, param);
|
|
// dmg = param["dmg"];
|
|
// Hit(battle, caster, target, dmg, ref evtLog);
|
|
// }
|
|
// else
|
|
// {
|
|
// BattleBuff.BuffEvent(EffectEvent.UnCrit, battle, caster, target, param);
|
|
// BattleBuff.BuffEvent(EffectEvent.UnCritTarget, battle, target, caster, param);
|
|
|
|
// if (IsDodge(battle, caster, target))
|
|
// {
|
|
// evtLog.Damage = 0;
|
|
// evtLog.ResultBit = BitUtils.BitSet(evtLog.ResultBit, (int) BattleEventBit.Dodge);
|
|
// BattleBuff.BuffEvent(EffectEvent.Dodge, battle, target, caster);
|
|
// }
|
|
// else
|
|
// {
|
|
|
|
// BattleBuff.BuffEvent(EffectEvent.UnDodgeCrit, battle, target, caster, param);
|
|
// dmg = param["dmg"];
|
|
// Hit(battle, caster, target, dmg, ref evtLog);
|
|
// }
|
|
// }
|
|
|
|
// BattleBuff.BuffEvent(EffectEvent.FinishAttack, battle, caster, target);
|
|
|
|
// // 反击不能连击, 也不会触发对方反击
|
|
// if (! isAtkBack)
|
|
// {
|
|
// var beAtkBack = false;
|
|
// if ((target.CanAtkBackAtStun() || target.IsActiveState()) && IsAtkBack(battle, target, caster))
|
|
// {
|
|
// beAtkBack = true;
|
|
// TraceLog.Trace("BattleControl.Attack target {0}-{1} attack back", target.objId, target.DescId);
|
|
// evtLog.ResultBit = BitUtils.BitSet(evtLog.ResultBit, (int)BattleEventBit.BeAtkBack);
|
|
|
|
// BattleBuff.BuffEvent(EffectEvent.AtkBack, battle, target, caster);
|
|
// Attack(battle, target, caster, true, out innerLogIdx);
|
|
// }
|
|
// else
|
|
// {
|
|
// BattleBuff.BuffEvent(EffectEvent.NotAtkBack, battle, caster, target);
|
|
// }
|
|
|
|
// // 连击
|
|
// if (caster.IsActiveState() && IsComboAtk(battle, caster, target) && !target.IsDead())
|
|
// {
|
|
// if (beAtkBack)
|
|
// {
|
|
// ref var log = ref GetBattleLog(battle, innerLogIdx);
|
|
// BitUtils.BitSet(log.ResultBit, (int)BattleEventBit.BeCombo);
|
|
// BattleBuff.BuffEvent(EffectEvent.NotCombo, battle, caster, target);
|
|
// return;
|
|
// }
|
|
// caster.roundComboNum++;
|
|
// TraceLog.Trace("BattleControl.Attack caster {0}-{1} combo attack {2}"
|
|
// , caster.objId, caster.DescId, caster.roundComboNum);
|
|
// evtLog.ResultBit = BitUtils.BitSet(evtLog.ResultBit, (int)BattleEventBit.Combo);
|
|
|
|
// BattleBuff.BuffEvent(EffectEvent.Combo, battle, caster, target);
|
|
|
|
// Attack(battle, caster, target, false, out _);
|
|
// }
|
|
// else
|
|
// {
|
|
// // 处理连击断掉的buff移除
|
|
// if (BattleBuff.BuffEvent(EffectEvent.NotCombo, battle, caster, target) == -1)
|
|
// {
|
|
// TraceLog.Error("BattleControl.Attack battle {0} failed, not enough log space", battle.BattleId);
|
|
// battle.battleInfo.BattleResult = CSBattleResult.Failed;
|
|
// }
|
|
// }
|
|
// }
|
|
|
|
// if (evtLog.Damage < 0) //那就别下发普攻战斗日志了
|
|
// {
|
|
// TraceLog.Trace("BattleControl.Attack remove Log battle {0} eventType {1} caster {2} target {3} ResultBit {4} buffId {5} heal {6} dmg {7}", battle.BattleId, evtLog.EventType,
|
|
// caster.objId, target.objId, evtLog.ResultBit, evtLog.SpellId, evtLog.Heal, evtLog.Damage);
|
|
// battle.battleInfo.BattleLog.Logs.Remove(ref evtLog);
|
|
// }
|
|
// }
|
|
|
|
// public static void DoHit(BattleObj battle, BattleHero caster, BattleHero target,
|
|
// long dmg, ref BattleEventLogOne evtLog)
|
|
// {
|
|
// if(!Hurt(battle, caster, target, dmg, ref evtLog))
|
|
// {
|
|
// return;
|
|
// }
|
|
|
|
// LifeSteal(battle, caster, target, dmg, ref evtLog);
|
|
|
|
// BattleBuff.BuffEvent(EffectEvent.BeHit, battle, target, caster);
|
|
|
|
// ReflectDmg(battle, caster, target, dmg);//反射伤害
|
|
|
|
// Dead(battle, caster, target, ref evtLog);
|
|
// }
|
|
|
|
// public static void HurtAndCheckDead(BattleObj battle, BattleHero caster, BattleHero target,long dmg, ref BattleEventLogOne evtLog)
|
|
// {
|
|
// if (!Hurt(battle, caster, target, dmg, ref evtLog))
|
|
// {
|
|
// return;
|
|
// }
|
|
// Dead(battle, caster, target, ref evtLog);
|
|
// }
|
|
|
|
// public static void Hit(BattleObj battle, BattleHero caster, BattleHero target,
|
|
// long dmg, ref BattleEventLogOne evtLog)
|
|
// {
|
|
// TraceLog.Trace("BattleControl.Hit caster {0} target {1} dmg {2}", caster.objId, target.objId, dmg);
|
|
// Dictionary<string, long> param = new Dictionary<string, long>();
|
|
// param["dmg"] = dmg;
|
|
// // 攻击命中时才会造成眩晕
|
|
// if (IsStunAtk(battle, caster, target))
|
|
// {
|
|
// target.stunRound = target.IsActed() ? battle.round + 1 : battle.round;
|
|
// TraceLog.Trace("BattleControl.Hit target {0} stun round {1}", target.objId, target.stunRound);
|
|
// evtLog.ResultBit = BitUtils.BitSet(evtLog.ResultBit, (int)BattleEventBit.Stun);
|
|
|
|
// BattleBuff.BuffEvent(EffectEvent.Stun, battle, caster, target, param);
|
|
|
|
// }
|
|
// else
|
|
// {
|
|
// BattleBuff.BuffEvent(EffectEvent.NotStun, battle, caster, target, param);
|
|
// }
|
|
// dmg = param["dmg"];
|
|
|
|
// if (dmg <= 0)
|
|
// {
|
|
// return;
|
|
// }
|
|
|
|
// BattleBuff.BuffEvent(EffectEvent.Hit, battle, caster, target, param);
|
|
|
|
// TraceLog.Trace("BattleControl.Hit log battle {0} caster {1} target {2} casterIsDead {3} targetIsDead {4} buffExtraDmgListCount {5} dmg {6}", battle.BattleId,
|
|
// caster.objId, target.objId, caster.isDead, target.isDead, caster.buffExtraDmgList.Count, dmg);
|
|
// dmg = param["dmg"];
|
|
// if (!target.isDead)
|
|
// {
|
|
// if (caster.buffExtraDmgList.Count > 0) //有额外伤害汇总需要
|
|
// {
|
|
// HitExtraDmg(battle, caster, target, dmg, ref evtLog);
|
|
// evtLog.Damage = -1; //别进行普攻了
|
|
// }
|
|
// else
|
|
// {
|
|
// DoHit(battle, caster, target, dmg, ref evtLog);
|
|
// }
|
|
// }
|
|
// }
|
|
|
|
// //额外伤害汇总
|
|
// public static void HitExtraDmg(BattleObj battle, BattleHero caster, BattleHero target, long dmg, ref BattleEventLogOne evtLog)
|
|
// {
|
|
// if (caster.buffExtraDmgList.Count <= 0)
|
|
// return;
|
|
|
|
// for (int i = 0; i < caster.buffExtraDmgList.Count; i++)
|
|
// {
|
|
// var _target = BattleHeroSvc.GetAliveHeroByObjId(battle, caster.buffExtraDmgList[i].targetObjId);
|
|
// if (_target == null || _target.isDead)
|
|
// continue;
|
|
|
|
// long totalDmg = dmg + caster.buffExtraDmgList[i].dmg;//伤害汇总
|
|
|
|
// TraceLog.Trace("BattleControl.HitExtraDmg extra dmg total battle {0} caster {1} target {2} dmg {3} buffId {4} extraDmg {5} totalDmg {6}", battle.BattleId,
|
|
// caster.objId, _target.objId, dmg, caster.buffExtraDmgList[i].buffId, caster.buffExtraDmgList[i].dmg, totalDmg);
|
|
|
|
// int logIdx = CreateBattleLog(battle, caster.objId, _target.objId, BattleEventType.Attack);
|
|
// if (logIdx == -1)
|
|
// {
|
|
// TraceLog.Error("BattleControl.HitExtraDmg battle {0} failed, not enough log space", battle.BattleId);
|
|
// battle.battleInfo.BattleResult = CSBattleResult.Failed;
|
|
// return;
|
|
// }
|
|
|
|
// ref var evtLog2 = ref GetBattleLog(battle, logIdx);
|
|
|
|
// if (i != caster.buffExtraDmgList.Count - 1) //最后的话,标志位resultBit别拷贝了
|
|
// {
|
|
// evtLog2.CopyFrom(ref evtLog);
|
|
// }
|
|
|
|
// evtLog2.CasterId = caster.objId;
|
|
// evtLog2.TargetId = _target.objId;
|
|
// evtLog2.SpellId = caster.buffExtraDmgList[i].buffId;//用该buff进行表现
|
|
// evtLog2.EffectIdx = caster.buffExtraDmgList[i].effectIdx;
|
|
// DoHit(battle, caster, _target, totalDmg, ref evtLog2);
|
|
// }
|
|
|
|
// caster.buffExtraDmgList.Clear();
|
|
// }
|
|
|
|
// public static bool Dead(BattleObj battle, BattleHero caster, BattleHero target, ref BattleEventLogOne evtLog)
|
|
// {
|
|
// long hp = target.prop.GetValueNoCheck(CSPropIDType.Hp);
|
|
// TraceLog.Trace("BattleControl.Dead target {0} new hp {1}", target.objId, hp);
|
|
|
|
// if (hp <= 0 && !target.isDead)
|
|
// {
|
|
// battle.Trace("BattleControl.Dead target {0} dead", target.objId);
|
|
// target.SetDead();
|
|
// evtLog.ResultBit = BitUtils.BitSet(evtLog.ResultBit, (int)BattleEventBit.Dead);
|
|
|
|
// if (BattleBuff.BuffEvent(EffectEvent.Die, battle, target, caster) == -1)
|
|
// {
|
|
// TraceLog.Error("BattleControl.Dead battle {0} failed, not enough log space", battle.BattleId);
|
|
// battle.battleInfo.BattleResult = CSBattleResult.Failed;
|
|
// }
|
|
|
|
// if(target.heroType == HeroType.Pet)
|
|
// {
|
|
// if (BattleBuff.BuffEvent(EffectEvent.EnemyPetDie, battle, target, caster) == -1)
|
|
// {
|
|
// TraceLog.Error("BattleControl.Dead PetDie battle {0} failed, not enough log space", battle.BattleId);
|
|
// battle.battleInfo.BattleResult = CSBattleResult.Failed;
|
|
// }
|
|
// }
|
|
|
|
// BattleBuff.DeadRemoveBuff(battle, target);
|
|
|
|
// if (target.buffExtraDmgList.Count > 0) //有额外伤害汇总需要
|
|
// {
|
|
// if (battle.battleInfo.BattleLog.Logs.Count > 0)
|
|
// {
|
|
// ref var _evtLog = ref GetBattleLog(battle, battle.battleInfo.BattleLog.Logs.Count - 1);
|
|
// HitExtraDmg(battle, target, caster, 0, ref _evtLog);
|
|
// }
|
|
// }
|
|
|
|
// return true;
|
|
// }
|
|
|
|
// return false;
|
|
// }
|
|
|
|
// //进行伤害,返回false表示没有伤害到
|
|
// public static bool Hurt(BattleObj battle, BattleHero caster, BattleHero target, long dmg, ref BattleEventLogOne evtLog)
|
|
// {
|
|
// target.attackedCount++;
|
|
// //伤害加成
|
|
// dmg += dmg * caster.GetProp(CSPropIDType.DamageRate) / 10000;
|
|
// DamageRate(caster, target, ref dmg);
|
|
|
|
// //伤害减免
|
|
// dmg -= dmg * target.GetProp(CSPropIDType.DamageDown) / 10000;
|
|
// DamageDown(caster, target, ref dmg);
|
|
|
|
// Dictionary<string, long> buffParam = new Dictionary<string, long>();
|
|
// buffParam["dmg"] = dmg;
|
|
// // 为了适配圣杯 特殊处理 圣杯需要在伤害计算前加上减伤的属性 但是伤害计算前一直没有一个时机去加目标的buff的时机
|
|
// BattleBuff.BuffEvent(EffectEvent.BeforeHurt, battle, target, null, buffParam);
|
|
|
|
// if (target.IsStun())
|
|
// {
|
|
// BattleBuff.BuffEvent(EffectEvent.TargetStun, battle, caster, target, buffParam);
|
|
// }
|
|
|
|
// dmg = buffParam["dmg"];
|
|
// if (dmg <= 0)
|
|
// {
|
|
// dmg = 1;
|
|
// }
|
|
|
|
// if(dmg >= target.GetHp())
|
|
// {
|
|
|
|
// buffParam["dmg"] = dmg;
|
|
// BattleBuff.BuffEvent(EffectEvent.BeforeDie, battle, target, null, buffParam);
|
|
// dmg = buffParam["dmg"];
|
|
// }
|
|
// if(dmg <= 0)
|
|
// {
|
|
// dmg = 1;
|
|
// }
|
|
|
|
// battle.Trace("BattleControl.Hurt caster {0} hurt target {1} target OriHp {2}, dmg {3} , HurtAfter Hp {4} isDead {5}", caster.objId, target.objId, target.GetHp(), dmg, target.GetHp() - dmg, target.GetHp() - dmg < 0);
|
|
// target.AddHp(-dmg);
|
|
// target.roundHurt += dmg;
|
|
// caster.roundDmg += dmg;
|
|
// evtLog.Damage = dmg;
|
|
|
|
// BattleBuff.BuffEvent(EffectEvent.BeHurt, battle, target, null);
|
|
|
|
// BattleBuff.BuffEvent(EffectEvent.HurtAfter, battle, target, null);
|
|
|
|
// return true;
|
|
// }
|
|
|
|
// //伤害加成
|
|
// private static void DamageRate(BattleHero caster, BattleHero target, ref long dmg)
|
|
// {
|
|
// TraceLog.Trace("BattleControl.DamageRate front hero {0} -> {1} dmg {2}", caster.objId, target.objId, dmg);
|
|
|
|
// if (target.heroType == HeroType.Hero)
|
|
// dmg += dmg * caster.GetProp(CSPropIDType.DamageRatePlayer) / 10000;
|
|
|
|
// TraceLog.Trace("BattleControl.DamageRate bak hero {0} -> {1} dmg {2}", caster.objId, target.objId, dmg);
|
|
// }
|
|
|
|
// //伤害减免
|
|
// private static void DamageDown(BattleHero caster, BattleHero target, ref long dmg)
|
|
// {
|
|
// TraceLog.Trace("BattleControl.DamageDown front hero {0} -> {1} dmg {2}", caster.objId, target.objId, dmg);
|
|
|
|
// if (target.heroType == HeroType.Hero)
|
|
// dmg -= dmg * target.GetProp(CSPropIDType.DamageDownPlayer) / 10000;
|
|
|
|
// TraceLog.Trace("BattleControl.DamageDown bak hero {0} -> {1} dmg {2}", caster.objId, target.objId, dmg);
|
|
// }
|
|
|
|
// public static int LifeSteal(BattleObj battle, BattleHero caster, BattleHero target,
|
|
// long dmg, ref BattleEventLogOne evtLog)
|
|
// {
|
|
// long cp = caster.prop.GetValueNoCheck(CSPropIDType.LifeSteal);
|
|
// long tp = target.prop.GetValueNoCheck(CSPropIDType.UnLifeSteal);
|
|
// long value = cp - tp;
|
|
|
|
// TraceLog.Trace("BattleControl.LifeSteal tp {0} cp {1} value {2}", tp, cp, value);
|
|
// TraceLog.BattleTrace(battle.battleInfo.RoleA.RoleBase.Uid, battle.BattleId, 0, "本次生命偷取率为{0}, 我方生命偷取率{1}, 敌方忽视生命偷取{2}", value, cp, tp);
|
|
// if (value <= 0)
|
|
// {
|
|
// return 0;
|
|
// }
|
|
|
|
// long stealHp = dmg * value / 10000;
|
|
// // 禁疗
|
|
// Heal(battle, caster, caster, ref stealHp, false);
|
|
|
|
// evtLog.ResultBit = BitUtils.BitSet(evtLog.ResultBit, (int) BattleEventBit.Steal);
|
|
// evtLog.Heal = stealHp;
|
|
// return 0;
|
|
// }
|
|
|
|
// private static void RecalcHeroSpeed(BattleHero hero)
|
|
// {
|
|
// int side = (int)BattleHeroSvc.GetEnemySide(hero);
|
|
|
|
// if (hero.Battle.unSpeedProp[side] > 0)
|
|
// {
|
|
// long s1 = hero.prop.GetValueNoCheck(CSPropIDType.Speed);
|
|
// hero.prop.AddValueNoCheck(CSPropIDType.TotalRateSpeed, -hero.Battle.unSpeedProp[side]);
|
|
// long s2 = hero.prop.GetValueNoCheck(CSPropIDType.Speed);
|
|
// hero.Battle.Trace("BattleControl.RecalcHeroSpeed hero {0}-{1} old {2} new {3}", hero.objId, hero.DescId, s1, s2);
|
|
// }
|
|
// }
|
|
|
|
// private static void RecalcHeroSpeed(BattleObj battle)
|
|
// {
|
|
// foreach (BattleHero hero in battle.allCreatures)
|
|
// {
|
|
// RecalcHeroSpeed(hero);
|
|
// }
|
|
// }
|
|
|
|
// private static int RoundBegin(BattleObj battle)
|
|
// {
|
|
// battle.round++;
|
|
|
|
// int idx = CreateBattleLog(battle, 0, 0, BattleEventType.RoundChg, 0, battle.round, 0);
|
|
// if (idx == -1)
|
|
// {
|
|
// battle.Result = CSBattleResult.Failed;
|
|
// return -1;
|
|
// }
|
|
|
|
// // 回合开始时, 移除眩晕状态
|
|
// foreach (BattleHero hero in battle.allCreatures.Where(c => !c.isDead))
|
|
// {
|
|
// hero.roundDmg = hero.roundHurt = 0;
|
|
// // 第5回合回复HP
|
|
// if (battle.round == 5 && Heal5(battle, hero) != 0)
|
|
// {
|
|
// return -1;
|
|
// }
|
|
|
|
// if (hero.stunRound > 0 && hero.stunRound + 1 == battle.round)
|
|
// {
|
|
// battle.Trace("BattleControl.RoundBegin round {0} hero {1}-{2} remove stun"
|
|
// , battle.round, hero.objId, hero.DescId);
|
|
// idx = CreateBattleLog(battle, hero.objId, hero.objId, BattleEventType.RemoveStun, 0, 0, 0);
|
|
// if (idx == -1)
|
|
// {
|
|
// battle.Result = CSBattleResult.Failed;
|
|
// return -1;
|
|
// }
|
|
// }
|
|
|
|
// BattleBuff.BuffEvent(EffectEvent.RoundStart, battle, hero);
|
|
// }
|
|
|
|
// return 0;
|
|
// }
|
|
|
|
// private static int RoundEnd(BattleObj battle)
|
|
// {
|
|
// foreach (BattleHero hero in battle.allCreatures.Where(c => !c.isDead))
|
|
// {
|
|
// BattleBuff.BuffEvent(EffectEvent.RoundEnd, battle, hero);
|
|
// }
|
|
// return 0;
|
|
// }
|
|
|
|
// private static int Heal5(BattleObj battle, BattleHero hero)
|
|
// {
|
|
// long h5 = hero.prop.GetValueNoCheck(CSPropIDType.Heal5);
|
|
// if (h5 <= 0)
|
|
// {
|
|
// return 0;
|
|
// }
|
|
|
|
// long maxHp = hero.prop.GetValueNoCheck(CSPropIDType.HpMax);
|
|
// long healHp = maxHp * h5 / 10000;
|
|
|
|
// return Heal(battle, hero, hero, ref healHp);
|
|
// }
|
|
|
|
// public static int Heal(BattleObj battle, BattleHero caster, BattleHero target, ref long healHp, bool needLog = true, int from = 0)
|
|
// {
|
|
// int side = (int)BattleHeroSvc.GetEnemySide(target);
|
|
// long healRate = target.GetProp(CSPropIDType.HealRate);//负数
|
|
// if (battle.unHealProp[side] > 0)
|
|
// {
|
|
// healRate += (-1*battle.unHealProp[side]);
|
|
// }
|
|
// healHp += healHp * healRate / 10000;
|
|
|
|
// battle.Trace("BattleControl.Heal caster {0}-{1} target {2}-{3} heal {4} from {5}",
|
|
// caster.objId, caster.DescId, target.objId, target.DescId, healHp, from);
|
|
// if(healHp < 0)
|
|
// {
|
|
// return 0;
|
|
// }
|
|
|
|
// target.AddHp(healHp);
|
|
// if(needLog)
|
|
// {
|
|
// int idx = CreateBattleLog(battle, caster.objId, target.objId, BattleEventType.Heal, 0, 0, healHp);
|
|
// if (idx == -1)
|
|
// {
|
|
// battle.Result = CSBattleResult.Failed;
|
|
// return -1;
|
|
// }
|
|
// }
|
|
// Dictionary<string, long> buffParam = new Dictionary<string, long>();
|
|
// buffParam["healHp"] = healHp;
|
|
// buffParam["from"] = from;
|
|
// BattleBuff.BuffEvent(EffectEvent.Heal, battle, target, null, buffParam);
|
|
|
|
// BattleBuff.BuffEvent(EffectEvent.HealAfter, battle, target, null, buffParam);
|
|
|
|
// return 0;
|
|
// }
|
|
|
|
// private static void BattleEnd(BattleObj battle)
|
|
// {
|
|
// int idx = CreateBattleLog(battle, 0, 0, BattleEventType.BattleEnd, 0, (int)battle.Result, 0);
|
|
// if (idx == -1)
|
|
// {
|
|
// battle.Result = CSBattleResult.Failed;
|
|
// }
|
|
// }
|
|
|
|
// public static void UpdateRound(BattleObj battle)
|
|
// {
|
|
// if (RoundBegin(battle) != 0)
|
|
// {
|
|
// return;
|
|
// }
|
|
|
|
// battle.Trace("BattleControl.UpdateRound round {0}", battle.round);
|
|
|
|
// var heroList = BattleHeroSvc.GetActionHero(battle);
|
|
// foreach (BattleHero hero in heroList)
|
|
// {
|
|
// hero.actionRound = battle.round;
|
|
// hero.roundComboNum = 0;
|
|
// if (hero.IsActiveState())
|
|
// {
|
|
// BattleHero target = GetAttackTarget(battle, hero);
|
|
|
|
// if (target != null)
|
|
// {
|
|
// Attack(battle, hero, target, false, out _);
|
|
// }
|
|
// }
|
|
|
|
// battle.Result = GetBattleResult(battle);
|
|
// if (battle.Result != (int)CSBattleResult.None)
|
|
// {
|
|
// battle.Trace("BattleControl.UpdateRound battle {0} finish {1}", battle.BattleId, battle.Result);
|
|
|
|
// BattleEnd(battle);
|
|
// break;
|
|
// }
|
|
// }
|
|
// RoundEnd(battle);
|
|
// }
|
|
|
|
// public static BattleHero GetAttackTarget(BattleObj battle, BattleHero hero)
|
|
// {
|
|
// if (hero.lastAtkTarget > 0)
|
|
// {
|
|
// var tmp = BattleHeroSvc.GetAttackBackTarget(battle, hero, hero.lastAtkTarget); //切换攻击目标
|
|
|
|
// battle.Trace("BattleControl.GetAttackBackTarget battle {0} caster {1} lastAtkTarget {2}", battle.BattleId, hero.objId, hero.lastAtkTarget);
|
|
|
|
// return tmp;
|
|
// }
|
|
// else
|
|
// {
|
|
// return BattleHeroSvc.GetAttackTarget(battle, hero); //获取攻击目标
|
|
// }
|
|
// }
|
|
|
|
// public static CSBattleResult GetBattleResult(BattleObj battle)
|
|
// {
|
|
// if (battle.Result != CSBattleResult.None)
|
|
// {
|
|
// return battle.Result;
|
|
// }
|
|
|
|
// //先判断我方,如果同归于尽,算失败,免得出莫名其妙bug的时候玩家得利
|
|
// if (BattleHeroSvc.IsHeroAllDead(battle, BattleSide.SideA))
|
|
// {
|
|
// battle.Debug("BattleControl.GetBattleResult battle {0} fail", battle.BattleId);
|
|
// return CSBattleResult.Failed;
|
|
// }
|
|
|
|
// if (BattleHeroSvc.IsHeroAllDead(battle, BattleSide.SideB))
|
|
// {
|
|
// battle.Debug("BattleControl.GetBattleResult battle {0} succ", battle.BattleId);
|
|
// return CSBattleResult.Succ;
|
|
// }
|
|
|
|
// return CSBattleResult.None;
|
|
// }
|
|
|
|
// public static void LogBattleStart(BattleObj battle)
|
|
// {
|
|
// TraceLog.BattleTrace(battle.battleInfo.RoleA.RoleBase.Uid, battle.BattleId, 0, "============== 战斗开始 ============");
|
|
// TraceLog.BattleTrace(battle.battleInfo.RoleA.RoleBase.Uid, battle.BattleId, 0, "RoleA uid {0}, RoleB uid {1}", battle.battleInfo.RoleA.RoleBase.Uid, battle.battleInfo.RoleB.RoleBase.Uid);
|
|
// TraceLog.BattleTrace(battle.battleInfo.RoleA.RoleBase.Uid, battle.BattleId, 0, "战斗双方初始信息:");
|
|
// LogHeroProp(battle);
|
|
// }
|
|
|
|
// public static void LogHeroProp(BattleObj battle)
|
|
// {
|
|
// TraceLog.BattleTrace(battle.battleInfo.RoleA.RoleBase.Uid, battle.BattleId, 0, "@@@@@@@@@@@@@@@@@@@@@@@@@ 打印战斗属性信息 @@@@@@@@@@@@@@@@@@");
|
|
// TraceLog.BattleTrace(battle.battleInfo.RoleA.RoleBase.Uid, battle.BattleId, 0, "======== 左边战斗单位信息:");
|
|
// for (int i = 0; i < battle.herosA.Count; i++)
|
|
// {
|
|
// var hero = battle.herosA[i];
|
|
// TraceLog.BattleTrace(battle.battleInfo.RoleA.RoleBase.Uid, battle.BattleId, 0, "左边英雄位置{0}, id: {1} 属性信息:", i, hero.objId);
|
|
// for (int j = 0; j < HeroProp.GetIDListForView().Count; j++)
|
|
// {
|
|
// TraceLog.BattleTrace(battle.battleInfo.RoleA.RoleBase.Uid, battle.BattleId, 0, "属性名: {0}, 值: {1}",
|
|
// HeroProp.GetIDListForView()[j], hero.prop.GetValue(HeroProp.GetIDListForView()[j]));
|
|
// }
|
|
// }
|
|
// TraceLog.BattleTrace(battle.battleInfo.RoleA.RoleBase.Uid, battle.BattleId, 0, "======== 右边战斗单位信息:");
|
|
// for (int i = 0; i < battle.herosB.Count; i++)
|
|
// {
|
|
// var hero = battle.herosB[i];
|
|
// TraceLog.BattleTrace(battle.battleInfo.RoleB.RoleBase.Uid, battle.BattleId, 0, "右边英雄位置{0}, id: {1} 属性信息:", i, hero.objId);
|
|
// for (int j = 0; j < HeroProp.GetIDListForView().Count; j++)
|
|
// {
|
|
// TraceLog.BattleTrace(battle.battleInfo.RoleB.RoleBase.Uid, battle.BattleId, 0, "属性名: {0}, 值: {1}",
|
|
// HeroProp.GetIDListForView()[j], hero.prop.GetValue(HeroProp.GetIDListForView()[j]));
|
|
// }
|
|
// }
|
|
// TraceLog.BattleTrace(battle.battleInfo.RoleA.RoleBase.Uid, battle.BattleId, 0, "@@@@@@@@@@@@@@@@@@@@@@@@@ 打印战斗属性信息结束 @@@@@@@@@@@@@@@@@@");
|
|
// }
|
|
|
|
// public static void LogHeroOwnBuff(BattleObj battle)
|
|
// {
|
|
// TraceLog.BattleTrace(battle.battleInfo.RoleA.RoleBase.Uid, battle.BattleId, 0, "=================== 打印英雄buff持有情况 ==============");
|
|
// for (int i = 0; i < battle.herosA.Count; i++)
|
|
// {
|
|
// var hero = battle.herosA[i];
|
|
// TraceLog.BattleTrace(battle.battleInfo.RoleA.RoleBase.Uid, battle.BattleId, 0, "=================英雄id {0} 持有buff信息: ", hero.objId);
|
|
// for (int j = 0; j < hero.buffs.Count; j++)
|
|
// {
|
|
// TraceLog.BattleTrace(battle.battleInfo.RoleA.RoleBase.Uid, battle.BattleId, 0, "英雄 {0} 持有 buff {1}, 等级 {2}, effectCount {3}, buff施法者 {4}, 当前层数 {5}"
|
|
// , hero.objId, hero.buffs[j].buffid, hero.buffs[j].level, hero.buffs[j].effectCount, hero.buffs[j].casterId, hero.buffs[j].effectCount);
|
|
// }
|
|
// }
|
|
|
|
// for (int i = 0; i < battle.herosB.Count; i++)
|
|
// {
|
|
// var hero = battle.herosB[i];
|
|
// TraceLog.BattleTrace(battle.battleInfo.RoleB.RoleBase.Uid, battle.BattleId, 0, "=================英雄id {0} 持有buff信息: ", hero.objId);
|
|
// for (int j = 0; j < hero.buffs.Count; j++)
|
|
// {
|
|
// TraceLog.BattleTrace(battle.battleInfo.RoleB.RoleBase.Uid, battle.BattleId, 0, "英雄 {0} 持有 buff {1}, 等级 {2}, effectCount {3}, buff施法者 {4}"
|
|
// , hero.objId, hero.buffs[j].buffid, hero.buffs[j].level, hero.buffs[j].effectCount, hero.buffs[j].casterId);
|
|
// }
|
|
// }
|
|
// TraceLog.BattleTrace(battle.battleInfo.RoleA.RoleBase.Uid, battle.BattleId, 0, "=================== 打印英雄buff持有情况结束 ==============");
|
|
// }
|
|
|
|
// public static void LogHeroDead(BattleObj battle, BattleHero hero)
|
|
// {
|
|
// TraceLog.BattleTrace(battle.battleInfo.RoleA.RoleBase.Uid, battle.BattleId, 0,
|
|
// "英雄 {0} 被击杀!!!!", hero.objId);
|
|
// }
|
|
|
|
// public static void LogBattleAction(BattleObj battle, ref BattleEventLogOne log)
|
|
// {
|
|
// switch (log.EventType)
|
|
// {
|
|
// case BattleEventType.Attack:
|
|
// TraceLog.BattleTrace(battle.battleInfo.RoleA.RoleBase.Uid, battle.BattleId, 0,
|
|
// "英雄 {0} 攻击 英雄 {1} 造成伤害 {2} 偷取生命 {3} 本次攻击结果: " +
|
|
// " 眩晕 {4}, 生命偷取 {5}, 被反击 {6}, 连击 {7}, 被闪避 {8}, 暴击 {9} 伤害浮动系数 {10}"
|
|
// , log.CasterId, log.TargetId, log.Damage, log.Heal
|
|
// , BitUtils.IsBitSet(log.ResultBit, (int)BattleEventBit.Stun)
|
|
// , BitUtils.IsBitSet(log.ResultBit, (int)BattleEventBit.Steal)
|
|
// , BitUtils.IsBitSet(log.ResultBit, (int)BattleEventBit.BeAtkBack)
|
|
// , BitUtils.IsBitSet(log.ResultBit, (int)BattleEventBit.Combo)
|
|
// , BitUtils.IsBitSet(log.ResultBit, (int)BattleEventBit.Dodge)
|
|
// , BitUtils.IsBitSet(log.ResultBit, (int)BattleEventBit.Crit)
|
|
// , log.RandomNum);
|
|
// break;
|
|
// case BattleEventType.Buff:
|
|
// TraceLog.BattleTrace(battle.battleInfo.RoleA.RoleBase.Uid, battle.BattleId, 0,
|
|
// "英雄 {0} 给英雄 {1} 添加Buff {2}-{3}, buff造成伤害 {4}, buff造成治疗 {5}"
|
|
// , log.CasterId, log.TargetId, log.SpellId, log.EffectIdx, log.Damage, log.Heal);
|
|
// LogHeroOwnBuff(battle);
|
|
// break;
|
|
// case BattleEventType.RoundChg:
|
|
// TraceLog.BattleTrace(battle.battleInfo.RoleA.RoleBase.Uid, battle.BattleId, 0,
|
|
// "!!!!!!!!!!!! 当前回合 {0} !!!!!!!!!!!!!!", battle.round);
|
|
// break;
|
|
// case BattleEventType.BattleEnd:
|
|
// TraceLog.BattleTrace(battle.battleInfo.RoleA.RoleBase.Uid, battle.BattleId, 0,
|
|
// "!!!!!!!!!!!! 战斗结束 !!!!!!!!!!!!!!");
|
|
// break;
|
|
// case BattleEventType.Heal:
|
|
// TraceLog.BattleTrace(battle.battleInfo.RoleA.RoleBase.Uid, battle.BattleId, 0,
|
|
// "英雄 {0} 回复血量 {1}", log.CasterId, log.Heal);
|
|
// break;
|
|
// case BattleEventType.RemoveBuff:
|
|
// TraceLog.BattleTrace(battle.battleInfo.RoleA.RoleBase.Uid, battle.BattleId, 0,
|
|
// "英雄 {0} 移除Buff {1}"
|
|
// , log.CasterId, log.SpellId);
|
|
// LogHeroOwnBuff(battle);
|
|
// break;
|
|
// case BattleEventType.UpdateBuffOverTime:
|
|
// TraceLog.BattleTrace(battle.battleInfo.RoleA.RoleBase.Uid, battle.BattleId, 0,
|
|
// "英雄 {0} buffId {1} 更新结束时间", log.CasterId, log.SpellId);
|
|
// break;
|
|
// case BattleEventType.Revive:
|
|
// TraceLog.BattleTrace(battle.battleInfo.RoleA.RoleBase.Uid, battle.BattleId, 0,
|
|
// "英雄 {0} 复活!", log.CasterId);
|
|
// LogHeroOwnBuff(battle);
|
|
// break;
|
|
// }
|
|
// }
|
|
// }
|
|
//}
|
|
|