bool IsAvailableCommandSkill( eCLASS _class, eCommand_Type type) { float curMP = UserEntity.GetProperty<float>( eComponentProperty.MP_CUR); // Tbl_Skill_Record skillRecord = AsTableManager.Instance.GetTbl_Skill_Record( _class, eSKILL_TYPE.Command, type); Tbl_Skill_Record skillRecord = SkillBook.Instance.GetLearnedCommandSkill( type); // < ilmeda 20120420 if( null == skillRecord) return false; // ilmeda 20120420 > SkillView view = null; if( SkillBook.Instance.dicCurSkill.ContainsKey( skillRecord.Index) == true) view = SkillBook.Instance.dicCurSkill[skillRecord.Index]; else return false; if( view == null) return false; Tbl_SkillLevel_Record skillLevelRecord = AsTableManager.Instance.GetTbl_SkillLevel_Record( view.nSkillLevel, view.nSkillTableIdx); if( curMP < ( float)skillLevelRecord.Mp_Decrease) { AsMyProperty.Instance.AlertMP(); // GameObject go = AsHUDController.Instance.gameObject; // if( null != go) // { // AsHUDController hud = go.GetComponent<AsHUDController>(); // hud.AlertMP(); // } return false; } return true; }
// bad code public Tbl_Skill_Record GetSkillByType(eCLASS _class, eSKILL_TYPE _type, eCommand_Type _commandType) { if(_commandType == eCommand_Type.DoubleTab) { Debug.LogWarning("Tbl_Skill_Table::GetSkillByType: invalid usage eCommand_Type.DoubleTab. " + "DoubleTab skills does not exist alone, So use [GetDoubleTabSkillByPickingType()] function"); return null; } foreach(Tbl_Skill_Record record in m_ClassTypeTable[_class]) { if(record.Skill_Type == _type) { if(_commandType == eCommand_Type.NONE) return record; else if(_commandType == record.Command_Type) return record; } } Debug.LogWarning( "[Tbl_Skill_Table]GetSkillByType: there is no record. class=" + _class + ", type = " + _type + ", command type = " + _commandType); return null; }
public Tbl_Skill_Record(BinaryReader br)// : base(_element) { m_Index = br.ReadInt32(); m_SkillName_Index = br.ReadInt32(); m_Description_Index = br.ReadInt32(); m_SkillName_Print = (eSkillNamePrint)br.ReadInt32(); m_SkillReset = (eSkillReset)br.ReadInt32(); m_nSkillResetCost = br.ReadInt32(); m_SkillAutoTarget = (eSkillAutoTarget)br.ReadInt32(); m_Skill_Icon = br.ReadString(); m_Class = (eCLASS)br.ReadInt32(); m_Skill_Type = (eSKILL_TYPE)br.ReadInt32(); m_Skill_TargetType = (eSkill_TargetType)br.ReadInt32(); m_SkillIcon_Enable_Target = (eSkillIcon_Enable_Target)br.ReadInt32(); m_SkillIcon_Enable_Condition = (eSkillIcon_Enable_Condition)br.ReadInt32(); m_SkillIcon_Enable_ConditionValue = br.ReadInt32(); m_Command_Type = (eCommand_Type)br.ReadInt32(); m_CommandPicking_Type = (eCommandPicking_Type)br.ReadInt32(); m_Attack_Direction = (eATTACK_DIRECTION)br.ReadInt32(); m_CoolTimeGroup = br.ReadInt32(); m_DisableInPvP = (eDisableInPvP)br.ReadInt32(); m_DisableInRaid = (eDisableInRaid)br.ReadInt32(); m_DisableInField = (eDisableInRaid)br.ReadInt32(); m_DisableInInDun = (eDisableInInDun)br.ReadInt32(); for(int i=1; i<=AsTableManager.sSkillLevelPotencyCount; ++i) { ePotency_Enable_Target check_target = (ePotency_Enable_Target)br.ReadInt32(); ePotency_Enable_Condition check_condition = (ePotency_Enable_Condition)br.ReadInt32(); float check_conditionValue = br.ReadSingle(); ePotency_Enable_Target check_target2 = (ePotency_Enable_Target)br.ReadInt32(); ePotency_Enable_Condition check_condition2 = (ePotency_Enable_Condition)br.ReadInt32(); float check_conditionValue2 = br.ReadSingle(); ePotency_Type type = (ePotency_Type)br.ReadInt32(); ePotency_Target target = (ePotency_Target)br.ReadInt32(); ePotency_DurationType duration = (ePotency_DurationType)br.ReadInt32(); ePotency_Attribute attribute = (ePotency_Attribute)br.ReadInt32(); ePotency_Element element = ePotency_Element.NONE; string buff = br.ReadString(); int buffToolTipIdx = br.ReadInt32(); Tbl_Skill_Potency potency = new Tbl_Skill_Potency(check_target, check_condition, check_conditionValue, check_target2, check_condition2, check_conditionValue2, type, target, duration, attribute, element, buff, buffToolTipIdx); m_listSkillPotency.Add(potency); } }
public Tbl_Skill_Record GetLearnedCommandSkill(eCommand_Type _type) { switch(_type) { case eCommand_Type.Straight: case eCommand_Type.ArcCW: case eCommand_Type.ArcCCW: case eCommand_Type.CircleCW: case eCommand_Type.CircleCCW: break; default: Debug.LogWarning("Invalid command skill request."); return null; } foreach(KeyValuePair<int, SkillView> pair in m_dicFinger) { Tbl_Skill_Record record = AsTableManager.Instance.GetTbl_Skill_Record(pair.Value.nSkillTableIdx); if(record.Command_Type == _type) { return record; } } return null; }
public Tbl_Skill_Record GetTbl_Skill_Record( eCLASS _class, eSKILL_TYPE _type, eCommand_Type _inputType) { return m_Tbl_Skill.GetSkillByType( _class, _type, _inputType); }
//constructor public Msg_Player_Skill_Ready( eCLASS _class, eSKILL_TYPE _type, eCommand_Type _command, eGENDER _gender, AsBaseEntity _pickedEntity, Vector3 _picked, Vector3 _head, Vector3 _center, Vector3 _tail, Vector3 _dir, eClockWise _cw) { m_MessageType = eMessageType.PLAYER_SKILL_READY; pickedEntity_ = _pickedEntity; picked_ = _picked; head_ = _head; center_ = _center; tail_ = _tail; direction_ = _dir; cw_ = _cw; switch( _type) { case eSKILL_TYPE.Base: skillRecord_ = AsTableManager.Instance.GetRandomBaseSkill( _class); break; case eSKILL_TYPE.Command: skillRecord_ = SkillBook.Instance.GetLearnedCommandSkill( _command); break; default: Debug.LogError( "Msg_Player_Skill_Ready::Msg_Player_Skill_Ready(): [class]" + _class + ",[type]" + _type + ",[command]" + _command + ",[head_]" + _head + ",[center_]" + _center + ",[tail_]" + _tail + ",[direction]" + direction_); break; } if( skillRecord_ != null) { skillLv_ = SkillBook.Instance.GetSkillLevel( skillRecord_); skillLvRecord_ = AsTableManager.Instance.GetTbl_SkillLevel_Record( skillLv_, skillRecord_.Index); int actionIdx = -1; if( _gender == eGENDER.eGENDER_MALE) { if( cw_ == eClockWise.CW) actionIdx = skillLvRecord_.SkillAction_Index; else actionIdx = skillLvRecord_.SkillActionCCW_Index; } else if( _gender == eGENDER.eGENDER_FEMALE) { if( cw_ == eClockWise.CW) actionIdx = skillLvRecord_.SkillAction_Index_Female; else actionIdx = skillLvRecord_.SkillActionCCW_Index_Female; } actionRecord_ = AsTableManager.Instance.GetTbl_Action_Record( actionIdx); if( skillLvRecord_ != null || actionRecord_ != null) { constructSucceed_ = true; return; } } }