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"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<Authors>Asriel Camora</Authors> <Authors>Asriel Camora</Authors>
<Version>2.4.3.0</Version> <Version>2.4.2.0</Version>
<PackageProjectUrl>https://github.com/WorkingRobot/craftimizer.git</PackageProjectUrl> <PackageProjectUrl>https://github.com/WorkingRobot/craftimizer.git</PackageProjectUrl>
<Configurations>Debug;Release</Configurations> <Configurations>Debug;Release</Configurations>
</PropertyGroup> </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.ReduceCP(CPCost(s));
s.ReduceDurability(DurabilityCost); s.ReduceDurability(DurabilityCost);
if (s.Durability > 0)
{
if (s.HasEffect(EffectType.Manipulation))
s.RestoreDurability(5);
}
if (IncreasesStepCount) if (IncreasesStepCount)
{
if (s.Durability > 0)
if (s.HasEffect(EffectType.Manipulation))
s.RestoreDurability(5);
s.IncreaseStepCount(); s.IncreaseStepCount();
s.ActiveEffects.DecrementDuration();
}
s.ActionStates.MutateState(this); s.ActionStates.MutateState(this);
s.ActionCount++; s.ActionCount++;
if (IncreasesStepCount)
s.ActiveEffects.DecrementDuration();
} }
public virtual void UseSuccess(Simulator s) public virtual void UseSuccess(Simulator s)
+1 -2
View File
@@ -19,7 +19,6 @@ internal sealed class Manipulation() : BaseBuffAction(
s.ActionStates.MutateState(this); s.ActionStates.MutateState(this);
s.ActionCount++; s.ActionCount++;
if (IncreasesStepCount) s.ActiveEffects.DecrementDuration();
s.ActiveEffects.DecrementDuration();
} }
} }