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