New 7.0 actions and updates

This commit is contained in:
Asriel Camora
2024-06-28 16:24:56 -07:00
parent f4b2b7cfb5
commit 1c4fd0a499
28 changed files with 212 additions and 145 deletions
+10 -2
View File
@@ -10,7 +10,9 @@ public record struct ActionStates
public byte TouchComboIdx;
public byte CarefulObservationCount;
public bool UsedHeartAndSoul;
public bool Observed;
public bool UsedQuickInnovation;
public bool UsedTrainedPerfection;
public bool ObserveCombo;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void MutateState(BaseAction baseAction)
@@ -28,6 +30,12 @@ public record struct ActionStates
if (baseAction is HeartAndSoul)
UsedHeartAndSoul = true;
Observed = baseAction is Observe;
if (baseAction is QuickInnovation)
UsedQuickInnovation = true;
if (baseAction is TrainedPerfection)
UsedTrainedPerfection = true;
ObserveCombo = baseAction is Observe;
}
}
+7 -47
View File
@@ -11,14 +11,14 @@ public enum ActionType : byte
ByregotsBlessing,
CarefulObservation,
CarefulSynthesis,
DaringTouch,
DelicateSynthesis,
FinalAppraisal,
FocusedSynthesis,
FocusedTouch,
GreatStrides,
Groundwork,
HastyTouch,
HeartAndSoul,
ImmaculateMend,
Innovation,
IntensiveSynthesis,
Manipulation,
@@ -29,11 +29,14 @@ public enum ActionType : byte
PreparatoryTouch,
PrudentSynthesis,
PrudentTouch,
QuickInnovation,
RapidSynthesis,
RefinedTouch,
Reflect,
StandardTouch,
TrainedEye,
TrainedFinesse,
TrainedPerfection,
TricksOfTheTrade,
Veneration,
WasteNot,
@@ -41,8 +44,8 @@ public enum ActionType : byte
StandardTouchCombo,
AdvancedTouchCombo,
FocusedSynthesisCombo,
FocusedTouchCombo,
ObservedAdvancedTouchCombo,
RefinedTouchCombo,
}
public static class ActionUtils
@@ -68,47 +71,4 @@ public static class ActionUtils
public static ActionCategory Category(this ActionType me) =>
me.Base().Category;
public static string IntName(this ActionType me) =>
me switch
{
ActionType.AdvancedTouch => "Advanced Touch",
ActionType.BasicSynthesis => "Basic Synthesis",
ActionType.BasicTouch => "Basic Touch",
ActionType.ByregotsBlessing => "Byregot's Blessing",
ActionType.CarefulObservation => "Careful Observation",
ActionType.CarefulSynthesis => "Careful Synthesis",
ActionType.DelicateSynthesis => "Delicate Synthesis",
ActionType.FinalAppraisal => "Final Appraisal",
ActionType.FocusedSynthesis => "Focused Synthesis",
ActionType.FocusedTouch => "Focused Touch",
ActionType.GreatStrides => "Great Strides",
ActionType.Groundwork => "Groundwork",
ActionType.HastyTouch => "Hasty Touch",
ActionType.HeartAndSoul => "Heart And Soul",
ActionType.Innovation => "Innovation",
ActionType.IntensiveSynthesis => "Intensive Synthesis",
ActionType.Manipulation => "Manipulation",
ActionType.MastersMend => "Master's Mend",
ActionType.MuscleMemory => "Muscle Memory",
ActionType.Observe => "Observe",
ActionType.PreciseTouch => "Precise Touch",
ActionType.PreparatoryTouch => "Preparatory Touch",
ActionType.PrudentSynthesis => "Prudent Synthesis",
ActionType.PrudentTouch => "Prudent Touch",
ActionType.RapidSynthesis => "Rapid Synthesis",
ActionType.Reflect => "Reflect",
ActionType.StandardTouch => "Standard Touch",
ActionType.TrainedEye => "Trained Eye",
ActionType.TrainedFinesse => "Trained Finesse",
ActionType.TricksOfTheTrade => "Tricks Of The Trade",
ActionType.Veneration => "Veneration",
ActionType.WasteNot => "Waste Not",
ActionType.WasteNot2 => "Waste Not II",
ActionType.StandardTouchCombo => "Standard Touch Combo",
ActionType.AdvancedTouchCombo => "Advanced Touch Combo",
ActionType.FocusedSynthesisCombo => "Focused Synthesis Combo",
ActionType.FocusedTouchCombo => "Focused Touch Combo",
_ => me.ToString(),
};
}
+2 -2
View File
@@ -1,10 +1,10 @@
namespace Craftimizer.Simulator.Actions;
internal sealed class AdvancedTouch() : BaseAction(
ActionCategory.Quality, level: 84, actionId: 100411,
ActionCategory.Quality, level: 68, actionId: 100411,
increasesQuality: true,
defaultCPCost: 46, defaultEfficiency: 150)
{
public override int CPCost(Simulator s) =>
s.ActionStates.TouchComboIdx == 2 ? 18 : 46;
(s.ActionStates.TouchComboIdx == 2 || s.ActionStates.ObserveCombo) ? 18 : 46;
}
+2 -1
View File
@@ -67,7 +67,8 @@ public abstract class BaseAction(
UseSuccess(s);
s.ReduceCP(CPCost(s));
s.ReduceDurability(DurabilityCost);
if (!s.HasEffect(EffectType.TrainedPerfection))
s.ReduceDurability(DurabilityCost);
if (IncreasesStepCount)
{
+15 -8
View File
@@ -18,11 +18,14 @@ public abstract class BaseComboAction(
private static bool VerifyDurability2(int durabilityA, int durability, in Effects effects)
{
var wasteNots = effects.HasEffect(EffectType.WasteNot) || effects.HasEffect(EffectType.WasteNot2);
// -A
durability -= (int)MathF.Ceiling(durabilityA * (wasteNots ? .5f : 1f));
if (durability <= 0)
return false;
if (!effects.HasEffect(EffectType.TrainedPerfection))
{
var wasteNots = effects.HasEffect(EffectType.WasteNot) || effects.HasEffect(EffectType.WasteNot2);
// -A
durability -= (int)MathF.Ceiling(durabilityA * (wasteNots ? .5f : 1f));
if (durability <= 0)
return false;
}
// If we can do the first action and still have durability left to survive to the next
// step (even before the Manipulation modifier), we can certainly do the next action.
@@ -36,10 +39,14 @@ public abstract class BaseComboAction(
{
var wasteNots = Math.Max(effects.GetDuration(EffectType.WasteNot), effects.GetDuration(EffectType.WasteNot2));
var manips = effects.HasEffect(EffectType.Manipulation);
var perfection = effects.HasEffect(EffectType.TrainedPerfection);
durability -= (int)MathF.Ceiling(durabilityA * wasteNots > 0 ? .5f : 1f);
if (durability <= 0)
return false;
if (!perfection)
{
durability -= (int)MathF.Ceiling(durabilityA * wasteNots > 0 ? .5f : 1f);
if (durability <= 0)
return false;
}
if (manips)
durability += 5;
+13
View File
@@ -0,0 +1,13 @@
namespace Craftimizer.Simulator.Actions;
internal sealed class DaringTouch() : BaseAction(
ActionCategory.Quality, 96, 100451,
increasesQuality: true,
defaultCPCost: 0,
defaultEfficiency: 150,
defaultSuccessRate: 60
)
{
public override bool CouldUse(Simulator s) =>
s.HasEffect(EffectType.Expedience) && base.CouldUse(s);
}
+7 -1
View File
@@ -7,5 +7,11 @@ internal sealed class DelicateSynthesis() : BaseAction(
defaultEfficiency: 100
)
{
public override void UseSuccess(Simulator s)
{
// Delicate Synthesis Mastery Trait
var hasTrait = s.Input.Stats.Level >= 94;
s.IncreaseProgress(hasTrait ? 150 : 100);
s.IncreaseQuality(100);
}
}
-13
View File
@@ -1,13 +0,0 @@
namespace Craftimizer.Simulator.Actions;
internal sealed class FocusedSynthesis() : BaseAction(
ActionCategory.Synthesis, 67, 100235,
increasesProgress: true,
defaultCPCost: 5,
defaultEfficiency: 200,
defaultSuccessRate: 50
)
{
public override int SuccessRate(Simulator s) =>
s.ActionStates.Observed ? 100 : 50;
}
@@ -1,8 +0,0 @@
namespace Craftimizer.Simulator.Actions;
internal sealed class FocusedSynthesisCombo() : BaseComboAction<Observe, FocusedSynthesis>(
ActionType.Observe, ActionType.FocusedSynthesis
)
{
}
-13
View File
@@ -1,13 +0,0 @@
namespace Craftimizer.Simulator.Actions;
internal sealed class FocusedTouch() : BaseAction(
ActionCategory.Quality, 68, 100243,
increasesQuality: true,
defaultCPCost: 18,
defaultEfficiency: 150,
defaultSuccessRate: 50
)
{
public override int SuccessRate(Simulator s) =>
s.ActionStates.Observed ? 100 : 50;
}
-8
View File
@@ -1,8 +0,0 @@
namespace Craftimizer.Simulator.Actions;
internal sealed class FocusedTouchCombo() : BaseComboAction<Observe, FocusedTouch>(
ActionType.Observe, ActionType.FocusedTouch
)
{
}
+12
View File
@@ -0,0 +1,12 @@
namespace Craftimizer.Simulator.Actions;
internal sealed class ImmaculateMend() : BaseAction(
ActionCategory.Durability, 98, 100467,
macroWaitTime: 2,
durabilityCost: 0,
defaultCPCost: 112
)
{
public override void UseSuccess(Simulator s) =>
s.RestoreAllDurability();
}
+1
View File
@@ -2,6 +2,7 @@ namespace Craftimizer.Simulator.Actions;
internal sealed class MastersMend() : BaseAction(
ActionCategory.Durability, 7, 100003,
macroWaitTime: 2,
durabilityCost: 0,
defaultCPCost: 88
)
@@ -0,0 +1,8 @@
namespace Craftimizer.Simulator.Actions;
internal sealed class ObservedAdvancedTouchCombo() : BaseComboAction<Observe, AdvancedTouch>(
ActionType.StandardTouchCombo, ActionType.AdvancedTouch, 7 + 18
)
{
}
+18
View File
@@ -0,0 +1,18 @@
namespace Craftimizer.Simulator.Actions;
internal sealed class QuickInnovation() : BaseBuffAction(
ActionCategory.Other, 96, 100459,
EffectType.Innovation, duration: 1,
macroWaitTime: 3,
increasesStepCount: false
)
{
public override bool IsPossible(Simulator s) =>
base.IsPossible(s) && s.Input.Stats.IsSpecialist && !s.ActionStates.UsedQuickInnovation;
public override bool CouldUse(Simulator s) =>
!s.ActionStates.UsedQuickInnovation;
public override string GetTooltip(Simulator s, bool addUsability) =>
$"{GetBaseTooltip(s, addUsability)}Specialist Only\n";
}
+16
View File
@@ -0,0 +1,16 @@
namespace Craftimizer.Simulator.Actions;
internal sealed class RefinedTouch() : BaseAction(
ActionCategory.Quality, 92, 100443,
increasesQuality: true,
defaultCPCost: 24,
defaultEfficiency: 100
)
{
public override void UseSuccess(Simulator s)
{
base.UseSuccess(s);
if (s.ActionStates.TouchComboIdx == 1)
s.StrengthenEffect(EffectType.InnerQuiet);
}
}
+8
View File
@@ -0,0 +1,8 @@
namespace Craftimizer.Simulator.Actions;
internal sealed class RefinedTouchCombo() : BaseComboAction<BasicTouch, RefinedTouch>(
ActionType.BasicTouch, ActionType.RefinedTouch
)
{
}
+1 -1
View File
@@ -4,7 +4,7 @@ internal sealed class Reflect() : BaseAction(
ActionCategory.FirstTurn, 69, 100387,
increasesQuality: true,
defaultCPCost: 6,
defaultEfficiency: 100
defaultEfficiency: 300
)
{
public override bool IsPossible(Simulator s) => s.IsFirstStep && base.IsPossible(s);
+13
View File
@@ -0,0 +1,13 @@
namespace Craftimizer.Simulator.Actions;
internal sealed class TrainedPerfection() : BaseBuffAction(
ActionCategory.Durability, 100, 100475,
EffectType.TrainedPerfection, duration: 1
)
{
public override bool IsPossible(Simulator s) =>
base.IsPossible(s) && !s.ActionStates.UsedTrainedPerfection;
public override bool CouldUse(Simulator s) =>
!s.ActionStates.UsedTrainedPerfection;
}
+2
View File
@@ -12,4 +12,6 @@ public enum EffectType
MuscleMemory,
Manipulation,
HeartAndSoul,
Expedience,
TrainedPerfection
}
+13
View File
@@ -16,6 +16,8 @@ public record struct Effects
public byte WasteNot2;
public byte MuscleMemory;
public byte Manipulation;
public bool Expedience;
public bool TrainedPerfection;
public bool HeartAndSoul;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -51,6 +53,12 @@ public record struct Effects
case EffectType.Manipulation:
Manipulation = duration;
break;
case EffectType.Expedience:
Expedience = duration != 0;
break;
case EffectType.TrainedPerfection:
TrainedPerfection = duration != 0;
break;
case EffectType.HeartAndSoul:
HeartAndSoul = duration != 0;
break;
@@ -78,6 +86,8 @@ public record struct Effects
EffectType.WasteNot2 => WasteNot2,
EffectType.MuscleMemory => MuscleMemory,
EffectType.Manipulation => Manipulation,
EffectType.Expedience => (byte)(Expedience ? 1 : 0),
EffectType.TrainedPerfection => (byte)(TrainedPerfection ? 1 : 0),
EffectType.HeartAndSoul => (byte)(HeartAndSoul ? 1 : 0),
_ => 0
};
@@ -117,5 +127,8 @@ public record struct Effects
MuscleMemory--;
if (Manipulation > 0)
Manipulation--;
Expedience = false;
TrainedPerfection = false;
}
}
+6
View File
@@ -181,6 +181,12 @@ public class Simulator
Durability = Input.Recipe.MaxDurability;
}
public void RestoreAllDurability()
{
Durability = Input.Recipe.MaxDurability;
}
public void RestoreCP(int amount)
{
CP += amount;