Issue information

Issue ID
#5115
Status
Fixed
Severity
Fair
Started
Hercules Elf Bot
Dec 10, 2011 5:08
Last Post
Hercules Elf Bot
Apr 18, 2012 15:24
Confirmation
Yes (1)
No (0)

Hercules Elf Bot - Dec 10, 2011 5:08

Originally posted by [b]jTynne[/b]
It seems that two-handed weapons that have MATK are causing roughly ten times more magical damage than they should.

To reproduce, job change to arch bishop, equip a rod, all skill and use max level Judex against a monster. Now, equip a divine cross (2h weap) and use Judex against the same monster. You should see about a 10x difference in damage.

Further, look at the matk in the equipment window when equipping the divine cross.

Hercules Elf Bot - Dec 10, 2011 7:59

Originally posted by [b]FatalEror[/b]
Not only 2 Handed-Weapon,
this bug will apply to weapon that have high MATK

This is what i've tried:

status.c:2711
[code]MATK_ADD((1+sstatus->matk_max) * 2 + 15/10 * sstatus->matk_min + rand()% ( sstatus->matk_max + (1 + (sstatus->matk_max*sstatus->wlv) / 10 * 2 * 10/15 * sstatus->matk_min ) ));[/code]

I've added some debug message below and after that line:
[code]ShowDebug("Your matk_max: %d\n", sstatus->matk_max);
ShowDebug("Your matk_min: %d\n", sstatus->matk_min);
ShowDebug("Damage before: %d\n", ad.damage);
MATK_ADD((1+sstatus->matk_max) * 2 + 15/10 * sstatus->matk_min + rand()% ( sstatus->matk_max + (1 + (sstatus->matk_max*sstatus->wlv) / 10 * 2 * 10/15 * sstatus->matk_min ) ));
ShowDebug("Damage after: %d\n", ad.damage);[code]

Here is the result:
[IMG]http://i589.photobucket.com/albums/ss337/ZeroBytes/debug.png[/IMG]

And so, i think that the culprit is this:
[code]rand()% ( sstatus->matk_max + (1 + (sstatus->matk_max*sstatus->wlv) / 10 * 2 * 10/15 * sstatus->matk_min ) )[/code]


And sorry for my bad english..

Hercules Elf Bot - Dec 10, 2011 8:01

Originally posted by [b]FatalEror[/b]
Can't edit post @___@

[IMG]http://i589.photobucket.com/albums/ss337/ZeroBytes/debug.png[/IMG]

Hercules Elf Bot - Dec 10, 2011 16:07

Originally posted by [b]Ind[/b]
hum, is there something wrong in the matk damage formula we use? (except that +1 cause that's a temporary crash fix -- but it doesn't increase the damage that much)

Hercules Elf Bot - Dec 11, 2011 0:57

Originally posted by [b]FatalEror[/b]
First, you calculated it wrong:
[code]matk_min+ rand()%matk_max[/code]

it should be:
[code]matk_min+ rand()%(matk_max-matk_min))[/code]


Second, there's a typo!
in [b]battle.c:2711[/b]:
[code]MATK_ADD((1+sstatus->matk_max) * 2 + 15/10 * sstatus->matk_min + rand()% ( sstatus->matk_max + (1 + (sstatus->matk_max*sstatus->wlv) / 10 * 2 * 10/15 * sstatus->matk_min ) ));[/code]

matk_max formula should be this:
[i]max: [weaponMATK+upgradeMATK+(wMatk*wLvl)/10] * 2 [color=#ff0000][b]+[/b][/color] 1.5 * statusMATK[/i]

but...
[i]rand()% ( sstatus->matk_max + (1 + (sstatus->matk_max*sstatus->wlv) / 10 * 2 [color=#ff0000][b]*[/b][/color] 10/15 * sstatus->matk_min ) )[/i]


[right][size=1][i]This is so annoying, you can't preview [/i][/size][/right]
[right][size=1][i]neither edit post in here @_@[/i][/size][/right]

Hercules Elf Bot - Dec 11, 2011 2:12

Originally posted by [b]Ind[/b]
[quote]
First, you calculated it wrong:
[code]matk_min+ rand()%matk_max[/code]

it should be:
[code]matk_min+ rand()%(matk_max-matk_min))[/code]
[/quote]
are you sure on this one? cause matk max is almost-always less than matk_min (in RE matk_max (despite its name) is used as weaponMatk+UpgradeMatk)
[quote]
Second, there's a typo!
in [b]battle.c:2711[/b]:
[code]MATK_ADD((1+sstatus->matk_max) * 2 + 15/10 * sstatus->matk_min + rand()% ( sstatus->matk_max + (1 + (sstatus->matk_max*sstatus->wlv) / 10 * 2 * 10/15 * sstatus->matk_min ) ));[/code]

matk_max formula should be this:
[i]max: [weaponMATK+upgradeMATK+(wMatk*wLvl)/10] * 2 [color=#ff0000][b]+[/b][/color] 1.5 * statusMATK[/i]

but...
[i]rand()% ( sstatus->matk_max + (1 + (sstatus->matk_max*sstatus->wlv) / 10 * 2 [color=#ff0000][b]*[/b][/color] 10/15 * sstatus->matk_min ) )[/i]
[/quote]
thanks very much for noticing, i guess thats why there is such a huge difference in weapon vs no weapon

Hercules Elf Bot - Dec 12, 2011 0:09

Originally posted by [b]Ind[/b]
^still waiting for a reply on that;
Major issue should be fixed by [rev=15066]

Hercules Elf Bot - Dec 12, 2011 5:25

Originally posted by [b]FatalEror[/b]
[quote name='Ind' timestamp='1323569536' post='5389']
[quote]First, you calculated it wrong:[code]matk_min+ rand()%matk_max[/code]it should be:[code]matk_min+ rand()%(matk_max-matk_min))[/code][/quote]are you sure on this one? cause matk max is almost-always less than matk_min (in RE matk_max (despite its name) is used as weaponMatk+UpgradeMatk)[/quote]


What i mean matk_max and matk_min here is not the StatusMATK and WeaponMATK..

So if i make it like this:
[code]int min, max;
min = 1 + (sstatus->matk_max) * 2 + 15/10 * sstatus->matk_min;
max = sstatus->matk_max + (1 + (sstatus->matk_max*sstatus->wlv) / 10 * 2 + 10/15 * sstatus->matk_min );[/code]

Your's is:
[code]MATK_ADD(min + rand()%max);[/code]
This will make your base matk damage around min~(min + max)

And what i mean is:
[code]MATK_ADD(min + rand()%(max-min));[/code]
Will make it around min ~ max