Don't tick Manipulation when action doesn't increase step count

This commit is contained in:
Asriel Camora
2024-06-19 23:12:30 -07:00
parent 1cbcc77643
commit 06e0ecf209
4 changed files with 11 additions and 35 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Authors>Asriel Camora</Authors>
<Version>2.4.3.0</Version>
<Version>2.4.2.0</Version>
<PackageProjectUrl>https://github.com/WorkingRobot/craftimizer.git</PackageProjectUrl>
<Configurations>Debug;Release</Configurations>
</PropertyGroup>
-22
View File
@@ -1,22 +0,0 @@
using Newtonsoft.Json;
using System;
namespace Craftimizer.Utils;
public class PopulateConverter : JsonConverter
{
public override bool CanConvert(Type objectType) =>
objectType.GetConstructor(Type.EmptyTypes) != null;
public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer)
{
existingValue ??= Activator.CreateInstance(objectType) ?? throw new ArgumentException($"Could not create object of type {objectType}", nameof(objectType));
serializer.Populate(reader, existingValue);
return existingValue;
}
public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)
{
serializer.Serialize(writer, value);
}
}
+8 -9
View File
@@ -69,20 +69,19 @@ public abstract class BaseAction(
s.ReduceCP(CPCost(s));
s.ReduceDurability(DurabilityCost);
if (s.Durability > 0)
{
if (s.HasEffect(EffectType.Manipulation))
s.RestoreDurability(5);
}
if (IncreasesStepCount)
{
if (s.Durability > 0)
if (s.HasEffect(EffectType.Manipulation))
s.RestoreDurability(5);
s.IncreaseStepCount();
s.ActiveEffects.DecrementDuration();
}
s.ActionStates.MutateState(this);
s.ActionCount++;
if (IncreasesStepCount)
s.ActiveEffects.DecrementDuration();
}
public virtual void UseSuccess(Simulator s)
+2 -3
View File
@@ -18,8 +18,7 @@ internal sealed class Manipulation() : BaseBuffAction(
s.ActionStates.MutateState(this);
s.ActionCount++;
if (IncreasesStepCount)
s.ActiveEffects.DecrementDuration();
s.ActiveEffects.DecrementDuration();
}
}