Hello everyone!

Many of you have seen things like "webwear" that give our agents extra resistance against any type of damage.

"This ultra-light shirt made of Giant Spider silk can be worn under most armors. It works when kept in the backpack. Reduces the effects of Kinetic damage taken by 1/5, to a maximum Resistance of 50%. Concealable"It can be seen from the description that the shirt reduces incoming damage by 1/5, but the total resistance (including armor) cannot exceed 50%.

If we pay a little attention to this, we will notice that in fact the shirt does not do this, because the current formula, used in xPiratez, is unnecessarily complicated.

Let's take a look at this formula:

` # CURRENT RES = CURRENT RES - ((1 - ITEM RES) * (CURRENT RES - ITEM ZERO POINT))`

# Only set resistance if better than current tag

if and neq temp 0 lt itemResistMinimum temp;

set currentResistance temp;

set oneMinusResistance 100;

sub temp itemResistMinimum;

sub oneMinusResistance itemResistCoeff;

muldiv temp oneMinusResistance 100;

sub currentResistance temp;

itemOwner.setTag Tag.UNIT_RESIST_TYPE_1 currentResistance;

end;

Where:

CURRENT RES - currentResistance - the resistance of our armor.

ITEM RES - itemResistCoeff - item resistance (1/5 is 80% = 0.8 ).

ITEM ZERO POINT - itemResistMinimum - item resistance limit (50% = 0.5).

If we calculate our webwear for normal resistance (100% = 1) using this formula, we get the following:

CURRENT RES = 1 - (1 - 0.8 ) * (1 - 0.5) = 1 - 0.2 * 0.5 = 0.9 (90%).

The main question is, how did our 20% resistance turn into 10% under absolutely normal conditions and, most importantly, why? Of course, the point is "(CURRENT RES - ITEM ZERO POINT)", where we set as zero resistance value the minimum resistance of the thing, but not full immunity to damage(standard 0% in game).

I propose to change the formula so that if it is written 1/5, then exactly 1/5 of the current resistance is always given. These are 20% at 100%, 12% at 60%, etc. *. The new formula will look like this (much simpler and clearer):

CURRENT RES = ITEM RES * CURRENT RES = 1 * 0.8 = 0.8 (80%).

And for armor with 70% resistance - 0.7 * 0.8 = 0.56 (56%).

After that, we just do a check so that we do not get out of our 50%.

` # Only set resistance if better than current tag (Relative resistance)`

if and neq temp 0 lt itemResistMinimum temp;

set currentResistance temp;

muldiv currentResistance itemResistCoeff 100;

if lt currentResistance itemResistMinimum;

set currentResistance itemResistMinimum;

end;

itemOwner.setTag Tag.UNIT_RESIST_TYPE_1 currentResistance;

end;

Need the opinion of other players whether such a change needs to be made. However, I personally think that it is much better when everything works exactly as it looks, as convenient and simple as possible for the players. Moreover, when Solarius Scorch adds new things of this kind, he will not have to puzzle over why the thing is not working correctly and how to do it right.

Good luck to all and Happy New Year!