Skip to content

AbsentChance

Namespace Nfty.Core.Editing in assembly Nfty.Core.

public static class AbsentChance

Authoring for a recipe's optional layers: how often each one is left out entirely. Pure, like RuleEdits and LayerDepth beside it — every method returns a NEW RecipeManifest and mutates nothing.

Methods

ClearAll(RecipeManifest)

public static RecipeManifest ClearAll(RecipeManifest recipe);

Clears every optional-layer chance, so every layer always appears.

Parameters

  • recipe (RecipeManifest) - The recipe to edit.

Returns. A new manifest with no chances at all.

Remarks

This is what the GUI's "optional layers" toggle does when it is turned OFF, and it is destructive by design: the toggle is DERIVED from the data rather than stored beside it, so "off" cannot be a flag that contradicts a chance sitting underneath it. There is nothing for the two to disagree about because there is only one of them.

Set(RecipeManifest, string, double)

public static RecipeManifest Set(RecipeManifest recipe, string ingredientId, double percent);

Sets how often a layer is left out.

Parameters

  • recipe (RecipeManifest) - The recipe to edit.
  • ingredientId (string) - The layer. Must be one this recipe stacks — a chance for a layer it does not is almost certainly one meant for a layer it does, and it would sit in the manifest doing nothing while the author believed their chase item was rare.
  • percent (double) - 0..100. Zero always appears; 100 never does, which shelves the layer without deleting it, the same meaning a recipe weight of zero already carries.

Returns. A new manifest.

Exceptions

  • ArgumentException - The layer is not in this recipe.
  • ArgumentOutOfRangeException - The percent is not a finite 0..100.