What is the deal with Min/MaxDamage?

StaticHex

Citizen
Jul 21, 2020
22
15
3
35
Houston, Texas
www.ultima.teragentech.net
Shard Name
Phantom Realms
Donate
Donate money to this user
I hope I didn't post this in the wrong place; I kind of waffled between this and script support but decided on here as I'm not actually needing help with anything and this is more of just a generally curious thing. I'm wondering why Min/MaxDamage on weapons was made so hard to modify dynamically.

What I mean by that is at least from what I can tell, there's no way to change a weapon's base Min/Max damage directly outside of Bonus Damage (same thing with swing speed and anything else defined as a virtual property in BaseWeapon.cs). Also, it looks like great care has been taking to prevent users from setting these properties aside from manually overriding the properties. Additionally, it would have been very easy to make these (and all the other virtual properties for that matter) editable by doing
C#:
public virtual <T> propName {get; set;} = 0
instead of
C#:
public virtual <T> propName => 0
Additionally, pretty much everything else dealing with weapons including crafting sort of forces the user to use the WeaponAttribute for bonus damage vs. setting the value directly.

the tl;dr takeaway here is that too much seems put into place for this to be a simple oversight. I've recently been thinking about boosting some of the caps for BonusDamage, WeaponSpeed, etc. as it seems like a lot less work than trying to restructure half the code base just to allow me to make OP gear. But then that got me thinking that if this was so intentionally done there might be a reason for it.

So, that leads me to the title of What's the deal with Min/Max damage? Is it locked down to prevent serialization errors or to prevent math errors/instability from trying to boost damage through the roof? or is there something else going on? I'm still only about 60% sure this belongs here so if this is more of a script support question I apologize for posting in the wrong section.
 

Vorspire

Vita-Nex: Core
Admin
ServUO Developer
Jul 29, 2013
1,171
277
83
33
United Kingdom
core.vita-nex.com
Shard Name
Ultima Shards: Multiverse
Donate
Donate money to this user
You need to set "MinimumDamage and "MaximumDamage", which are both -1 by default to represent the fact that they should fall-back to "MinDamage" and "MaxDamage" defaults.

Same can be said for "WeaponSpeed", which is the mutable property that falls-back to "Speed" in the same way.
 

StaticHex

Citizen
Jul 21, 2020
22
15
3
35
Houston, Texas
www.ultima.teragentech.net
Shard Name
Phantom Realms
Donate
Donate money to this user
Ok so that's kind of my question. Why are there two separate values for a lot of these virtual fields vs. setting them directly? Like why is there both MinDamage and MinimumDamage for example? It seems like it would be much more clear to just use one or the other directly. I will also admit that C# is like 3rd or 4th on my list of languages I'm proficient in so there could be some reason this is necessary. Especially considering virtual fields/methods can get dicey especially when trying to pull off polymorphism so if there's something I'm missing I hope you'll have patience as I'm just trying to understand how everything fits together.

Also, on the grounds of the MinimumDamage field; it doesn't look like setting that really does anything. I'm basing that off of in BaseWeapon.cs I see this function:
C#:
        public virtual void GetStatusDamage(Mobile from, out int min, out int max)
        {
            int baseMin, baseMax;

            GetBaseDamageRange(from, out baseMin, out baseMax);

            min = Math.Max((int)ScaleDamageAOS(from, baseMin, false), 1);
            max = Math.Max((int)ScaleDamageAOS(from, baseMax, false), 1);
        }
Which, inside the GetBaseDamageRange method I see a block which looks like the following:
C#:
            if (this is Fists && TransformationSpellHelper.UnderTransformation(attacker, typeof(HorrificBeastSpell)))
            {
                min = 5;
                max = 15;
            }
            else
            {
                min = MinDamage;
                max = MaxDamage;
            }
Which looks like it's the block responsible for updating weapon damage and which also looks like it completely bypasses MinimumDamage and MaximumDamage entirely; at least based on the fact that when I changed the above to:
C#:
            if (this is Fists && TransformationSpellHelper.UnderTransformation(attacker, typeof(HorrificBeastSpell)))
            {
                min = 5;
                max = 15;
            }
            else
            {
                min = MinimumDamage;
                max = MaximumDamage;
            }
I was able to update the damage the weapon actually did. Although the weapon status still showed the original values for some reason (presumably those are set somewhere else or possibly need to do a packet interception or something); am I missing something though?" I ran both grep -rI "MinimumDamage" and grep -rI "MinDamage" in the ServUO directory and looked around for other places which might be responsible for setting damage but this is the only place I found.