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

Base implementation of barrage turbine #6850

Merged
merged 1 commit into from
Jan 28, 2025

Conversation

RaraProjects
Copy link
Contributor

@RaraProjects RaraProjects commented Jan 26, 2025

I affirm:

  • I understand that if I do not agree to the following points by completing the checkboxes my PR will be ignored.
  • I understand I should leave resolving conversations to the LandSandBoat team so that reviewers won't miss what was said.
  • I have read and understood the Contributing Guide and the Code of Conduct.
  • I have tested my code and the things my code has changed since the last commit in the PR and will test after any later commits.

What does this pull request do?

Closes #4822

Background

Automaton Attachments

  1. Upon equipping an ability attachment (like Flashbulb which is implemented), the attachment is subscribed to the AUTOMATON_ATTACHMENT_CHECK event listener with a function to execute when the event occurs.
  2. /src/map/ai/controllers/automaton_controller.cpp -> DoCombatTick has a TryAction block that calls TryAttachment.
  3. TryAttachment calls any listeners currently subscribed to AUTOMATON_ATTACHMENT_CHECK.
  4. The subscribed function gets executed and checks various things like ability recast, number of active maneuvers, etc.
  5. If all of the checks pass then the ability is used via useMobAbility from /src/map/lua/lua_baseentity.cpp.
  6. The onAutomatonAbility function in /scripts/actions/abilities/pets/automaton catches this and actually performs the ability.

Automaton Ranged Attack

  1. Automaton ranged attacks are treated as weaponskills.
  2. The setup function xi.autows.doAutoRangedWeaponskill is used to carry out the ranged attack. It sets up some necessary variables and then calls in to standard weaponskill functions xi.weaponskills.calculateRawWSDmg and xi.weaponskills.takeWeaponskillDamage.
  3. Standard weaponskills can have multiple hits with (I believe) a cap of 8 hits. And this is how the code is setup up within xi.weaponskills.calculateRawWSDmg.
  4. The TP from a PUP ranged attack is applied in /src/map/utils/battleutils.cpp TakeWeaponskillDamage().

General Implementation

List Adjustments

automaton_abilities.sql

  • Added barrage turbine to with reqframe = 22 and skilllevel = 0.
    mob_skills.sql for barrage turbine (2746)
  • Changed mob_skill_distance to 25.0 (previously 7.0) to match the regular ranged attack
  • Changed mob_valid_targets to 4 (previously 16). Without the latter change barrage turbine will only be able to do damage to the automaton instead of the enemy.
  • Changed mob_anim_id to 16 (previously 434). There isn't a noticeably special animation for barrage turbine. It has the same animation as the regular automaton ranged attack.
  1. Added BARRAGE_TURBINE to the xi.automaton.abilities list in /scripts/globals/automaton.lua. The ID is 2746.

Do NOT add to mob_skill_lists.sql because Barrage Turbine is not a TP move in the traditional sense and we don't want it mixed in with the automaton's weaponskill lineup.

Image
Barrage Turbine Capture

onEquip Listener

  1. I chose to not include a distance check to mirror the regular automaton ranged attack.
  2. There needs to be a time in zone check before using useMobAbility.

onAutomatonAbility

  1. I confirmed that the delay is 180 seconds (3 minutes) between barrage turbine activation.
  2. Add overload. The amount of overload to add isn't well understood so I'm just leaving a placeholder adding zero to xi.element.WIND for now. The burden handling may require a bit more (future) thought as all of the actions in the standard xi.automaton.onUseManeuver handling may not be appropriate for the burden added by barrage turbine. For example, barrage turbine does not come with an overload chance message and I've never seen barrage turbine cause an overload (can it?).
  3. Get the number of active wind maneuvers since the number of shots scale with the number of maneuvers.
  4. Execute the barrage. I leveraged the existing automaton ranged attack handling to do this. See Barrage Implementation for more information on that.

Barrage Implementation

As automaton ranged attacks are considered weaponskills, and a barrage is a series of ranged attacks, it would be prudent to take advantage of the existing automaton ranged attack code, xi.autows.doAutoRangedWeaponskill, to perform the barrage. This works generally, but there is the matter of damage and TP gain.

I needed to create a new element, isBarrage, within the parameter table passed into xi.autows.doAutoRangedWeaponskill. I used that new element within the remaining hits while loop of xi.weaponskills.calculateRawWSDmg to increase the amount of tpHitsLanded. I needed to use tpHitsLanded because it's used in TakeWeaponskillDamage() which calculates the return TP. The other option was extraHitsLanded, but those hits only get multipied by 10 instead of the baseTp,

Problem # 1

The max number of shots in the barrage is 9. The multi-hit weaponskill cap is 8. So, as-is I cannot generate a 9 shot hit. If I remove the cap in the remaining hits while loop within xi.weaponskills.calculateRawWSDmg I am able to get the correct amount of hits, but I didn't want to perform too much surgery.

Problem # 2

Retail testing shows that the TP gained from Barrage Turbine is nice multiples of the base ranged attack TP proportional to the number of active maneuvers. My implementation is close, but not quite perfect. They are just a bit shy of the expected value. The existing TP calculations, perhaps in battleutils.cpp, may need to be adjusted to better handle the TP return of weaponskill based barrage. Or maybe a net new handler needs to implemented somewhere.

