public void AddSkill(SkillInfo info) { m_SkillList.Add(info); }
private bool m_IsInCombat; // 表示当前是否在战斗中 public SkillStateInfo() { m_SkillList = new List <SkillInfo>(); m_CurSkillInfo = null; m_ImpactList = new List <ImpactInfo>(); }
public void RefreshItemSkills(SendImpactToSelfDelegation sendImpactToSelf, StopMyImpactDelegation stopImpact) { //标记所有物品带的技能与buff foreach (SkillInfo info in GetSkillStateInfo().GetAllSkill()) { if (info.IsItemSkill) { info.IsMarkToRemove = true; } } foreach (ImpactInfo info in GetSkillStateInfo().GetAllImpact()) { if (info.m_IsItemImpact) { info.m_IsMarkToRemove = true; } } //刷新物品带的技能与buff EquipmentStateInfo equipInfo = GetEquipmentStateInfo(); for (int ix = 0; ix < EquipmentStateInfo.c_PackageCapacity; ++ix) { ItemDataInfo itemInfo = equipInfo.GetItemData(ix); if (null != itemInfo && itemInfo.ItemNum == 1 && null != itemInfo.ItemConfig) { ItemConfig cfg = itemInfo.ItemConfig; if (null != cfg.m_AddSkillOnEquiping) { foreach (int id in cfg.m_AddSkillOnEquiping) { SkillInfo skillInfo = GetSkillStateInfo().GetSkillInfoById(id); if (null == skillInfo) { skillInfo = new SkillInfo(id); skillInfo.IsItemSkill = true; skillInfo.IsMarkToRemove = false; GetSkillStateInfo().AddSkill(skillInfo); } else { skillInfo.IsMarkToRemove = false; } } } if (null != cfg.m_AddBuffOnEquiping && null != sendImpactToSelf) { //此分支为服务器端处理,参数为加impact的回调,这个回调里包括加impact并发消息给客户端(现在ImpactSystem是这样实现的) foreach (int id in cfg.m_AddBuffOnEquiping) { ImpactInfo impactInfo = GetSkillStateInfo().GetImpactInfoById(id); if (null == impactInfo) { impactInfo = sendImpactToSelf(id); if (null != impactInfo) { impactInfo.m_IsItemImpact = true; impactInfo.m_IsMarkToRemove = false; } } else { impactInfo.m_IsMarkToRemove = false; } } } } } //移除不再有效的技能与buff List <int> removeSkills = new List <int>(); foreach (SkillInfo info in GetSkillStateInfo().GetAllSkill()) { if (info.IsItemSkill && info.IsMarkToRemove) { removeSkills.Add(info.SkillId); } } foreach (int id in removeSkills) { GetSkillStateInfo().RemoveSkill(id); } removeSkills.Clear(); List <int> removeImpacts = new List <int>(); foreach (ImpactInfo info in GetSkillStateInfo().GetAllImpact()) { if (info.m_IsItemImpact && info.m_IsMarkToRemove) { removeImpacts.Add(info.m_ImpactId); } } foreach (int id in removeImpacts) { if (null != stopImpact) { stopImpact(id); } } removeImpacts.Clear(); }
internal bool AddNewUser(User newUser) { foreach (User us in room_users_) { if (us != null && us.Guid == newUser.Guid) { //当前玩家已在游戏房间内 LogSys.Log(LOG_TYPE.DEBUG, "Add user success: User already in the room! RoomID:{0}, Guid:{1}, OldUser[{2}]({3}) NewUser[{4}]({5}) ", cur_room_id_, us.Guid, us.LocalID, us.GetKey(), newUser.LocalID, newUser.GetKey()); LogSys.Log(LOG_TYPE.INFO, "FreeUser {0} for {1} {2}, [Room.AddNewUser]", newUser.LocalID, newUser.Guid, newUser.GetKey()); user_pool_.FreeUser(newUser.LocalID); return(true); } } can_close_time_ = 0; newUser.EnterRoomTime = TimeUtility.GetServerMilliseconds(); newUser.OwnRoom = this; newUser.RegisterObservers(room_observers_); newUser.Info = m_UserMgr.AddUser(newUser.HeroId); newUser.Info.SetUnitId(GlobalVariables.GetUnitIdByCampId(newUser.CampId)); newUser.Info.SetCampId(newUser.CampId); newUser.Info.SetLevel(newUser.Level); if ((int)UserControlState.Ai == newUser.UserControlState) { newUser.Info.GetAiStateInfo().AiLogic = (int)AiStateLogicId.PvpUser_General; newUser.IsEntered = true; } if (m_ActiveScene >= 0 && m_Scenes.Count > m_ActiveScene) { Scene scene = m_Scenes[m_ActiveScene]; scene.EnterScene(newUser.Info); if ((int)UserControlState.Ai == newUser.UserControlState) { Data_Unit unit = scene.MapData.ExtractData(DataMap_Type.DT_Unit, newUser.Info.GetUnitId()) as Data_Unit; if (null != unit) { newUser.Info.GetMovementStateInfo().SetPosition(unit.m_Pos); newUser.Info.GetMovementStateInfo().SetFaceDir(unit.m_RotAngle); } } } foreach (User otheruser in room_users_) { if (otheruser != null) { otheruser.AddSameRoomUser(newUser); newUser.AddSameRoomUser(otheruser); } } room_users_.Add(newUser); LogSys.Log(LOG_TYPE.DEBUG, "Add user success ! RoomID:{0} , UserGuid:{1}({2})", cur_room_id_, newUser.Guid, newUser.GetKey()); if (null != newUser.Skill && 4 == newUser.Skill.Count) { newUser.Info.GetSkillStateInfo().RemoveAllSkill(); newUser.Info.ResetSkill(); for (int index = 0; index < newUser.Skill.Count; index++) { if (newUser.Skill[index].SkillId > 0) { SkillInfo info = new SkillInfo(newUser.Skill[index].SkillId); info.SkillLevel = newUser.Skill[index].SkillLevel; info.Postions.SetCurSkillSlotPos(newUser.PresetIndex, (SlotPosition)(index + 1)); SkillCategory cur_skill_pos = SkillCategory.kNone; if ((index + 1) == (int)SlotPosition.SP_A) { cur_skill_pos = SkillCategory.kSkillA; } else if ((index + 1) == (int)SlotPosition.SP_B) { cur_skill_pos = SkillCategory.kSkillB; } else if ((index + 1) == (int)SlotPosition.SP_C) { cur_skill_pos = SkillCategory.kSkillC; } else if ((index + 1) == (int)SlotPosition.SP_D) { cur_skill_pos = SkillCategory.kSkillD; } info.ConfigData.Category = cur_skill_pos; newUser.Info.GetSkillStateInfo().AddSkill(info); newUser.Info.ResetSkill(); /// AddSubSkill(newUser, info.SkillId, cur_skill_pos, info.SkillLevel); } } Data_PlayerConfig playerData = PlayerConfigProvider.Instance.GetPlayerConfigById(newUser.HeroId); if (null != playerData && null != playerData.m_FixedSkillList && playerData.m_FixedSkillList.Count > 0) { foreach (int skill_id in playerData.m_FixedSkillList) { if (null == newUser.Info.GetSkillStateInfo().GetSkillInfoById(skill_id)) { SkillInfo info = new SkillInfo(skill_id, 1); newUser.Info.GetSkillStateInfo().AddSkill(info); newUser.Info.ResetSkill(); } } } } if (null != newUser.Equip && newUser.Equip.Count > 0) { newUser.Info.GetEquipmentStateInfo().Reset(); for (int index = 0; index < newUser.Equip.Count; index++) { if (newUser.Equip[index].ItemId > 0) { ItemDataInfo info = new ItemDataInfo(newUser.Equip[index].ItemRandomProperty); info.ItemId = newUser.Equip[index].ItemId; info.Level = newUser.Equip[index].ItemLevel; info.RandomProperty = newUser.Equip[index].ItemRandomProperty; info.ItemConfig = ItemConfigProvider.Instance.GetDataById(info.ItemId); newUser.Info.GetEquipmentStateInfo().SetEquipmentData(index, info); } } } if (null != newUser.Legacy && newUser.Legacy.Count > 0) { newUser.Info.GetLegacyStateInfo().Reset(); for (int index = 0; index < newUser.Legacy.Count; index++) { if (null != newUser.Legacy[index] && newUser.Legacy[index].ItemId > 0 && newUser.Legacy[index].IsUnlock) { ItemDataInfo info = new ItemDataInfo(newUser.Legacy[index].ItemRandomProperty); info.ItemId = newUser.Legacy[index].ItemId; info.Level = newUser.Legacy[index].ItemLevel; info.RandomProperty = newUser.Legacy[index].ItemRandomProperty; info.IsUnlock = newUser.Legacy[index].IsUnlock; info.ItemConfig = ItemConfigProvider.Instance.GetDataById(info.ItemId); newUser.Info.GetLegacyStateInfo().SetLegacyData(index, info); } } newUser.Info.GetLegacyStateInfo().UpdateLegacyComplexAttr(); } if (null != newUser.Partner) { newUser.Info.SetPartnerInfo(newUser.Partner); } return(true); }
internal void StartSkill(int objId, int skillId) { CharacterInfo obj = CurScene.SceneContext.GetCharacterInfoById(objId); if (null != obj) { SkillInstanceInfo inst = NewSkillInstance(skillId); if (null != inst) { obj.GetSkillStateInfo().SetCurSkillInfo(skillId); SkillInfo skillInfo = obj.GetSkillStateInfo().GetCurSkillInfo(); if (null != skillInfo) { if (MakeSkillCast(obj, skillInfo)) { ArkCrossEngineMessage.Msg_RC_SyncProperty propBuilder = DataSyncUtility.BuildSyncPropertyMessage(obj); Scene scene = obj.SceneContext.CustomData as Scene; if (null != scene) { scene.NotifyAllUser(propBuilder); } } else { skillInfo.m_EnableImpactsToMyself = null; skillInfo.m_EnableImpactsToOther = null; skillInfo.m_LeftEnableMoveCount = 0; skillInfo.m_LeftEnableImpactsToMyself.Clear(); skillInfo.m_LeftEnableImpactsToOther.Clear(); return; } skillInfo.IsSkillActivated = true; m_SkillLogicInfos.Add(new SkillLogicInfo(objId, inst)); SkillLogicInfo logicInfo = m_SkillLogicInfos.Find(info => info.SenderId == objId && info.SkillId == skillId); if (null != logicInfo) { //目前没有与技能释放者相关的分析属性,对每个技能暂时只需要分析一次 if (null == skillInfo.m_EnableImpactsToMyself || null == skillInfo.m_EnableImpactsToOther) { if (!logicInfo.SkillInst.AlreadyAnalyzed) { logicInfo.SkillInst.Analyze(obj); foreach (int skill in logicInfo.SkillInst.SummonNpcSkills) { List <int> impacts = AnalyzeNpcSkills(skill, logicInfo.SkillInst); logicInfo.SkillInst.EnableImpactsToOther.AddRange(impacts); } } skillInfo.m_EnableMoveCount = logicInfo.SkillInst.EnableMoveCount; skillInfo.m_MaxMoveDistance = logicInfo.SkillInst.MaxMoveDelta; skillInfo.m_EnableImpactsToOther = logicInfo.SkillInst.EnableImpactsToOther; skillInfo.m_EnableImpactsToMyself = logicInfo.SkillInst.EnableImpactsToMyself; skillInfo.m_EnableSummonNpcs = logicInfo.SkillInst.SummonNpcs; /* * LogSys.Log(LOG_TYPE.WARN, "Skill {0} EnableMoveCount {1} MaxMoveDistanceSqr {2}\n\tEnableImpactsToOther {3}\n\tEnableImpactsToMyself {4}\n\tSummonNpcSkills {5}", skillId, skillInfo.m_EnableMoveCount, skillInfo.m_MaxMoveDistanceSqr, * string.Join<int>(",", skillInfo.m_EnableImpactsToOther), * string.Join<int>(",", skillInfo.m_EnableImpactsToMyself), * string.Join<int>(",", logicInfo.SkillInst.SummonNpcSkills)); */ } skillInfo.m_LeftEnableMoveCount = skillInfo.m_EnableMoveCount; skillInfo.m_LeftEnableImpactsToMyself.AddRange(skillInfo.m_EnableImpactsToMyself); skillInfo.m_LeftEnableImpactsToOther.Clear(); if (logicInfo.SkillInst.IsSimulate) { obj.GetSkillStateInfo().SimulateEndTime = TimeUtility.GetServerMilliseconds() + logicInfo.SkillInst.MaxSkillLifeTime; } logicInfo.SkillInst.Start(obj); /* * DashFire.LogSystem.Warn("StartSkill {0} {1} EnableMoveCount {2} MaxMoveDistance {3}\n\tEnableImpactsToOther {4}\n\tEnableImpactsToMyself {5}\n\tSummonNpcSkills {6}", objId, skillId, skillInfo.m_LeftEnableMoveCount, skillInfo.m_MaxMoveDistanceSqr, * string.Join<int>(",", skillInfo.m_EnableImpactsToOther), * string.Join<int>(",", skillInfo.m_EnableImpactsToMyself), * string.Join<int>(",", logicInfo.SkillInst.SummonNpcSkills)); */ } } else { LogSystem.Error("{0} StartSkill can't find skill {1}", objId, skillId); } } } else { LogSystem.Debug("not find game obj by id " + objId); } }