project-topaz / topaz

Server emulator for FFXI
Other
159 stars 224 forks source link

Correct wyvern breath element selection #1430

Closed rude-jerk closed 3 years ago

rude-jerk commented 3 years ago

I affirm:

https://www.bg-wiki.com/bg/Wyvern_(Dragoon_Pet)

The selected breath is determined exclusively by an opponent's elemental resistances at the time of activation

Magic damage reduction, elemental damage reduction and absorption, elemental magic accuracy buffs such as Klimaform, or equipment such as the Drachen Armet/+1 or Vishap Armet/+1/+2/+3 have no bearing on a wyvern's choice of breath.

Effects that lower enemy resistances such as Threnody or Skillchains are factored into this choice.

In the event of a tie for lowest resistance, the element is selected in the following order of Fire → Ice → Wind → Earth → Thunder → Water.

ibm2431 commented 3 years ago

When elements are fixed in release we might be able to remove the two tables altogether and just use Flame Breath and Fire element as offsets.

local lowest = 0
local lowest_res = target:getMod(tpz.mod.FIRERES)
for i = 1, i <= 5, 1 do
    local res = target:getMod(tpz.mod.FIRERES + i)
    if res < lowest_res then
        lowest = i
        lowest_res = res
    end
end
table.insert(breaths, tpz.jobAbility.FLAME_BREATH + lowest)

But for now the tables are needed because the elements in release follow the wrong order.