//获取当前变身状态下的普攻连续技的首段技能ID private int GetChangeStateNormalSkillID() { int nCurrentChangeState = m_player.GetCurrentChangeState(); for (int ii = 0; ii < m_player.OwnSkillInfo.Length; ++ii) { int nCurrSkillId = m_player.OwnSkillInfo[ii].SkillId; if (IsNormalSkill(nCurrSkillId)) { Tab_SkillEx tabSkillEx = TableManager.GetSkillExByID(nCurrSkillId, 0); if (null != tabSkillEx) { Tab_SkillBase tabSkillBase = TableManager.GetSkillBaseByID(tabSkillEx.BaseId, 0); if (null != tabSkillBase) { if (tabSkillBase.GetChangeModebyIndex(nCurrentChangeState) >= 0) { return(nCurrSkillId); } } } } } return(m_player.OwnSkillInfo[0].SkillId); }
//释放技能 public void UseSkill(int skillId, int senderId, int targetId, string skillname = "") { if (m_bIsUsingSkill) { BreakCurSkill(); } m_fLastUseSkillTime = Time.time; m_SkillSender = Singleton <ObjManager> .GetInstance().FindObjCharacterInScene(senderId); if (m_SkillSender == null) { LogModule.DebugLog("MainPlayer is Null:" + senderId); return; } m_UsingSkillExInfo = TableManager.GetSkillExByID(skillId, 0); if (m_UsingSkillExInfo == null) { LogModule.DebugLog("SkillExinfo is Null: " + skillId); return; } int BaseSkillId = m_UsingSkillExInfo.BaseId; m_UsingSkillBaseInfo = TableManager.GetSkillBaseByID(BaseSkillId, 0); if (m_UsingSkillBaseInfo == null) { LogModule.DebugLog("SkillBaseInfo is Null" + BaseSkillId); return; } if (m_SkillSender.IsMoving)//可以攻击了且在移动 停止移动 { m_SkillSender.StopMove(); } //!!!使用的是旋风则 屏蔽旋转 //if (m_UsingSkillBaseInfo.Id ==(int)SKILLBASEID.XFZBASEID) //{ // m_SkillSender.EnableMovingRotation(false); //} if (m_UsingSkillBaseInfo.Id == (int)SKILLBASEID.RIDE_SKILLID) { GameManager.gameManager.SoundManager.PlaySoundEffect(244); } //如果有目标 朝向目标 Obj_Character _targetObjCharacter = Singleton <ObjManager> .GetInstance().FindObjCharacterInScene(targetId); if (_targetObjCharacter && _targetObjCharacter.ServerID != m_SkillSender.ServerID) { m_SkillSender.FaceTo(_targetObjCharacter.Position); } //如果有目标缓存一下目标位置 TargetData.Clear(); if (_targetObjCharacter != null) { TargetData._targetId = targetId; TargetData._targetPos = _targetObjCharacter.transform.position; TargetData._hasSet = true; } //开始播放动画 PlayAnimation(m_UsingSkillExInfo.SatrtMotionId); m_UsingSkillStartAni = m_UsingSkillExInfo.SatrtMotionId; //子弹播放 int nBulletNum = m_UsingSkillExInfo.getBulletEffectIDCount(); for (int i = 0; i < nBulletNum; i++) { int _nBulletId = m_UsingSkillExInfo.GetBulletEffectIDbyIndex(i); if (_nBulletId != -1) { if (_nBulletId == 93 || _nBulletId == 94 || _nBulletId == 95) //大理子弹 特殊处理下 { m_SkillSender.PlayEffect(_nBulletId); } else { BulletData bulletData = new BulletData(senderId, targetId); m_SkillSender.PlayEffect(_nBulletId, OnLoadBullet, bulletData); } } } //显示技能名字 if (m_UsingSkillBaseInfo.IsShowSkillName == 1 && m_SkillSender.ObjType != Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_OTHER_PLAYER) { if (skillname == "") { if (m_SkillSender.ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_MAIN_PLAYER) { m_SkillSender.ShowDamageBoard_SkillName(Games.GlobeDefine.GameDefine_Globe.DAMAGEBOARD_TYPE.SKILL_NAME, m_UsingSkillBaseInfo.Name); } else if (m_SkillSender.ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_NPC) { m_SkillSender.ShowDamageBoard_SkillName(Games.GlobeDefine.GameDefine_Globe.DAMAGEBOARD_TYPE.SKILL_NAME_NPC, m_UsingSkillBaseInfo.Name, false); } else { m_SkillSender.ShowDamageBoard_SkillName(Games.GlobeDefine.GameDefine_Globe.DAMAGEBOARD_TYPE.SKILL_NAME, m_UsingSkillBaseInfo.Name, false); } } else { m_SkillSender.ShowDamageBoard_SkillName(Games.GlobeDefine.GameDefine_Globe.DAMAGEBOARD_TYPE.SKILL_NAME, skillname, false); } } //主角的一些的 特殊处理 if (m_SkillSender.ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_MAIN_PLAYER) { Obj_MainPlayer _mainPlayer = Singleton <ObjManager> .GetInstance().MainPlayer; if (_mainPlayer) { // 使用XP技能,如果有新手指引就 关掉 if ((m_UsingSkillBaseInfo.SkillClass & (int)SKILLCLASS.XP) != 0 && SkillBarLogic.Instance() && SkillBarLogic.Instance().NewPlayerGuide_Step == 1) { NewPlayerGuidLogic.CloseWindow(); } //当前释放的Xp技能成功了 if ((m_UsingSkillBaseInfo.SkillClass & (int)SKILLCLASS.XP) != 0 && SkillBarLogic.Instance() != null) { SkillBarLogic.Instance().m_isUseSkillClick = true; SkillBarLogic.Instance().OnClickXpShowBtn(); SkillBarLogic.Instance().TransformCon.TakeEffect(); } int nSkillIndx = _mainPlayer.GetSkillIndexById(skillId); int nChangeState = _mainPlayer.GetCurrentChangeState(); if (nSkillIndx >= 0 && nSkillIndx < _mainPlayer.OwnSkillInfo.Length) { //常规技能 if (m_UsingSkillBaseInfo.GetChangeModebyIndex(nChangeState) == 0) { Tab_CoolDownTime _coolDownTime = TableManager.GetCoolDownTimeByID(m_UsingSkillExInfo.CDTimeId, 0); //吟唱技不在这里加CD 吟唱技能生效后才走CD 服务器同步过来 if (_coolDownTime != null && m_UsingSkillBaseInfo.UseType != (int)SKILLUSETYPE.YINCHANG) { _mainPlayer.OwnSkillInfo[nSkillIndx].CDTime = _coolDownTime.CDTime; } //非连续技 增加公共CD int nPublicSkillCDId = (int)SKILLDEFINE.PUBLICCDID; Tab_CoolDownTime _publicCDTime = TableManager.GetCoolDownTimeByID(nPublicSkillCDId, 0); if (_publicCDTime != null && m_UsingSkillBaseInfo.HasPublicCd == 1) { _mainPlayer.SkillPublicTime = _publicCDTime.CDTime; } } } //如果是冲撞技能 if ((m_UsingSkillBaseInfo.SkillClass & (int)SKILLCLASS.CrashMove) != 0) { Tab_CoolDownTime _coolDownTime = TableManager.GetCoolDownTimeByID(m_UsingSkillExInfo.CDTimeId, 0); _mainPlayer.CrashSkillCDTime = _coolDownTime.CDTime; //非连续技 增加公共CD int nPublicSkillCDId = (int)SKILLDEFINE.PUBLICCDID; Tab_CoolDownTime _publicCDTime = TableManager.GetCoolDownTimeByID(nPublicSkillCDId, 0); if (_publicCDTime != null && m_UsingSkillBaseInfo.HasPublicCd == 1) { _mainPlayer.SkillPublicTime = _publicCDTime.CDTime; } } if (CanShowSkillProgress(skillId)) { //如果是吟唱技则 显示引导条 if (m_UsingSkillBaseInfo.UseType == (int)SKILLUSETYPE.YINCHANG) { //吟唱时间为当前动作的长度 float fYinChangTime = m_UsingSkillExInfo.YinChangTime / 1000.0f;//转换成秒 //设置持续时间 if (SkillProgressLogic.Instance() != null) { SkillProgressLogic.Instance().PlaySkillProgress(SkillProgressLogic.ProgressModel.ORDERMODEL, fYinChangTime); } } else if ((m_UsingSkillBaseInfo.SkillClass & (int)SKILLCLASS.DUTIAO) != 0) { //技能长度为当前引导条的长度 float fContiueTime = m_UsingSkillExInfo.SkillContinueTime / 1000.0f;//转换成秒 //设置持续时间 if (SkillProgressLogic.Instance() != null) { SkillProgressLogic.Instance().PlaySkillProgress(SkillProgressLogic.ProgressModel.REVERSEDMODE, fContiueTime); } } } if (m_SkillSender.Controller != null && m_SkillSender.Controller.CombatFlag) { _mainPlayer.AutoComabat = true; } //add by mawenbin //移植天龙3D TT15398 死亡复活*复活点自动寻路过程中释放六脉神剑立马被打断 //清除自动寻路 加个开关限制 if (GameManager.gameManager.PlayerDataPool.IsServerFlagOpen(SERVER_FLAGS_ENUM.FLAG_SKILLBREAKAUTOMOVE)) { if (null != GameManager.gameManager.AutoSearch && GameManager.gameManager.AutoSearch.IsAutoSearching) { GameManager.gameManager.AutoSearch.Stop(); } } } } //npc和主角自身放技能 可以自带震屏效果 if (m_SkillSender.ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_MAIN_PLAYER || m_SkillSender.ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_NPC) { //摄像机的 操作 CameraOpt(); } //测试用代码 if (m_UsingSkillExInfo.HasRangeWarning == 1 && m_SkillSender.ObjEffectController != null) { m_SkillSender.ObjEffectController.PlaySkillWarningEffect(skillId); } m_nLastSkillId = skillId; m_nLastSendId = senderId; m_nLastTargetId = targetId; m_bIsUsingSkill = true; }
public uint Execute(PacketDistributed ipacket) { GC_RET_USE_SKILL packet = (GC_RET_USE_SKILL)ipacket; if (null == packet) { return((uint)PACKET_EXE.PACKET_EXE_ERROR); } //enter your logic int nSkillId = packet.HasFixedSkillId ? packet.FixedSkillId : packet.SkillId; int nSenderId = packet.SenderId; int nTargetID = packet.TargetId; Obj_Character Sender = Singleton <ObjManager> .GetInstance().FindObjCharacterInScene(nSenderId); if (Sender == null) { return((uint)PACKET_EXE.PACKET_EXE_CONTINUE); } if (Sender.SkillCore == null) { return((uint)PACKET_EXE.PACKET_EXE_CONTINUE); } int nFailType = (int)SKILLUSEFAILTYPE.INVALID; if (packet.HasSkillfailType) { nFailType = packet.SkillfailType; } string szSkillName = ""; if (packet.HasSkillname) { szSkillName = packet.Skillname; } if (nFailType == (int)SKILLUSEFAILTYPE.DISTANCE) { if (Sender.ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_MAIN_PLAYER) { //服务器认定 距离不够 再往前走点 Obj_Character targetCharacter = Singleton <ObjManager> .GetInstance().FindObjCharacterInScene(nTargetID); if (targetCharacter) { Tab_SkillEx _skillEx = TableManager.GetSkillExByID(nSkillId, 0); if (_skillEx != null) { if (Sender.SkillCore.IsUsingSkill) { Sender.SkillCore.BreakCurSkill(); } Singleton <ObjManager> .GetInstance().MainPlayer.CurUseSkillId = nSkillId; Singleton <ObjManager> .GetInstance().MainPlayer.MoveTo(targetCharacter.Position, targetCharacter.gameObject, _skillEx.Radius - 2.0f); } } } } else { //结婚相关特殊表现 if (nSkillId == GlobeVar.MARRY_SKILL_2) { Sender.SkillCore.BreakCurSkill(); Sender.FaceTo(new UnityEngine.Vector3(13.79419f, 0.9015087f, 30.36249f)); } //结婚相关特殊表现 if (nSkillId == GlobeVar.MARRY_SKILL_1) { Sender.SkillCore.BreakCurSkill(); Sender.FaceTo(new UnityEngine.Vector3(13.79419f, 0.9015087f, 4.068859f)); } if (szSkillName != "") { Sender.SkillCore.UseSkill(nSkillId, nSenderId, nTargetID, szSkillName); } else { Sender.SkillCore.UseSkill(nSkillId, nSenderId, nTargetID); } Tab_SkillEx _skillEx = TableManager.GetSkillExByID(nSkillId, 0); } if (Sender is Obj_MainPlayer) { //if the main player in the state of changing mode int nImpactCount = GameManager.gameManager.PlayerDataPool.ClientImpactInfo.Count; Obj_MainPlayer _mainPlayer = Singleton <ObjManager> .Instance.MainPlayer; Tab_SkillEx _skillEx = TableManager.GetSkillExByID(nSkillId, 0); Tab_SkillBase _skillBase = null; int nSkillIndex = -1; int nChangeState = -1; if (null != _mainPlayer) { for (int i = 0; i < _mainPlayer.OwnSkillInfo.Length; i++) { if (_mainPlayer.OwnSkillInfo[i].SkillId == nSkillId) { nSkillIndex = i; break; } } nChangeState = _mainPlayer.GetCurrentChangeState(); // added by mawenbin // 缓存玩家使用的技能,用于挂机连续技的判定 AI_PlayerCombat aiPlayerCombat = _mainPlayer.GetComponent <AI_PlayerCombat>(); if (null != aiPlayerCombat && Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_MAIN_PLAYER == Sender.ObjType) { aiPlayerCombat.CurUseSkillId = nSkillId; } } if (null != _skillEx) { _skillBase = TableManager.GetSkillBaseByID(_skillEx.BaseId, 0); } if (null != _skillBase) { if (null != SkillBarLogic.Instance()) { //if the skill is xp skill and can put into skillbar if ((_skillBase.SkillClass & (int)SKILLCLASS.AUTOREPEAT) == 0 && (_skillBase.SkillClass & (int)SKILLCLASS.XP) == 0 && (_skillBase.GetChangeModebyIndex(_mainPlayer.CurChangeState) > 0) && (_skillBase.SkillClass & (int)SKILLCLASS.PASSIVITY) == 0) { for (int i = 0; i < SkillBarLogic.Instance().MySkillBarInfo.Length; i++) { if (nSkillId == SkillBarLogic.Instance().MySkillBarInfo[i].CurSkillId) { SkillBarLogic.Instance().MySkillBarInfo[i].nPreSkillId = nSkillId; SkillBarLogic.Instance().MySkillBarInfo[i].fCurrentStartTime = Time.realtimeSinceStartup; SkillBarLogic.Instance().MySkillBarInfo[i].fCurDisabledStartTime = Time.realtimeSinceStartup; SkillBarLogic.Instance().MySkillBarInfo[i].nCurrentCDTime = _skillEx.NextSkillEffectTime / 1000.0f; SkillBarLogic.Instance().MySkillBarInfo[i].fRemainCDTime = _skillEx.NextSkillEffectTime / 1000.0f; SkillBarLogic.Instance().MySkillBarInfo[i].fDisabledRemTime = _skillEx.NextSkillDisabledTime / 1000.0f; SkillBarLogic.Instance().MySkillBarInfo[i].fCurDisabedTime = _skillEx.NextSkillDisabledTime / 1000.0f; SkillBarLogic.Instance().MySkillBarInfo[i].SkillCount++; if (false == GameManager.gameManager.PlayerDataPool.CommonData.GetCommondFlag((int)USER_COMMONFLAG.CF_COMBO_FIRSTUSED)) { if (nSkillId == GlobeVar.SHUANGJIANSHI_SKILL1_COMBO1 || nSkillId == GlobeVar.SHUANGJIANSHI_SKILL1_COMBO2) { SkillBarLogic.Instance().MySkillBarInfo[i].nCurrentCDTime = 10; SkillBarLogic.Instance().MySkillBarInfo[i].fRemainCDTime = 10; } } SkillBarLogic.Instance().SetSkillBarInfoForNext(i, _skillEx.NextContinueSkillId); //第一个连续技能来了,要有提示 if (nSkillIndex != -1 && nSkillIndex == SkillBarLogic.Instance().MySkillBarInfo[i].SkillIndex) { if (null != ComboSkillTipLogic.Instance()) { System.Collections.Generic.List <string> iconList = SkillBarLogic.Instance().GetContinueSkillIcons(_skillBase); ComboSkillTipLogic.Instance().Show(i, iconList.Count, iconList); } } if (null != ComboSkillTipLogic.Instance()) { ComboSkillTipLogic.Instance().SetStep(i, SkillBarLogic.Instance().MySkillBarInfo[i].SkillCount); } if (_skillBase.NextIndex == _skillBase.FirstIndex) { SkillBarLogic.Instance().MySkillBarInfo[i].isCompleted = true; SkillBarLogic.Instance().MySkillBarInfo[i].SkillCount = 0; } break; } } } } //if it is xpSkill and attackSkill if (((_skillBase.SkillClass & (int)SKILLCLASS.AUTOREPEAT) != 0) && _skillBase.GetChangeModebyIndex(_mainPlayer.CurChangeState) >= 0 && SkillBarLogic.Instance()._AttackBarInfo != null) { SkillBarLogic.Instance()._AttackBarInfo.fCurrentStartTime = Time.realtimeSinceStartup; SkillBarLogic.Instance()._AttackBarInfo.fCurDisabledStartTime = Time.realtimeSinceStartup; SkillBarLogic.Instance()._AttackBarInfo.nCurrentCDTime = _skillEx.NextSkillEffectTime; SkillBarLogic.Instance()._AttackBarInfo.fRemainCDTime = _skillEx.NextSkillEffectTime; SkillBarLogic.Instance()._AttackBarInfo.fDisabledRemTime = _skillEx.NextSkillDisabledTime; SkillBarLogic.Instance()._AttackBarInfo.fCurDisabledTime = _skillEx.NextSkillDisabledTime; SkillBarLogic.Instance()._AttackBarInfo.nCurSkillId = _skillEx.NextContinueSkillId; } } } return((uint)PACKET_EXE.PACKET_EXE_CONTINUE); }