Skip to content

Appliances (injections) Treatment

Vadim Gromov edited this page Dec 30, 2020 · 5 revisions

Treatment with single type of appliance

To describe disease treatment by a single type of appliance (like SyringeOfAntiVenom), ApplianceTimedTreatment class is used. It takes level of seriousness that will be treated by this instance, body part, appliance name (commonly, from InventoryController.MedicalItems), timing and count from a constructor. If appliance should be taken only once, you can omit two last parameters. For example:

new ApplianceTimedTreatment(DiseaseLevels.InitialStage, null, InventoryController.MedicalItems.SyrinveOfEpinephrine, 60, 3)

This code example means that to treat this stage, player needs to apply SyrinveOfEpinephrine every 60 game minutes (plus-minus 20 minutes margin) 3 times. If body part is not set, every given appliance applying will count. If body part is set, appliance must be applied to a given body part in order to count. If appliance should be applied only once, you can omit two last parameters.

// Suction Pump appliance with a specific body part 
new ApplianceTimedTreatment(bodyPart, InventoryController.MedicalItems.SuctionPump)
// Syringe of Anti-Venom anywhere
new ApplianceTimedTreatment(null, InventoryController.MedicalItems.AntiVenomSyringe, 60, 2)

Treatment with multiple types of appliances

To describe treatment that includes mix of a different types of "pills", ApplianceTimedTreatmentNode class is used. This class takes level of seriousness that will be treated by this instance, an array of ApplianceTimedTreatment instances in a constructor, and will declare disease as healed only if all of ApplianceTimedTreatment rules are satisfied.
Notice that for ApplianceTimedTreatment in this case level of seriousness is not passed, all ApplianceTimedTreatment instances will inherit it from parent ApplianceTimedTreatmentNode. For example, this code describes treatment with SuctionPump and SyringeOfAntiVenom the a same time:

_worryingStageTreatment = new ApplianceTimedTreatmentNode(
    new ApplianceTimedTreatment(bodyPart, InventoryController.MedicalItems.SuctionPump),
    new ApplianceTimedTreatment(null, InventoryController.MedicalItems.AntiVenomSyringe, 60, 2)
);

This code example means that to treat this stage, player should use SuctionPump tool on a body part that caused blood poisoning, and then make anti-venom injection anywhere -- two times, second time 60 minutes later.

No matter, what class will you use, you should pass its OnApplianceTaken method to a WithAppliance method of a Treatment fluent node.

.Treatment
    .WithAppliance(_worryingStageTreatment.OnApplianceTaken)
...

Then on OnResumeDisease override method of your disease class you should reset all the treatment nodes:

public override void OnResumeDisease()
{
    _initialStageTreatment.Reset();
    _progressingStageTreatment.Reset();
    _worryingStageTreatment.Reset();
    _criticalingStageTreatment.Reset();
...

And on Check override method you should call Check method of all your treatment nodes:

public override void Check(ActiveDisease disease, IGameController gc)
{
    _initialStageTreatment.Check(disease, gc);
    _progressingStageTreatment.Check(disease, gc);
    _worryingStageTreatment.Check(disease, gc);
    _criticalingStageTreatment.Check(disease, gc);
...
Clone this wiki locally