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

Armor values different from Exile 3 #245

Closed
x-qq opened this issue Jan 28, 2020 · 10 comments · Fixed by #590
Closed

Armor values different from Exile 3 #245

x-qq opened this issue Jan 28, 2020 · 10 comments · Fixed by #590
Labels
bug resources Specific to the game's assets and resources

Comments

@x-qq
Copy link
Contributor

x-qq commented Jan 28, 2020

Exile 3 shirt: defend 1

e3

Openboe shirt: defend 0

nope

@x-qq
Copy link
Contributor Author

x-qq commented Feb 3, 2020

Original windows BoE: defend 0

origboe

Looks like there was a nerf of shirts between E3 and BoE.

@CelticMinstrel
Copy link
Member

This is one of the areas where I think it's fine to depart from the original BoE and treat it as fixing a bug from the original game.

If only it were easy to come up with an actual list of these differences…

@CelticMinstrel CelticMinstrel added bug resources Specific to the game's assets and resources labels Feb 14, 2020
@josefwk
Copy link
Contributor

josefwk commented Feb 5, 2025

There are several different issues at play here.

  1. In the item info screen, Exile III shows different item stats than Blades of Exile and OpenBoE. Defend 1 versus Defend 0, as shown at the beginning of this bug report.

  2. On the item pickup screen, Exile III and OpenBoE show different item stats than Blades of Exile. Blocks 1-1 damage versus Blocks 0-0 damage. In this case, OpenBoE is actually more correct than the original game in how it displays item stats on pickup.

Exile III:
Image

OpenBoE:
Image

Blades of Exile:
Image

  1. In Blades of Exile, Shirts still block 1 damage despite showing Defend 0 and Blocks 0-0 damage. Just a note that the original game had a discrepancy between reported defense versus calculated defense. I tested this with a 5d1 physical damage special where, with all else being equal, wearing a Shirt protected the wearer from 1 damage (expected 0).

Before taking damage:
Image

After taking damage:
Image

  1. In Blades of Exile and OpenBoE (using OpenBoE code here as the example), the reason that an equipped Shirt protects the wearer from 1 damage is because it of type armor, and equipped armor that has Defend (internally referred to as item_level) less than 1 is treated as equivalent to 1 during damage calculation. In boe.party.cpp, within the damage_pc() function, we see this line:
short defense = get_ran(1,1,item.item_level);

And in the mathutil.cpp function, we have the following relevant lines of code for get_ran():

short get_ran (short times,short min,short max, bool use_unique_ran){
        ...
	if(max < min) max = min;
	if(max == min) return times * min;
        ...

For the Shirt, it is essentially calling get_ran(1, 1, 0) where min is 1 and max is 0; since max is less than min, max becomes 1, and 1 is returned for defense. Note that, at least in the base game, the only items that this issue affects are Shirts. Pants are not affected because they are of type pants rather than armor, and no other armor item has a Defend (item_level) less than 1 aside from Shirts. It appears that the protection attribute is where negative modifiers to damage protection are calculated (e.g. for Feldspar Charm).

The implications of this are that a Shirt has the same defensive value as a Leather Baldric, and is better than a Crude Buckler (due to both encumbrance and weight). I believe that changing the code here (to where get_ran is called with min set to 0 rather than 1) would make sense, as it will not affect any other base game item and will align player/creator expectations with what is happening in the game engine.

@NQNStudios
Copy link
Collaborator

Are other armor types intended to always block at least 1 damage? If so, then I think it would be better to treat armor level 0 as a special case which doesn't call get_ran(), and the other armors keep 1 as the minimum. And if the UI currently says they block 0-x damage then we should change those to say 1-x damage.

I'm not the right person to be making calls about game balance, though. I have no credentials for RPG combat design or tuning.

No matter how we fix this, we should do it with a feature flag (I'll implement those asap) so that old replays can keep their dice rolls the same.

@josefwk
Copy link
Contributor

josefwk commented Feb 5, 2025

You're right, my mistake. I think armor is expected to always block at least 1 damage. Adding a conditional check for item_level > 0 would be the right approach here, and this is already done for the item bonus and protection values as well. Would want to make sure that the correct values are displayed on the item pickup screen as well.

@NQNStudios
Copy link
Collaborator

I greatly appreciate you looking into to this and doing the hard part (figuring it out)!

@NQNStudios
Copy link
Collaborator

NQNStudios commented Feb 5, 2025

A way to fix this and PR without waiting for feature flags, would be to add the conditional and make it return 0 for 0 armor level, but still call get_ran(), just dropping the value.

We have a replay system which relies on keeping seeded randomness the same between versions of the game. If we add or remove a dice-roll, combat in replays diverges greatly.

@NQNStudios NQNStudios self-assigned this Feb 7, 2025
@NQNStudios
Copy link
Collaborator

Assigning myself to fix the shirt defense bug. If we need to go further and find/fix more discrepancies, I don't really know how.

@NQNStudios
Copy link
Collaborator

Reading back through this issue, I'm seeing that the core problem is the handling of armor value 0 and displaying how much damage it will block. So I will consider it fixed just by handling those things.

@josefwk
Copy link
Contributor

josefwk commented Feb 9, 2025

Agreed. The issue isn't specific to Shirts, it's just the most obvious example. Other items affected include the Glue Gauntlets and the Magician's Hat, not to mention items in custom scenarios. Your changes should resolve the issue.

CelticMinstrel pushed a commit that referenced this issue Feb 9, 2025
Armor items with item level 0, will have a base defense value of 0 instead of 1, and display their defense value as such in the get items screen.

Fix #245
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug resources Specific to the game's assets and resources
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants