Esempio n. 1
0
    public SKILL_RESULT_CODE CastSkill(uint dwSkillID, ref KTarget pTarget)
    {
        int nRetCode = 0;
        SKILL_RESULT_CODE nResult          = SKILL_RESULT_CODE.srcFailed;
        KCharacter        pTargetCharacter = null;

        if (m_pEntity == null)
        {
            return(SKILL_RESULT_CODE.srcFailed);
        }

        ISkillPart skillPart = m_pEntity.GetPart(EntityPart.Skill) as ISkillPart;

        if (skillPart == null)
        {
            return(SKILL_RESULT_CODE.srcFailed);
        }

        if (pTarget == null)
        {
            return(SKILL_RESULT_CODE.srcFailed);
        }

        nRetCode = pTarget.GetTarget(ref pTargetCharacter);
        if (nRetCode == 0 || pTargetCharacter == null)
        {
            return(SKILL_RESULT_CODE.srcFailed);
        }

        IEntity targetEntity = pTargetCharacter.m_pEntity;

        if (targetEntity == null)
        {
            return(SKILL_RESULT_CODE.srcFailed);
        }

        skillPart.ReqNpcUseSkill(targetEntity, dwSkillID);


        //
        KSkill pSkill = FirstFightMgr.Instance().m_SkillManager.GetSkill(dwSkillID);

        pSkill.Cast(this, this, ref pTarget);



        //测试代码
        // 伤害飘子
        //FlyFontDataManager.Instance.ShowDamage(999, 1, pTargetCharacter.m_dwID, EntityType.EntityType_NPC, 1000000);
        //pTargetCharacter.Test_ConcludeResult();



        nResult = SKILL_RESULT_CODE.srcSuccess;
Exit0:
        return(nResult);
    }