ModEnc is currently in Maintenance Mode: Changes could occur at any given moment, without advance warning.
Difference between revisions of "PercentAtMax"
From ModEnc
(Rewrite) |
Silverwind (talk | contribs) (Clarified how the damage multiplier is calculated, with examples.) |
||
(2 intermediate revisions by one other user not shown) | |||
Line 3: | Line 3: | ||
|files={{Categ|Rules(md).ini}} | |files={{Categ|Rules(md).ini}} | ||
|values=float | |values=float | ||
− | |||
|default=100% | |default=100% | ||
|types={{Categ|Warhead|Warheads}} | |types={{Categ|Warhead|Warheads}} | ||
− | | | + | |ra2=yes |
+ | |yr=yes | ||
+ | |rp=yes | ||
}} | }} | ||
− | This tag defines the multiplier to | + | This tag defines the multiplier to damage at the far-end of a [[Warhead]]'s [[CellSpread]]. For objects in between the point of impact, and the CellSpread, the damage is adjusted linearly using this value. |
+ | |||
+ | == Formula == | ||
+ | To understand how damage is distributed across the cells, refer to the below formula: | ||
+ | |||
+ | M = 1 - (1 - P) × (D / S) | ||
+ | |||
+ | ; where, | ||
+ | : M is the multiplier to damage. This is the value used to adjust the final damage. | ||
+ | : P is PercentAtMax | ||
+ | : S is CellSpread | ||
+ | : D is the distance between the object and the center of impact, in cells. | ||
+ | |||
+ | |||
+ | == Examples == | ||
+ | |||
+ | Let's say there are 4 units around the target area - A is at the dead center of impact, B is 1 cell away, C is 3 cells away, and D is 5 cells away. | ||
+ | [Warhead1] | ||
+ | CellSpread=5.0 | ||
+ | PercentAtMax=1.0 | ||
+ | |||
+ | In this instance, using the above formula gives us a multiplier of 100% for A, B, C, and D. | ||
+ | |||
+ | Now take the same 4 units, and the warhead below: | ||
+ | [Warhead2] | ||
+ | CellSpread=7.0 | ||
+ | PercentAtMax=0.02</code> | ||
+ | |||
+ | ; Using the above formula gives us: | ||
+ | : A would still receive (1 - ( 1 - 0.02) * (0 / 7)) = 100% of the damage | ||
+ | : B would receive (1 - ( 1 - 0.02) * (1 / 7)) = 86% of the damage | ||
+ | : C would receive (1 - ( 1 - 0.02) * (3 / 7)) = 58% of the damage | ||
+ | : D would receive (1 - ( 1 - 0.02) * (5 / 7)) = 30% of the damage | ||
+ | : and of course, a unit standing exactly 7 cells away from impact would receive (1 - ( 1 - 0.02) * (7 / 7)) = 2% of the damage | ||
+ | |||
+ | |||
+ | |||
+ | ''See also: [[Damage calculation over area]]'' |
Latest revision as of 14:43, 11 September 2020
Flag: | PercentAtMax |
File(s): | Rules(md).ini |
Values: | float |
Default: | 100% |
Applicable to: | Warheads |
This tag defines the multiplier to damage at the far-end of a Warhead's CellSpread. For objects in between the point of impact, and the CellSpread, the damage is adjusted linearly using this value.
Formula
To understand how damage is distributed across the cells, refer to the below formula:
M = 1 - (1 - P) × (D / S)
- where,
- M is the multiplier to damage. This is the value used to adjust the final damage.
- P is PercentAtMax
- S is CellSpread
- D is the distance between the object and the center of impact, in cells.
Examples
Let's say there are 4 units around the target area - A is at the dead center of impact, B is 1 cell away, C is 3 cells away, and D is 5 cells away.
[Warhead1] CellSpread=5.0 PercentAtMax=1.0
In this instance, using the above formula gives us a multiplier of 100% for A, B, C, and D.
Now take the same 4 units, and the warhead below:
[Warhead2] CellSpread=7.0 PercentAtMax=0.02</code>
- Using the above formula gives us
- A would still receive (1 - ( 1 - 0.02) * (0 / 7)) = 100% of the damage
- B would receive (1 - ( 1 - 0.02) * (1 / 7)) = 86% of the damage
- C would receive (1 - ( 1 - 0.02) * (3 / 7)) = 58% of the damage
- D would receive (1 - ( 1 - 0.02) * (5 / 7)) = 30% of the damage
- and of course, a unit standing exactly 7 cells away from impact would receive (1 - ( 1 - 0.02) * (7 / 7)) = 2% of the damage