Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Partybot in combat target selection AI #2426

Open
wants to merge 1 commit into
base: development
Choose a base branch
from

Conversation

ShiyoKozuki
Copy link
Contributor

@ShiyoKozuki ShiyoKozuki commented Jan 10, 2024

🍰 Pullrequest

Original Behavior:
Partybots do not swap to the party leaders target or swap to a marked target after the focusmark in game command is executed while in combat.

Corrected Behavior:
Partybots properly target a marked target(if focusmark command is executed) or the party leaders target while in combat. Priority is marked(if focusmark command executed) - > Party leaders target(if no mark or command isn't executed).

Proof

  • None

Issues

How2Test

Summon party bots, type .partybot focusmark skull. engage an enemy. Mark a new enemy with skull, bots will swap to it.
Summon party bots, engage an enemy, swap target(do not mark), partybots will swap to your target

Todo / Checklist

  • None

@gajet5
Copy link
Contributor

gajet5 commented Jan 11, 2024

Will this work in a raid if the bots were not called by the leader? For example, the hiller leader. which does not target the goals.

@ShiyoKozuki
Copy link
Contributor Author

ShiyoKozuki commented Jan 11, 2024

Will this work in a raid if the bots were not called by the leader? For example, the hiller leader. which does not target the goals.

AFAIK it assigns the summoner as pt leader, not the real party leader in game
This is how it was aleady set up for pt leader assignment and was not changed

@gajet5
Copy link
Contributor

gajet5 commented Jan 11, 2024

Okay, I got it. Thanks, I will test it.

@gajet5
Copy link
Contributor

gajet5 commented Jan 17, 2024

I have checked this functionality and it works well. They really started hitting targets. However, there is a downside to this update. Without this update, the role of the tank was trying to run around the NPCs and tried to provoke them. Now he hits one target and the NPCs kill the healer.

@GoonBoiBarry
Copy link

I have checked this functionality and it works well. They really started hitting targets. However, there is a downside to this update. Without this update, the role of the tank was trying to run around the NPCs and tried to provoke them. Now he hits one target and the NPCs kill the healer.

You can assign targets to specific bots by targeting them individually and typing the command. If you do this to everyone but the tank, the tank will work the way it worked before. This way you can have tanks dedicated to tanking 1 target and general tanks etc.

@gajet5
Copy link
Contributor

gajet5 commented Jan 17, 2024

I understand it. But it won't work on trash. And I'm talking about him first of all. Bosses don't cause problems. I need more tests, I'll try to exclude tanks from this logic.

In any case, the DPS roles have become more responsive.

@gajet5
Copy link
Contributor

gajet5 commented Jan 19, 2024

    // Swap DPS to marked target or party leader's target
    if (m_role == ROLE_MELEE_DPS || m_role == ROLE_RANGE_DPS)
    {
        Unit* pVictim = me->GetVictim();

        if (Player* pLeader = GetPartyLeader())
        {
            Unit* newVictim = SelectAttackTarget(pLeader);

            if (newVictim && (newVictim != pVictim))
            {
                if (pVictim)
                    me->AttackStop();
                else
                    AttackStart(newVictim);

                return;
            }
        }
    }

I think it's better to make this priority only for DPS. Otherwise, the logic above, the tank protects the group members, does not work.

I have tested two different scenarios.
The first is when the tank hits the target. The second is when the tank ignores this logic.
In the second case, the tank protected the group members better.

@GoonBoiBarry
Copy link

    // Swap DPS to marked target or party leader's target
    if (m_role == ROLE_MELEE_DPS || m_role == ROLE_RANGE_DPS)
    {
        Unit* pVictim = me->GetVictim();

        if (Player* pLeader = GetPartyLeader())
        {
            Unit* newVictim = SelectAttackTarget(pLeader);

            if (newVictim && (newVictim != pVictim))
            {
                if (pVictim)
                    me->AttackStop();
                else
                    AttackStart(newVictim);

                return;
            }
        }
    }

I think it's better to make this priority only for DPS. Otherwise, the logic above, the tank protects the group members, does not work.

I have tested two different scenarios. The first is when the tank hits the target. The second is when the tank ignores this logic. In the second case, the tank protected the group members better.

Okay, but what if you're in a raid with multiple tanks and need one tank to stay on the boss no matter what? Would it not make more sense to leave the option to select which tanks behave this way via targeting with the command? I don't understand, have you tried just not setting a focus mark for the tank?

@gajet5
Copy link
Contributor

gajet5 commented Jan 19, 2024

ok, I understood, yes, in this scenario, the tank will break off the label, but then this is a bug within the logic of the tank, why does it ignore the label if it is set for him.

@GoonBoiBarry
Copy link

Well isn't that what your proposed change is doing in effect? Making tanks ignore focusmarks?

@gajet5
Copy link
Contributor

gajet5 commented Jan 20, 2024

Yes, this is true, but only partially. The logic that was proposed completely disables the usual behavior of the tank, which is spelled out above. If the player selects one enemy. I'm not talking about the label, just the right mouse click.

I don't have enough experience to finish writing the logic for the tank. But after line 934 there should be a check for the presence of a label.

Unit* pVictim = me->GetVictim();

Then if there is an assigned tag for this AI, it should only attack it. Otherwise, try to protect the group.

@GoonBoiBarry
Copy link

Yes, this is true, but only partially. The logic that was proposed completely disables the usual behavior of the tank, which is spelled out above. If the player selects one enemy. I'm not talking about the label, just the right mouse click.

I don't have enough experience to finish writing the logic for the tank. But after line 934 there should be a check for the presence of a label.

Unit* pVictim = me->GetVictim();

Then if there is an assigned tag for this AI, it should only attack it. Otherwise, try to protect the group.

Ah I see, thanks for explaining it to me. I agree with you then.

@gajet5
Copy link
Contributor

gajet5 commented Jan 21, 2024

You are welcome. I tried to write a solution. It's not the prettiest, but it works.
development...gajet5:core:fix-attack-marked-and-target

First, we are changing the attack priority only for DPS.
Secondly, we add a check for the tank, if there is a mark, then we attack only it.

@GoonBoiBarry
Copy link

Oh cool, nice job! I'll give it a test sometime when I come back to vmangos

@0blu 0blu added the CPP A issue / PR which references CPP code label Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CPP A issue / PR which references CPP code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 [Bug]Partybots don't properly focus marked targets
4 participants