private void UpdateBuff(CCreature rec) { BuffBase buff = rec.GetStateBuff(eBuffState.sleep); if (buff != null) { CBuffMgr.Destroy(buff.m_uid); } }
// 正式的游戏逻辑帧 private void ExecuteFrame(int frameId, FspFrame frameMsg) { if (frameMsg != null && frameMsg.vkeys != null) { for (int i = 0; i < frameMsg.vkeys.Count; i++) { FspVKey cmd = frameMsg.vkeys[i]; // 根据keyid做不同逻辑处理 HandleServerCmd(cmd); } } CFrameTimeMgr.Inst.FixedUpdate(); CCreatureMgr.ExecuteFrame(frameId); CSkillMgr.ExecuteFrame(frameId); CBuffMgr.ExecuteFrame(frameId); CBuffTriggerMgr.ExecuteFrame(frameId); }
public static BuffBase AddBuff(CCreature caster, CCreature receiver, int buffId, Vector2d startPos, Vector2d skillPos, Vector2d dir, int skillIndex = 0, object obj = null) { // 接受者无敌时 if (receiver != null) { if (receiver.IsDie() || receiver.CheckState(eBuffState.WindBlowsUp)) { return(null); } if (caster != receiver && receiver.CheckState(eBuffState.God)) { return(null); } } // 非瞬间伤害的其他所有BUFF,如果是持续的,并且buffid相同时,重置生命时间 SkillBuffCsvData buffData = CsvManager.Inst.GetCsv <SkillBuffCsv>((int)eAllCSV.eAC_SkillBuff).GetData(buffId); if (buffData == null) { Debug.LogError("无buffid,策划检测检查配置表:" + buffId); return(null); } // 状态BUFF的处理 // 接受者霸体时,不再添加其他状态BUFF if (receiver != null && receiver.CheckState(eBuffState.SuperArmor)) { if (buffData.logicId == (int)eBuffType.state || buffData.logicId == (int)eBuffType.repel || buffData.logicId == (int)eBuffType.pullPos ) { return(null); } } // 相同BUFF的叠加处理 if (buffData.IsCont && receiver != null && buffData.logicId != (int)eBuffType.damage) { BuffBase stateBuff = receiver.GetBuffByCsvId(buffId); // 1.相同BUFFID // 2.相同施法者 // 3.相同施法者,相同触发器(暂无) if (stateBuff != null && stateBuff.m_caster == caster) { //Debug.Log("有相同buff。。。" + buffId); // 相同施法者的持续性BUFF,内部可以计算叠加次数和伤害 stateBuff.ResetTime(); return(stateBuff); } } BuffBase buff = CBuffMgr.Create(buffId); //Debug.Log("技能流程:创建BUFF:" + buffId + " " + buff.m_buffData.name + " 类型:" + (eBuffType)buff.m_buffData.logicId); if (buff == null) { Debug.LogError("添加BUFF为空:" + buffId); return(null); } // 最终的接收者,由配表决定 if (buff.m_buffData.targetType == 0) { } else if (buff.m_buffData.targetType == 1) { receiver = caster; } buff.m_caster = caster; buff.m_rec = receiver; buff.m_startPos = startPos; buff.m_skillIndex = skillIndex; buff.m_skillPos = skillPos; buff.m_skillDir = dir; buff.m_extendParam = obj; // 持续性的才加到人物身上,当角色挂掉时,要清除身上的BUFF if (buff.IsCont() && receiver != null) { // 因为BUFF改变的速度,攻击力等都是在初始化时,遍历BUFF增减数值,所以要先add receiver.AddBuff(buff); buff.Init(); } else { buff.Init(); buff.Destroy(); } return(buff); }