Class DurabilityBehaviour
- Namespace
- GrindFest
- Assembly
- GrindFest.dll
[DisallowMultipleComponent]
public class DurabilityBehaviour : MonoBehaviour
- Inheritance
-
objectDurabilityBehaviour
Fields
- BaseMaxDurability
The authored value, and the one an item should carry: how much damage this item can take part in before it breaks, at level 1 and rank None. Authored instead of MaxDurability because the resolved value follows the item's level and rank - so it must not be written back (a repair that wrote the resolved value would bake this level's ceiling in forever).
- WorkDamage
What one use of a tool is worth when nothing measures the work it did - a dig, a cast, a mining swing.
Properties
- IsFragile
A
0pool: destroyed by the first impact.
- IsIndestructible
The two states that are not amounts, named once so that no caller has to know the sentinels.
- MaxDurability
What this item can take, in damage: BaseMaxDurability scaled by its level and by the rank it rolled when it dropped, the same way damage is scaled (
BaseMinDamage * sqrt(level) * quality).The number is literally how much damage the item can still take part in - a weapon spends it on what it deals, armour on what it takes, a shield on what it stops. One point is one damage, deliberately: a coarser unit (a point per 10 damage) was tried first and bought nothing but a factor to explain, and it needed a floor of 1 that made small blows cost more than they were worth.
Methods
- Damage(int, GameObject)
Spend
damageof this item's durability - the amount is damage, not a special unit, because one point of durability is one point of damage. Every caller measures its blow the same way: a weapon is charged what it dealt, armour what it took, a shield what it stopped (all three fromCombatBehaviour.ChargeDurability, which is the single place that decides). Tools and thrown items charge themselves directly (one per use, or the throw's own damage).