Issue information

Issue ID
#6074
Status
New
Severity
None
Started
Hercules Elf Bot
Jun 20, 2012 21:47
Last Post
Hercules Elf Bot
Nov 27, 2012 12:35
Confirmation
Yes (6)
No (0)

Hercules Elf Bot - Jun 20, 2012 21:47

Originally posted by [b]michieru[/b]
Looks like the formula is wrong:

[CODE]
/**
* In Renewal 100% damage reduction is 900 DEF
* Formula: (1+(900-def1)/9)%
**/
if (def1 > 900) def1 = 900;
ATK_RATE2(
flag.idef ?100:(flag.pdef ?(int)(flag.pdef *(def1+vit_def)):(1+(900-def1)/9)),
flag.idef2?100:(flag.pdef2?(int)(flag.pdef2*(def1+vit_def)):(1+(900-def1)/9))
);

ATK_ADD2(
flag.idef ||flag.pdef ?0:-vit_def,
flag.idef2||flag.pdef2?0:-vit_def
);
[/CODE]

it should be:
(Damage after hard DEF) = (Damage before hard DEF)*(600/(600+def))
for the hard def

source: http://irowiki.org/wiki/DEF

Hercules Elf Bot - Jun 21, 2012 8:13

Originally posted by [b]Angezerus[/b]
Confirmed.

Where did that formula came from?! There's no such thing as 100% def in renewal... You would need infinity def to achieve 100% def.

michieru's formula is the correct one.

Hercules Elf Bot - Jun 26, 2012 13:11

Originally posted by [b]michieru[/b]
bump ='(
I think it's a little bit critical, player can be immune to physical dmg easily

Hercules Elf Bot - Jul 7, 2012 10:41

Originally posted by [b]michieru[/b]
bump

Hercules Elf Bot - Jul 12, 2012 9:54

Originally posted by [b]Angezerus[/b]
/bo

Hercules Elf Bot - Jul 15, 2012 21:24

Originally posted by [b]michieru[/b]
bump /sob

Hercules Elf Bot - Jul 16, 2012 0:03

Originally posted by [b]Variant[/b]
[CODE] ATK_RATE2(flag.idef ?100:(flag.pdef ?(int)(flag.pdef *(def1+vit_def)):(1+(600/(600+def1))),flag.idef2?100:(flag.pdef2?(int)(flag.pdef2*(def1+vit_def)):(1+(600/(600+def1)))); [/CODE]

Is that what it should be? At least, according to your formula. 300 defense is supposed to be like 33%, which seems to line up with iROWiki.

Had to retype it because for some reason the forum bb codes decided to up and go crazy on me... Hopefully I didn't forget a )

This post has been edited by Variant on Jul 16, 2012 0:09

Hercules Elf Bot - Jul 16, 2012 12:57

Originally posted by [b]Angezerus[/b]
This seems the right one at first sight :)

Hercules Elf Bot - Jul 18, 2012 16:04

Originally posted by [b]michieru[/b]
in battle.c if I replace this
[CODE]
if (def1 > 900) def1 = 900;
ATK_RATE2(
flag.idef ?100:(flag.pdef ?(int)(flag.pdef *(def1+vit_def)):(1+(900-def1)/9)),
flag.idef2?100:(flag.pdef2?(int)(flag.pdef2*(def1+vit_def)):(1+(900-def1)/9))
);
[/CODE]
By this
[CODE]
ATK_RATE2(
flag.idef ?100:(flag.pdef ?(int)(flag.pdef *(def1+vit_def)):(1+(600/(600+def1)))),
flag.idef2?100:(flag.pdef2?(int)(flag.pdef2*(def1+vit_def)):(1+(600/(600+def1))))
);
[/CODE]

with no stat I took almost no damage. There is other things to do??

Thx for your help

This post has been edited by michieru on Jul 18, 2012 16:06

Hercules Elf Bot - Jul 19, 2012 3:41

Originally posted by [b]Variant[/b]
Just realized, integer division totally screws that formula up. Making the attack 1% of what it should be.

You want...

((double)60000/(600+def1)) since if you throw that through ATK_RATE2, it should be the equivalent of saying
[color=#282828][font=helvetica, arial, sans-serif][size=3](Damage after hard DEF) = (Damage before hard DEF)*(600/(600+def)), the reason we multiplied the whole thing by 10 is just because ATK_RATE2 is damage * (a)/100, so it would be off by a factor of 100 otherwise.[/size][/font][/color]


[color=#000000]ATK_RATE2[/color][color=#666600]([/color]
[color=#000000] flag[/color][color=#666600].[/color][color=#000000]idef [/color][color=#666600]?[/color][color=#006666]100[/color][color=#666600] : ([/color][color=#000000]flag[/color][color=#666600].[/color][color=#000000]pdef [/color][color=#666600]?([/color][color=#000088]int[/color][color=#666600])([/color][color=#000000]flag[/color][color=#666600].[/color][color=#000000]pdef [/color][color=#666600]*([/color][color=#000000]def1[/color][color=#666600]+[/color][color=#000000]vit_def[/color][color=#666600])):[/color](60000.0/(600+def1))[color=#666600]),[/color]
[color=#000000] flag[/color][color=#666600].[/color][color=#000000]idef2[/color][color=#666600]?[/color][color=#006666]100[/color][color=#666600] : ([/color][color=#000000]flag[/color][color=#666600].[/color][color=#000000]pdef2[/color][color=#666600]?([/color][color=#000088]int[/color][color=#666600])([/color][color=#000000]flag[/color][color=#666600].[/color][color=#000000]pdef2[/color][color=#666600]*([/color][color=#000000]def1[/color][color=#666600]+[/color][color=#000000]vit_def[/color][color=#666600])):[/color](60000.0/(600+def1))[color=#666600])[/color]
[color=#000000] [/color][color=#666600]);[/color]




Just to clarify, this would... take damage * (60000.0/(600+def1))/100; If damage was 100 and defense was let's say 300 then we'd get:

100 * (60000.0/(600+300))/100 = 100 * 66.6666.../100 = 6666.6666.../100 = 66.66... Which would work, but you would get a warning when you compile along the lines of "Warning converting double to int, possible loss of data". Which I guess you could fix by typecasting the return value of ATK_RATE2 as an int. Whatever floats your boat.

It's just a random hotfix though, I'm sure one of the developers probably has a much better idea in mind that doesn't involve casting a value as a double, but this method will get you by.

This post has been edited by Variant on Jul 19, 2012 3:46

Hercules Elf Bot - Oct 16, 2012 10:38

Originally posted by [b]Angezerus[/b]
Was this fixed?

Hercules Elf Bot - Oct 16, 2012 13:01

Originally posted by [b]Lighta[/b]
nop but that fix will nedd a if def1 != -600 anyway. Probably hard to get but an arithmetic exeption here would be ugly.

Hercules Elf Bot - Nov 27, 2012 12:35

Originally posted by [b]Angezerus[/b]
Please :)