Exemple #1
0
    public override bool Exec(Actor actor)
    {
        AINpcBoss npcBossAI = actor.SelfAI as AINpcBoss;

        return(npcBossAI.ActionForwardTo(npcBossAI.m_curTargetID));
    }
Exemple #2
0
    public override void OnInitProps()
    {
        base.OnInitProps();
        CurrentTableInfo = GameTable.NPCInfoTableAsset.Lookup(IDInTable);
        if (CurrentTableInfo == null)
        {
            return;
        }

        if (GetNpcType() == ENNpcType.enBOSSNPC)
        {        //boss
            SelfAI = new AINpcBoss(m_npcInfo.BossAIXmlName, m_npcInfo.BossAIXmlSubName);
        }
        else
        {
            if ((ENNPCAIType)m_npcInfo.AIType == ENNPCAIType.enAITypeNormal)
            {
                SelfAI = new AINpcLong();
            }
            else if ((ENNPCAIType)m_npcInfo.AIType == ENNPCAIType.enAITypeBlock)
            {
                SelfAI = new AINpcBlock();
            }
        }
        SelfAI.Owner = this;

        if (GetNpcType() == ENNpcType.enBOSSNPC)
        {        //显示boss硬直,测试用
            UIPauseBtn.Singleton.Register(ID);
        }

        //添加buff
        if (m_npcInfo.GiftBuffIDList != null && m_npcInfo.GiftBuffIDList.Count != 0)
        {
            IResult r = BattleFactory.Singleton.CreateResult(ENResult.AddBuff, ID, ID, 0, 0, m_npcInfo.GiftBuffIDList.ToArray());
            if (r != null)
            {
                r.ResultExpr(m_npcInfo.GiftBuffIDList.ToArray());
                BattleFactory.Singleton.GetBattleContext().CreateResultControl().DispatchResult(r);
            }
        }

        Props.SetProperty_Int32(ENProperty.islive, 1);
        SM.MonsterData mCurRoomMonsterData = null;
        if (roomElement != null && roomElement.MonsterData != null)
        {
            mCurRoomMonsterData = SM.RandomRoomLevel.Singleton.LookupMonsterData(roomElement.MonsterData.monsterObjId);
        }

        if (mCurRoomMonsterData != null && mCurRoomMonsterData.HP != -1)
        {
            Props.SetProperty_Float(ENProperty.maxhp, mCurRoomMonsterData.HP);
            Props.SetProperty_Float(ENProperty.hp, mCurRoomMonsterData.HP);
        }
        else
        {
            Props.SetProperty_Float(ENProperty.maxhp, m_npcInfo.HPMax);
            Props.SetProperty_Float(ENProperty.hp, m_npcInfo.HPMax);
        }
        if (mCurRoomMonsterData != null && mCurRoomMonsterData.PhyAtk != -1)
        {
            Props.SetProperty_Float(ENProperty.phyattack, mCurRoomMonsterData.PhyAtk);
        }
        else
        {
            Props.SetProperty_Float(ENProperty.phyattack, m_npcInfo.PhyAttack);
        }
        if (mCurRoomMonsterData != null && mCurRoomMonsterData.PhyDef != -1)
        {
            Props.SetProperty_Float(ENProperty.phydefend, mCurRoomMonsterData.PhyDef);
        }
        else
        {
            Props.SetProperty_Float(ENProperty.phydefend, m_npcInfo.PhyDefend);
        }
        if (mCurRoomMonsterData != null && mCurRoomMonsterData.MagAtk != -1)
        {
            Props.SetProperty_Float(ENProperty.magattack, mCurRoomMonsterData.MagAtk);
        }
        else
        {
            Props.SetProperty_Float(ENProperty.magattack, m_npcInfo.MagAttack);
        }
        if (mCurRoomMonsterData != null && mCurRoomMonsterData.MagDef != -1)
        {
            Props.SetProperty_Float(ENProperty.magdefend, mCurRoomMonsterData.MagDef);
        }
        else
        {
            Props.SetProperty_Float(ENProperty.magdefend, m_npcInfo.MagDefend);
        }
        PropertyValueIntListView skillIDList = Props.GetProperty_Custom(ENProperty.SkillIDList) as PropertyValueIntListView;

        //if (mCurRoomMonsterData != null)
        {
            int count = 0;
            if (mCurRoomMonsterData != null && mCurRoomMonsterData.SkillList != null)
            {
                for (int i = 0; i < mCurRoomMonsterData.SkillList.Count; ++i)
                {
                    skillIDList.m_list[i] = mCurRoomMonsterData.SkillList[i];
                    ++count;
                }
            }
            else
            {
                for (int i = 0; i < m_npcInfo.SkillList.Count; i++)
                {
                    skillIDList.m_list[i] = m_npcInfo.SkillList[i];
                    ++count;
                }
            }
            if (mCurRoomMonsterData != null && mCurRoomMonsterData.PassiveSkillList != null)
            {
                for (int i = 0; i < mCurRoomMonsterData.PassiveSkillList.Count; ++i)
                {
                    skillIDList.m_list[i + count] = mCurRoomMonsterData.PassiveSkillList[i];
                }
            }
            else
            {
                for (int i = 0; i < m_npcInfo.PassiveSkillList.Count; i++)
                {
                    skillIDList.m_list[i + count] = m_npcInfo.PassiveSkillList[i];
                }
            }
        }
        Props.SetProperty_Custom(ENProperty.SkillIDList, skillIDList);

        //设置NPCType
        if (mCurRoomMonsterData != null && mCurRoomMonsterData.MonsterType != -1)
        {
            Props.SetProperty_Int32(ENProperty.NpcType, (int)mCurRoomMonsterData.MonsterType);
        }
        else
        {
            Props.SetProperty_Int32(ENProperty.NpcType, (int)m_npcInfo.Type);
        }

        //设置模型比例
        if (mCurRoomMonsterData != null && mCurRoomMonsterData.ChangeScale != -1)
        {
            ModelScale = mCurRoomMonsterData.ChangeScale;
        }
        else
        {
            ModelScale = m_npcInfo.ModelScale;
        }

        Props.SetProperty_Float(ENProperty.avoid, m_npcInfo.Avoid);
        Props.SetProperty_Float(ENProperty.hit, m_npcInfo.HitRate);
        Props.SetProperty_Float(ENProperty.crit, m_npcInfo.CritRate);
        Props.SetProperty_Float(ENProperty.critParam, m_npcInfo.CritParam);
        Props.SetProperty_Float(ENProperty.runSpeed, m_npcInfo.MoveSpeed);
        Props.SetProperty_Float(ENProperty.stamina, (float)m_npcInfo.StaminaMax);
        Props.SetProperty_Float(ENProperty.maxStamina, (float)m_npcInfo.StaminaMax);
        Props.SetProperty_Float(ENProperty.FResist, m_npcInfo.Resist);
        Props.SetProperty_Float(ENProperty.AnitInterfere, m_npcInfo.AnitInterfereRate);
        Props.SetProperty_Float(ENProperty.AnitInterrupt, m_npcInfo.AnitInterruptRate);
        Props.SetProperty_Float(ENProperty.AnitRepel, m_npcInfo.AnitRepelRate);
        Props.SetProperty_Float(ENProperty.AnitLauncher, m_npcInfo.AnitLauncherRate);
        Props.SetProperty_Float(ENProperty.WoundParam, m_npcInfo.WoundParam);
        Props.SetProperty_Float(ENProperty.MovebackSpeed, m_npcInfo.RetreatSpeed);
        Props.SetProperty_Float(ENProperty.AnimationSpeed, m_npcInfo.AnimationSpeed);
        Props.SetProperty_Int32(ENProperty.WeaponID, m_npcInfo.WeaponID);
        AttackAnimSpeed = 1;
    }