Don't tick Manipulation when action doesn't increase step count
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -69,20 +69,19 @@ public abstract class BaseAction(
|
||||
s.ReduceCP(CPCost(s));
|
||||
s.ReduceDurability(DurabilityCost);
|
||||
|
||||
if (s.Durability > 0)
|
||||
if (IncreasesStepCount)
|
||||
{
|
||||
if (s.Durability > 0)
|
||||
if (s.HasEffect(EffectType.Manipulation))
|
||||
s.RestoreDurability(5);
|
||||
}
|
||||
|
||||
if (IncreasesStepCount)
|
||||
s.IncreaseStepCount();
|
||||
|
||||
s.ActiveEffects.DecrementDuration();
|
||||
}
|
||||
|
||||
s.ActionStates.MutateState(this);
|
||||
s.ActionCount++;
|
||||
|
||||
if (IncreasesStepCount)
|
||||
s.ActiveEffects.DecrementDuration();
|
||||
}
|
||||
|
||||
public virtual void UseSuccess(Simulator s)
|
||||
|
||||
@@ -19,7 +19,6 @@ internal sealed class Manipulation() : BaseBuffAction(
|
||||
s.ActionStates.MutateState(this);
|
||||
s.ActionCount++;
|
||||
|
||||
if (IncreasesStepCount)
|
||||
s.ActiveEffects.DecrementDuration();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user