Beispiel #1
0
        // 为去除警告暂时屏蔽以下代码
        //private uint stiffTotal = 0;
        virtual public void OnHit(int _actionID, uint _attackerID, uint woundId, List <int> harm)
        {
            if (theOwner.CurrentMotionState == MotionState.DEAD)
            {
                return;
            }
            if (theOwner.currSpellID != -1)
            {//专为旋风斩之类有duration的技能临时做
                SkillData s = SkillData.dataMap[theOwner.currSpellID];
                if (SkillAction.dataMap[s.skillAction[0]].duration > 0)
                {
                    return;
                }
            }
            if (!theOwner.immuneShift)
            {
                theOwner.ClearSkill(true);
            }
            SkillAction action = SkillAction.dataMap[_actionID];

            if (action.hitSfx != null && action.hitSfx[0] > 0)
            {
                theOwner.PlayFx((int)action.hitSfx[0]);
            }
            HitBuff(action);
            List <int> hitAction = action.hitAction;

            if (hitAction == null || hitAction.Count == 0 || theOwner.immuneShift)
            {
                return;
            }
            int  _act    = Utils.Choice <int>(hitAction);
            bool cfgShow = true;

            if (((theOwner is EntityMonster) && (theOwner as EntityMonster).ShowHitAct != 0) ||
                ((theOwner is EntityDummy) && (theOwner as EntityDummy).ShowHitAct != 0) ||
                ((theOwner is EntityMercenary) && (theOwner as EntityMercenary).ShowHitAct != 0))
            {
                cfgShow = false;
            }
            string actName = theOwner.CurrActStateName();

            if ((theOwner is EntityMyself) && (MapData.dataMap.Get(MogoWorld.thePlayer.sceneId).type == MapType.ARENA))
            {//如果主角在竞技场内受到HIT,无视之,不进受击状态
                List <int> hitAction2 = SkillAction.dataMap[_actionID].hitAction;
                if (hitAction2 == null || hitAction.Count == 0)
                {
                    return;
                }
                int action2 = Utils.Choice <int>(hitAction2);
                if (action2 == ActionConstants.HIT)
                {
                    return;
                }
            }


            if (MogoWorld.showHitAction && _act > 0 && theOwner.curHp > 0 &&
                !actName.EndsWith("getup") &&
                !actName.EndsWith("knockout") &&
                !actName.EndsWith(PlayerActionNames.names[ActionConstants.HIT_GROUND]) &&
                //!theOwner.IsInTransition() &&
                cfgShow)
            {//如果没填就不做受击表现
                theOwner.ChangeMotionState(MotionState.HIT, _actionID, _attackerID);
            }
            if (MogoWorld.showHitEM && !(theOwner is EntityMonster) && action.hitExtraSpeed != 0)
            {
                theOwner.motor.SetExrtaSpeed(-action.hitExtraSpeed);
                theOwner.motor.SetMoveDirection(theOwner.Transform.forward);
                TimerHeap.AddTimer <EntityParent>((uint)(action.hitExtraSl * 1000), 0, (e) => {
                    if (e == null || e.motor == null)
                    {
                        return;
                    }
                    e.motor.SetExrtaSpeed(0);
                }, theOwner);
            }
        }