Fix macro durations and trained perfection
This commit is contained in:
@@ -317,7 +317,7 @@ internal static class EffectUtils
|
||||
};
|
||||
|
||||
public static bool IsIndefinite(this EffectType me) =>
|
||||
me is EffectType.InnerQuiet or EffectType.HeartAndSoul;
|
||||
me is EffectType.InnerQuiet or EffectType.HeartAndSoul or EffectType.TrainedPerfection;
|
||||
|
||||
public static Status Status(this EffectType me) =>
|
||||
LuminaSheets.StatusSheet.GetRow(me.StatusId())!;
|
||||
|
||||
@@ -587,7 +587,7 @@ public sealed unsafe class SynthHelper : Window, IDisposable
|
||||
MuscleMemory = GetEffectStack((ushort)EffectType.MuscleMemory.StatusId()),
|
||||
Manipulation = GetEffectStack((ushort)EffectType.Manipulation.StatusId()),
|
||||
Expedience = GetEffectStack((ushort)EffectType.Expedience.StatusId()),
|
||||
TrainedPerfection = GetEffectStack((ushort)EffectType.TrainedPerfection.StatusId()),
|
||||
TrainedPerfection = HasEffect((ushort)EffectType.TrainedPerfection.StatusId()),
|
||||
HeartAndSoul = HasEffect((ushort)EffectType.HeartAndSoul.StatusId()),
|
||||
},
|
||||
ActionStates = CurrentActionStates
|
||||
|
||||
@@ -67,7 +67,6 @@ public abstract class BaseAction(
|
||||
UseSuccess(s);
|
||||
|
||||
s.ReduceCP(CPCost(s));
|
||||
if (!s.HasEffect(EffectType.TrainedPerfection))
|
||||
s.ReduceDurability(DurabilityCost);
|
||||
|
||||
if (IncreasesStepCount)
|
||||
|
||||
@@ -2,7 +2,6 @@ namespace Craftimizer.Simulator.Actions;
|
||||
|
||||
internal sealed class ImmaculateMend() : BaseAction(
|
||||
ActionCategory.Durability, 98, 100467,
|
||||
macroWaitTime: 2,
|
||||
durabilityCost: 0,
|
||||
defaultCPCost: 112
|
||||
)
|
||||
|
||||
@@ -8,13 +8,13 @@ internal sealed class IntensiveSynthesis() : BaseAction(
|
||||
)
|
||||
{
|
||||
public override bool CouldUse(Simulator s) =>
|
||||
(s.Condition == Condition.Good || s.Condition == Condition.Excellent || s.HasEffect(EffectType.HeartAndSoul))
|
||||
(s.Condition is Condition.Good or Condition.Excellent || s.HasEffect(EffectType.HeartAndSoul))
|
||||
&& base.CouldUse(s);
|
||||
|
||||
public override void UseSuccess(Simulator s)
|
||||
{
|
||||
base.UseSuccess(s);
|
||||
if (s.Condition != Condition.Good && s.Condition != Condition.Excellent)
|
||||
if (s.Condition is not (Condition.Good or Condition.Excellent))
|
||||
s.RemoveEffect(EffectType.HeartAndSoul);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ namespace Craftimizer.Simulator.Actions;
|
||||
|
||||
internal sealed class MastersMend() : BaseAction(
|
||||
ActionCategory.Durability, 7, 100003,
|
||||
macroWaitTime: 2,
|
||||
durabilityCost: 0,
|
||||
defaultCPCost: 88
|
||||
)
|
||||
|
||||
@@ -8,14 +8,14 @@ internal sealed class PreciseTouch() : BaseAction(
|
||||
)
|
||||
{
|
||||
public override bool CouldUse(Simulator s) =>
|
||||
(s.Condition == Condition.Good || s.Condition == Condition.Excellent || s.HasEffect(EffectType.HeartAndSoul))
|
||||
(s.Condition is Condition.Good or Condition.Excellent || s.HasEffect(EffectType.HeartAndSoul))
|
||||
&& base.CouldUse(s);
|
||||
|
||||
public override void UseSuccess(Simulator s)
|
||||
{
|
||||
base.UseSuccess(s);
|
||||
s.StrengthenEffect(EffectType.InnerQuiet);
|
||||
if (s.Condition != Condition.Good && s.Condition != Condition.Excellent)
|
||||
if (s.Condition is not (Condition.Good or Condition.Excellent))
|
||||
s.RemoveEffect(EffectType.HeartAndSoul);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,4 +10,7 @@ internal sealed class TrainedPerfection() : BaseBuffAction(
|
||||
|
||||
public override bool CouldUse(Simulator s) =>
|
||||
!s.ActionStates.UsedTrainedPerfection;
|
||||
|
||||
public override string GetTooltip(Simulator s, bool addUsability) =>
|
||||
GetBaseTooltip(s, addUsability);
|
||||
}
|
||||
|
||||
@@ -7,13 +7,13 @@ internal sealed class TricksOfTheTrade() : BaseAction(
|
||||
)
|
||||
{
|
||||
public override bool CouldUse(Simulator s) =>
|
||||
(s.Condition == Condition.Good || s.Condition == Condition.Excellent || s.HasEffect(EffectType.HeartAndSoul))
|
||||
(s.Condition is Condition.Good or Condition.Excellent || s.HasEffect(EffectType.HeartAndSoul))
|
||||
&& base.CouldUse(s);
|
||||
|
||||
public override void UseSuccess(Simulator s)
|
||||
{
|
||||
s.RestoreCP(20);
|
||||
if (s.Condition != Condition.Good && s.Condition != Condition.Excellent)
|
||||
if (s.Condition is not (Condition.Good or Condition.Excellent))
|
||||
s.RemoveEffect(EffectType.HeartAndSoul);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-10
@@ -17,7 +17,7 @@ public record struct Effects
|
||||
public byte MuscleMemory;
|
||||
public byte Manipulation;
|
||||
public byte Expedience;
|
||||
public byte TrainedPerfection;
|
||||
public bool TrainedPerfection;
|
||||
public bool HeartAndSoul;
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
@@ -57,7 +57,7 @@ public record struct Effects
|
||||
Expedience = duration;
|
||||
break;
|
||||
case EffectType.TrainedPerfection:
|
||||
TrainedPerfection = duration;
|
||||
TrainedPerfection = duration != 0;
|
||||
break;
|
||||
case EffectType.HeartAndSoul:
|
||||
HeartAndSoul = duration != 0;
|
||||
@@ -87,16 +87,11 @@ public record struct Effects
|
||||
EffectType.MuscleMemory => MuscleMemory,
|
||||
EffectType.Manipulation => Manipulation,
|
||||
EffectType.Expedience => Expedience,
|
||||
EffectType.TrainedPerfection => TrainedPerfection,
|
||||
EffectType.TrainedPerfection => (byte)(TrainedPerfection ? 1 : 0),
|
||||
EffectType.HeartAndSoul => (byte)(HeartAndSoul ? 1 : 0),
|
||||
_ => 0
|
||||
};
|
||||
|
||||
[Pure]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool IsIndefinite(EffectType effect) =>
|
||||
effect is EffectType.InnerQuiet or EffectType.HeartAndSoul;
|
||||
|
||||
[Pure]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public readonly byte GetStrength(EffectType effect) =>
|
||||
@@ -129,7 +124,5 @@ public record struct Effects
|
||||
Manipulation--;
|
||||
if (Expedience > 0)
|
||||
Expedience--;
|
||||
if (TrainedPerfection > 0)
|
||||
TrainedPerfection--;
|
||||
}
|
||||
}
|
||||
|
||||
+12
-3
@@ -183,7 +183,6 @@ public class Simulator
|
||||
Durability = Input.Recipe.MaxDurability;
|
||||
}
|
||||
|
||||
|
||||
public void RestoreCP(int amount)
|
||||
{
|
||||
CP += amount;
|
||||
@@ -200,8 +199,18 @@ public class Simulator
|
||||
return Math.Clamp(successRate, 0, 100);
|
||||
}
|
||||
|
||||
public int CalculateDurabilityCost(int amount)
|
||||
public int CalculateDurabilityCost(int amount, bool dryRun = true)
|
||||
{
|
||||
if (amount == 0)
|
||||
return 0;
|
||||
|
||||
if (HasEffect(EffectType.TrainedPerfection))
|
||||
{
|
||||
if (!dryRun)
|
||||
RemoveEffect(EffectType.TrainedPerfection);
|
||||
return 0;
|
||||
}
|
||||
|
||||
var amt = (double)amount;
|
||||
if (HasEffect(EffectType.WasteNot) || HasEffect(EffectType.WasteNot2))
|
||||
amt /= 2;
|
||||
@@ -295,7 +304,7 @@ public class Simulator
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void ReduceDurability(int amount) =>
|
||||
ReduceDurabilityRaw(CalculateDurabilityCost(amount));
|
||||
ReduceDurabilityRaw(CalculateDurabilityCost(amount, false));
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void ReduceCP(int amount) =>
|
||||
|
||||
Reference in New Issue
Block a user