Attack Issue

Horyon

Пляшущий с бубном
Участник
Сообщения
212
Розыгрыши
0
Решения
4
Репутация
53
Реакции
73
Баллы
273
Хроники
  1. Master Class
Исходники
Присутствуют
Сборка
Mobius Sources
After i upgrade protocol is first time i check basic stuff. And trying do a attack o saw a strange behavior.

Character receive the call, move to target, and do nothing.

1718193126050.png

Char keep on mob side but dont attack.

IF i move the char a bit and put to attack again, will work. If the mob moves will work.

Ty in advance.

Any tip help to investigate.
 
There is a possibility that this is related to the geodata\geo engine. Try to turn it off and check if there will be the same problem.
 
Check Attack packet, maybe change structure.
 
Maybe this issue related to the npc state, which is sent incorrectly due to changes in the structure of npc info
 
There is a possibility that this is related to the geodata\geo engine. Try to turn it off and check if there will be the same problem.
Geo data off or on dont change.

I'll make the updates from my tests.

1 - This issue extend to mages, if u are away, u will move to range but will stop. If u click again will cast. Correct behavior: enter in range and cast skill without need other click.

2 - For melees, after u close to targer, even clicking dont make u attack, mob or you need to move to "UNLOCK" something bugged and make it work after move.

3 - bows work normaly, u enter in range and attack.

Ok from the track of issue i find this in PlayerAI.java

Java:
private void thinkAttack()
    {
        final SkillUseHolder queuedSkill = _actor.getActingPlayer().getQueuedSkill();
        if (queuedSkill != null)
        {
            // Remove the skill from queue.
            _actor.getActingPlayer().setQueuedSkill(null, null, false, false);
           
            // Check if player has the needed MP for the queued skill.
            if (_actor.getCurrentMp() >= _actor.getStat().getMpInitialConsume(queuedSkill.getSkill()))
            {
                // Abort attack.
                _actor.abortAttack();
               
                // Recharge shots.
                if (!_actor.isChargedShot(ShotType.SOULSHOTS) && !_actor.isChargedShot(ShotType.BLESSED_SOULSHOTS))
                {
                    _actor.rechargeShots(true, false, false);
                }
               
                // Use queued skill.
                _actor.getActingPlayer().useMagic(queuedSkill.getSkill(), queuedSkill.getItem(), queuedSkill.isCtrlPressed(), queuedSkill.isShiftPressed());
                return;
            }
        }
       
        final WorldObject target = getTarget();
        if ((target == null) || !target.isCreature())
        {
            return;
        }
        if (checkTargetLostOrDead((Creature) target))
        {
            // Notify the target
            setTarget(null);
            return;
        }
        if (maybeMoveToPawn(target, _actor.getPhysicalAttackRange()))
        {
            _actor.sendMessage("maybeMoveToPawn");
            return;
        }
       
        clientStopMoving(null);
        _actor.sendMessage("atacou");
        _actor.doAutoAttack((Creature) target);
    }

When u hit from far u will enter in "if (maybeMoveToPawn(target, _actor.getPhysicalAttackRange()))", and this is in the file CreatureAI.java(parent class).

Java:
protected boolean maybeMoveToPawn(WorldObject target, int offsetValue)
    {
        // Get the distance between the current position of the Creature and the target (x,y)
        if (target == null)
        {
            // LOGGER.warning("maybeMoveToPawn: target == NULL!");
            return false;
        }
        if (offsetValue < 0)
        {
            return false; // skill radius -1
        }
       
        int offsetWithCollision = offsetValue + _actor.getTemplate().getCollisionRadius();
        if (target.isCreature())
        {
            offsetWithCollision += ((Creature) target).getTemplate().getCollisionRadius();
        }
       
        if (!_actor.isInsideRadius2D(target, offsetWithCollision))
        {
            // Caller should be Playable and thinkAttack/thinkCast/thinkInteract/thinkPickUp
            if (isFollowing())
            {
                // allow larger hit range when the target is moving (check is run only once per second)
                if (!_actor.isInsideRadius2D(target, offsetWithCollision + 100))
                {
                    return true;
                }
                stopFollow();
                return false;
            }
           
            if (_actor.isMovementDisabled() || (_actor.getMoveSpeed() <= 0))
            {
                // If player is trying attack target but he cannot move to attack target
                // change his intention to idle
                if (_actor.getAI().getIntention() == AI_INTENTION_ATTACK)
                {
                    _actor.getAI().setIntention(AI_INTENTION_IDLE);
                }
                return true;
            }
           
            // while flying there is no move to cast
            if ((_actor.getAI().getIntention() == AI_INTENTION_CAST) && _actor.isPlayer() && _actor.checkTransformed(transform -> !transform.isCombat()))
            {
                _actor.sendPacket(SystemMessageId.THE_DISTANCE_IS_TOO_FAR_AND_SO_THE_CASTING_HAS_BEEN_CANCELLED);
                _actor.sendPacket(ActionFailed.STATIC_PACKET);
                return true;
            }
           
            // If not running, set the Creature movement type to run and send Server->Client packet ChangeMoveType to all others Player
if (!_actor.isRunning() && !( this instanceof PlayerAI) && ! (this instanceof SummonAI))
            {
                _actor.setRunning();
            }
           
            stopFollow();
            int offset = offsetValue;
            if (target.isCreature() && !target.isDoor())
            {
                if (((Creature) target).isMoving())
                {
                    offset -= 100;
                }
                if (offset < 5)
                {
                    offset = 5;
                }
                _actor.sendMessage("follow");
                startFollow((Creature) target, offset);
            }
            else
            {
                // Move the actor to Pawn server side AND client side by sending Server->Client packet MoveToPawn (broadcast)
                moveToPawn(target, offset);
            }
            return true;
        }
       
        if (isFollowing())
        {
            stopFollow();
        }
       
        // Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation (broadcast)
        // clientStopMoving(null);
        return false;
    }

So here we enter in

Java:
 if (target.isCreature() && !target.isDoor()) <----- enter here

            {

                if (((Creature) target).isMoving()) <----- fail here normaly(if target is moving dont make diff, bug too

                {

                    offset -= 100;

                }

                if (offset < 5)

                {

                    offset = 5;

                }

                startFollow((Creature) target, offset); <------- runs here

            }

            else

            {

                // Move the actor to Pawn server side AND client side by sending Server->Client packet MoveToPawn (broadcast)

                moveToPawn(target, offset);

            }

 return true <------ and return true;

So after return true the thinkAttack() stop. And for bow, when u attack normaly, if keeps TICK.

Its strange, because for bow runs the same but when u get in range, u start attack.

OBS: find a solution here helps all who are using mobius, maybe u dont see this cause u using auto hunt, but for hand play is impossible play like this. For a pvp there is no point to runs like this 100% broken

Check Attack packet, maybe change structure.
I have older version from 388 protocol i think, will test there is this issue is old

I have older version from 388 protocol i think, will test there is this issue is old
Just the Mage issue happens but not always.

Will start compare the attack flux.
 
Последнее редактирование модератором:
Fixed but, i dont know what solve.

Cause i just parsed my current build vs other. changed like 90% of stuff and when i test was working.
 
Назад
Сверху Снизу