Testing

The same sample size was 5 tests for each set (5 ranged, 5 with one maneuver, etc.). Not an extensive sample size, but it does take three minutes between each barrage on retail. The data spread seemed like 5 tests should be good enough.

TP Return

This Implementation

Action Hits TP ~Ranged Attacks
Ranged 1 93 ~
1 Maneuver 4 342 3.67
2 Maneuvers 6 508 5.46
3 Maneuvers 8 716 7.69

* Note that 3 maneuvers is 8 because of the weaponskill multi-hit cap instead of the expected 9.

Retail

Action Hits TP ~Ranged Attacks
Ranged 1 105 ~
1 Maneuver 4 420 4
2 Maneuvers 6 630 6
3 Maneuvers 9 945 9

Damage

In this implementation the individual barrage hits outperform the the regular ranged hits a bit.

Action Hits Average Damage ~Ranged Attacks
Ranged 1 266 ~
1 Maneuver 4 1191 4.48
2 Maneuvers 6 1708 6.42
3 Maneuvers 8 2197 8.26

* Note that 3 maneuvers is 8 because of the weaponskill multi-hit cap instead of the expected 9.

In Retail the individual barrage hits underperform regular ranged hits a bit.

Action Hits Average Damage ~Ranged Attacks
Ranged 1 617.4 ~
1 Maneuver 4 2259 3.66
2 Maneuvers 6 3555 5.76
3 Maneuvers 9 5492 8.89

Barrage Turbine Delay

I did some testing on how long it takes before the initial barrage turbine can be used. After several different scenarios I can say this about the delay:

  1. Consistently takes 3 minutes between barrage turbines.
  2. Can be used immediately upon engaging a mob as long as a wind maneuver is active.
  3. Letting maneuvers completely fall off does not reset any counters.
  4. The automaton needs to be active for at least 3 minutes before use.

Battle Scenario Testing

Time Stamp Event
12:21:56 Barrage Turbine on mob # 1
12:23:56 Mob # 1 defeated
12:24:09 Engage mob # 2 with melee damage
12:24:21 Deploy automaton
12:24:55 Redeploy automaton because it was engaged but not doing anything. It shoots the mob
12:28:01 Barrage Turbine on mob # 2
~ Let maneuvers wear off
12:35:47 Add wind maneuver
12:35:49 Barrage Turbine on mob # 2
12:37:06 Retrieve (automaton stops engaging mob # 2)
12:38:15 Deploy
12:37:06 Deploy again (automaton starts engaging mob # 2)
12:41:53 Barrage Turbine on mob # 2
12:44:54 Barrage Turbine on mob # 2
12:47:54 Barrage Turbine on mob # 2
12:48:27 Mob # 2 defeated
12:53:05 Engaged mob # 3
12:53:14 Deploy
12:53:14 Barrage Turbine on mob # 3 (instant)
12:56:17 Barrage Turbine on mob # 3
12:56:44 Zone out and back in
~ Wait >3 minutes
01:02:19 Add wind maneuver
01:03:01 Engaged mob # 4
01:03:09 Deploy (automaton engages)
01:03:09 Barrage Turbine on mob # 4
01:06:18 Zone out and back in
01:07:24 Engaged mob # 5
01:07:39 Add wind maneuver
01:07:49 Deploy (automaton engages)
01:08:55 Add wind maneuver
01:09:23 Barrage Turbine on mob # 5)

Initial Delay Testing (Zone vs. Activation)

Time Stamp Event
11:00:25 Zone in
11:01:44 Activate automaton
11:02:10 Deploy (automaton engages)
11:02:15 Wind maneuver
11:02:50 Wind maneuver
11:03:44 Wind maneuver
11:04:46 Barrage Turbine

* Barrage turbine occurs 3 minutes after activation.

TODOs

  1. Flesh out the burden application.
  2. Tune the damage and TP return to be more in line with retail.
  3. Expand the remaining hits while loop of xi.weaponskills.calculateRawWSDmg (or some other strategy) to allow for 9 hits. Right now it's capped at 8.

@RaraProjects
Copy link
Contributor Author

RaraProjects commented Jan 28, 2025

I could maybe do a bolt-on solution where I initialize a new local variable that defaults to 8, but if wsParams.isBarrage is true then set to 9. Not the most elegant, but simple and I don't need to tear anything up. I'm open to other ideas or just leaving as is for now.

while hitsDone < 8 and mainhandMultiHitsDone < numMainHandMultis and finaldmg < targetHp do

@WinterSolstice8
Copy link
Member

I could maybe do a bolt-on solution where I initialize a new local variable that defaults to 8, but if wsParams.isBarrage is true then set to 9. Not the most elegant, but simple and I don't need to tear anything up. I'm open to other ideas or just leaving as is for now.

Would make a separate PR for that

@zach2good zach2good merged commit d47040e into LandSandBoat:base Jan 28, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🔨 Attachment: Barrage Turbine not implemented
5 participants