-
Notifications
You must be signed in to change notification settings - Fork 12
Injuries
Current player injuries are available via Status.ActiveInjuries property of HealthController. To check if injury is active right now, call
Status.HasActive<T>
i.e.
Status.HasActive<Fracture>
To check if injury is active or will be activated later, call
Status.HasActiveOrScheduled<T>
i.e.
Status.HasActiveOrScheduled<Fracture>
To get active injury (will return ActiveInjury instance), call GetActive; or to get injury that is active now or will be activated later, call GetActiveOfScheduled method.
All injuries are descendants from InjuryBase abstract class declared in ZaraEngine.Injuries namespace.
Injuries are very similar to diseases. They also can contain up to 4 stages, they also have fluent language through InjuryStageBuilder class and have chain inversion logic. But they do not have monitors and invert-back abilities.
Injuries are very simple. They are treated by appliances (bandages, sponges, splints, etc.), and injury treatment can be described via ToolsOnlyInjuryTreatment class.
This class accepts an array of tools names or combinations of tools names and MedicalAppliancesGroup instances, in order they should be applied.
Like MedicalConsumablesGroup, MedicalAppliancesGroup describes items that can be treated as same appliance (like AntisepticSponge and Ash in AntisepticGroup).
After that, its OnApplianceTaken method should be passed to WithTreatmentAction method of injury stage Treatment fluent node:
_initialStageTreatment = new ToolsOnlyInjuryTreatment(MedicalAppliancesGroup.AntisepticGroup, InventoryController.MedicalItems.Bandage);
...
.Treatment
.WithTreatmentAction(initialStageTreatment.OnApplianceTaken)
This code means that this injury stage should be treated by applying AntisepticSponge, and then, in a margin of 10 game minutes, Bandage should be applied. After that injury will be declared healed.
Every injury applies to a specific body part (ZaraEngine.Player.BodyParts enum) and have ability to trigger any disease on any stage with some probability (for example DeepCut injury can trigger BloodPoisoning disease on Worrying stage with 35% chance).
If triggering disease requires body part, body part for disease will be passed from "parent" injury.
If needed tool applied to a body part that is different from the one that was described in ActiveInjury, ToolsOnlyInjuryTreatment will not "count" this tool as a treatment action for this injury.
Injury can be very light and can heal itself in a given time. Like a LightCut injury that consists only of one stage that will be healed without user interaction, in one hour:
InjuryStageBuilder.NewStage().WithLevelOfSeriousness(DiseaseLevels.InitialStage)
.NoDescription()
.Cut()
.WillLastForHours(1)
.WillSelfHealInHours(1)
.Drains
.BloodPerSecond(0.001f)
.WillNotAffectControls()
.NoTreatment()
.Build()
};
Injury by itself can affect only player's Blood Level. If bandage is applied to a particular body part, health engine will not count blood loss caused by injuries "under the bandage".
Player can have more than one injury. In this case, injury effects are being combined.