Files
@ dd8780bb11c5
Branch filter:
Location: ATITD-Tools/Desert-Paint-Codex/Models/Reagent.cs - annotation
dd8780bb11c5
1.7 KiB
text/x-csharp
Correct an error when computing the clipped value on white shifts. It was incorrectly detecting a white shift on single-color clips, resulting in a bad reaction computation. Also don't display the wrong 'observed' color after clearing a reaction.
40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 6919080271d5 6919080271d5 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 6919080271d5 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 6919080271d5 40eaee10ae56 40eaee10ae56 6919080271d5 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 6919080271d5 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 | using System;
namespace DesertPaintCodex.Models
{
public class Reagent
{
private uint _cost;
private uint _recipeMax = 10;
public bool IsCatalyst { get; }
public PaintColor? Color { get; }
public string Name { get; }
public string PracticalPaintName { get; }
public bool Enabled { get; set; }
public int Index { get; private set; }
public uint Cost
{
get => _cost;
set => _cost = Math.Max(1, value);
}
public uint RecipeMax
{
get => _recipeMax;
set
{
if (!IsCatalyst)
{
_recipeMax = Math.Max(0, value);
}
}
}
// catalyst
public Reagent(string name, string ppName, int index)
{
Name = name;
PracticalPaintName = ppName;
Cost = 2;
Enabled = true;
RecipeMax = 1;
IsCatalyst = true;
Index = index;
}
public Reagent(string name, string ppName, byte red, byte green, byte blue, int index)
{
Color = new PaintColor(red, green, blue);
Name = name;
PracticalPaintName = ppName;
Cost = 1;
RecipeMax = 10;
Enabled = true;
IsCatalyst = false;
Index = index;
}
public override string ToString()
{
if (IsCatalyst)
{
return "[" + Name + ", catalyst]";
}
else
{
return "[" + Name + ", " + Color + "]";
}
}
}
}
|