tModLoader

tModLoader

Fixed Armor Penetration
13 条留言
Xetaxheb  [作者] 5 月 28 日 上午 9:52 
Doesn't really matter what the wiki purports, I was reiterating what the source code says... wiki might be wrong, but the source code can't be. Someone should probably correct the wiki?
Morgan 5 月 28 日 上午 4:40 
Buddy, I wasn't talking about your mod, I was correcting 1 mistake you made when describing how vanilla AP worked, according to the official wiki.
Which does (basically) work as: damage = (ap/2 if <= def) or damage = (def if ap > def)
Xetaxheb  [作者] 5 月 25 日 上午 7:43 
and for posterity, this mod basically just makes everything into:

checkArmorPenetration(apen) {
if (OptionBetterApen == true) { return apen; } else { return apen / 2; }
}

so your def is completely irrelevant, you just gain flat damage per (or per/2) apen
Xetaxheb  [作者] 5 月 25 日 上午 7:38 
and in fact i just went and looked at current vanilla, bug has been fixed (simplified code slightly)

checkArmorPenetration(apen) {
if (ichor)
----apen+=15
if (apen <= 0 || def <= 0)
----return 0
if (apen > def)
----return def / 2
return apen / 2
}

except this introduces a new bug where you do LESS damage if defense is negative... but i assume defense is bounded to min 0 elsewhere now (or in tml at the very least, but again it wasn't at the time)

but at the time and in 1.3, the code was more like

checkArmorPenetration(apen) {
if (apen <= 0)
----return 0
if (apen > defense && def >= 0)
----return def / 2
return apen / 2
}

and ichor added a negative value directly as an applied debuff with no bounding (so def could be come negative)

so if you had any negative defense, you bypassed the 2nd if statement and returned half of apen to the "damage=damage+checkArmorPenetration(apen)" statement
and Terraria.NPC.Defense was a signed int so nothing stopped it from being negative
Xetaxheb  [作者] 5 月 25 日 上午 7:11 
you've misunderstood. I was talking about what this mod does, effectively making apen function as a flat damage boost ignoring the apen>defense waste scenario. additionally, this mod by default makes apen add +1damage/apen instead of +0.5damage/apen.

so you gain apen*1 damage per hit. and in "most-op-benefit" scenario that amounts to stacking apen and using the least-damage weapon in the game you're basically increasing dps like 300% with this mod vs a 0 defense enemy (using a wooden sword), is what was being said.

separately I was also mentioning how, at the time and probably still, the poorly written code for vanilla and tml apen had a bug where if the enemy had negative defense then apen would apply full bonus effect even though it should apply 0. since then, i believe tml has hard-bounded defense to a minimum 0 and damage/hit to a minimum 1, but these checks weren't in at the time.
Xetaxheb  [作者] 5 月 25 日 上午 7:10 
your number 11ap is incorrect? it would still be 5.5 internally at the time aka 5.5 damage. "def+1 cap" wasn't a thing at the time, sounds like common misinformation. apen was added to damage directly, after subtracting enemy defense from it. it didn't interact with defense directly at all besides that. and to illustrate my point of what the bug was:
1000 AP & 4 Def = 2 damage
1000 AP & 0 Def = 0 damage
1000 AP & -1 Def = 1001 damage


and with this mod:
4 AP & any Def = 2 Damage
10 AP & any Def = 5 Damage
12 AP & any Def = 6 Damage
1000 AP & any Def = 500 Damage
or double those damage numbers with the (by default on) toggle setting.
it strips out any "capped by low defense" code.
Morgan 5 月 24 日 下午 10:43 
[Even best case scenario with def/2 scaling, you're what-- doubling the damage of a wooden sword with necklace and sharpening station? Versus an enemy that has 0 defense?]

Slight correction, you get no bonus damage. Vanilla AP can only increase your damage up to equal with the enemy's defence.
If AP is less than enemy Defence, you get bonus damage equal to half the AP'd Defence.
If AP is the same as enemy Defence, you get the same bonus.
If AP is above enemy Defence, you get bonus damage equal to their defence.

5 AP & 10 Def = 2.5 Damage
10 AP & 10 Def = 5 Damage
11 AP & 10 Def = 10 Damage
1000 AP & 0 Def = 0 Damage

This is according to the wiki though, and I've always felt like this is off, since all AP beyond Def+1 is completely useless.
Xetaxheb  [作者] 2023 年 3 月 14 日 下午 3:01 
Addendum, read last =p
I actually hadn't read the wiki on it before, and didn't notice it applied independent to ichor, so vanilla/tml is even more dumb in it's handling since tl;dr normally your apen is limited by enemy armor, ichor applies full damage boost regardless even though logically for consistency it shouldn't.. so you're double dipping against their defense instead of adding ichor as "more apen".
Xetaxheb  [作者] 2023 年 3 月 14 日 下午 2:56 
I'm fully aware of how defense penetration works since... y'know.. I had to get into it's code to change it ? lmao

My fix does exactly what it's intended to, if you think it's "unbalanced and uninteresting" then... don't use it? I think a fixed damage increase is an interesting idea especially with regards to how armor works.

You're also just wrong about "defense penetration is actually pretty simple". Defense penetration works like this:
If you have 0 or less than 0, it does nothing. This is -wrong- and -broken-. This allows for negative armor pen.
Otherwise, if you have an amount larger than the enemy defense AND the enemy has 0 or greater defense then it adds damage equal to defense / 2. This is also -wrong- and -broken- and I'll explain why below.
Otherwise it returns your armor pen / 2, this is also -wrong- and -broken-.
Xetaxheb  [作者] 2023 年 3 月 14 日 下午 2:53 
First of all, if you're using a mod that changes how defense applies like my better enemy defense (https://psteamcommunity.yuanyoumao.com/sharedfiles/filedetails/?id=2843165269) mod (or my better pvp defense mods, or if enemies had armor penetration and you were using my customdefenses [aka player defense scaling] mod) then this value of / 2 would be incorrect for the relevant amount of penetration. I should probably actually make this customizable in this mod even, but for now it has 1:1 or 2:1 and i'm fine with that.
Xetaxheb  [作者] 2023 年 3 月 14 日 下午 2:53 
Secondly, even without mods that change defense scaling, if you had some effect that lowered enemy defense below 0 somehow, then you would get the full (half) value of armor pen applied anyway because of how it's coded, which is a bug. Aka if you had any effect that took an enemy from 0 defense (gaining 0 damage from armor pen) to -1 defense then you suddenly gain armorpen/2 damage. Vanilla Ichor debuff is coded to only reduce down to 0 but other ones could be different. (also shoutout to damage resist that is separate from defense and pen doesn't apply to ¯\_(?)_/¯)
Xetaxheb  [作者] 2023 年 3 月 14 日 下午 2:53 
Thirdly, there's so few 0 defense enemies let alone sources of armor pen that this would make that much of a significant difference on to be considered overpowered. Even best case scenario with def/2 scaling, you're what-- doubling the damage of a wooden sword with necklace and sharpening station? Versus an enemy that has 0 defense?

Last but not least: If you don't like it then don't use it? What's interesting to me doesn't have to be interesting to you. I think having a completely useless accessory just because the enemy has low defense to be uninteresting. Likewise I think the defense system as implemented is uninteresting and boring. So I made changes. It's a mod, nobody is forcing you to use it.
Terrorman 2023 年 3 月 11 日 下午 10:20 
Defense penetration is actually pretty simple. The amount of armor penetration is how many enemy defense points are ignored. The wiki just explains it in a pointlessly complicated & confusing way. Your "fix" actually just makes it unbalanced & uninteresting by turning armor penetration into a fixed damage increase.