Skip to content

Commit

Permalink
New 7.0 actions and updates
Browse files Browse the repository at this point in the history
  • Loading branch information
WorkingRobot committed Jun 28, 2024
1 parent f4b2b7c commit 1c4fd0a
Show file tree
Hide file tree
Showing 28 changed files with 212 additions and 145 deletions.
2 changes: 2 additions & 0 deletions Craftimizer/SimulatorUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,8 @@ public static uint StatusId(this EffectType me) =>
EffectType.MuscleMemory => 2191,
EffectType.Manipulation => 1164,
EffectType.HeartAndSoul => 2665,
EffectType.Expedience => 3812,
EffectType.TrainedPerfection => 3813,
_ => throw new ArgumentOutOfRangeException(nameof(me)),
};

Expand Down
57 changes: 32 additions & 25 deletions Craftimizer/Utils/CommunityMacros.cs
Original file line number Diff line number Diff line change
Expand Up @@ -256,30 +256,33 @@ public CommunityMacro(TeamcraftMacro macro)
"PrudentSynthesis" => ActionType.PrudentSynthesis,
"RapidSynthesis" => ActionType.RapidSynthesis,
"Groundwork" => ActionType.Groundwork,
"FocusedSynthesis" => ActionType.FocusedSynthesis,
"MuscleMemory" => ActionType.MuscleMemory,
"IntensiveSynthesis" => ActionType.IntensiveSynthesis,
"BasicTouch" => ActionType.BasicTouch,
"StandardTouch" => ActionType.StandardTouch,
"AdvancedTouch" => ActionType.AdvancedTouch,
"HastyTouch" => ActionType.HastyTouch,
"DaringTouch" => ActionType.DaringTouch,
"ByregotsBlessing" => ActionType.ByregotsBlessing,
"PreciseTouch" => ActionType.PreciseTouch,
"FocusedTouch" => ActionType.FocusedTouch,
"PrudentTouch" => ActionType.PrudentTouch,
"TrainedEye" => ActionType.TrainedEye,
"PreparatoryTouch" => ActionType.PreparatoryTouch,
"Reflect" => ActionType.Reflect,
"TrainedFinesse" => ActionType.TrainedFinesse,
"RefinedTouch" => ActionType.RefinedTouch,
"TrainedPerfection" => ActionType.TrainedPerfection,
"TricksOfTheTrade" => ActionType.TricksOfTheTrade,
"MastersMend" => ActionType.MastersMend,
"Manipulation" => ActionType.Manipulation,
"ImmaculateMend" => ActionType.ImmaculateMend,
"WasteNot" => ActionType.WasteNot,
"WasteNotII" => ActionType.WasteNot2,
"GreatStrides" => ActionType.GreatStrides,
"Innovation" => ActionType.Innovation,
"Veneration" => ActionType.Veneration,
"FinalAppraisal" => ActionType.FinalAppraisal,
"QuickInnovation" => ActionType.QuickInnovation,
"Observe" => ActionType.Observe,
"HeartAndSoul" => ActionType.HeartAndSoul,
"CarefulObservation" => ActionType.CarefulObservation,
Expand Down Expand Up @@ -311,42 +314,46 @@ public CommunityMacro(CraftingwayMacro macro)
if (macro.Actions is not { } rotation)
throw new Exception($"Internal error; No actions were returned");

// https://github.com/ffxiv-teamcraft/ffxiv-teamcraft/blob/67f453041c6b2b31d32fcf6e1fd53aa38ed7a12b/apps/client/src/app/model/other/crafting-rotation.ts#L49
Name = macro.Slug ?? "New Craftinway Rotation";
Name = macro.Slug ?? "New Craftingway Rotation";
var actions = new List<ActionType>();
foreach (var action in rotation.Split(','))
{
ActionType? actionType = action switch
{
"BasicSynthesis" => ActionType.BasicSynthesis,
"BasicTouch" => ActionType.BasicTouch,
"MastersMend" => ActionType.MastersMend,
"Observe" => ActionType.Observe,
"WasteNot" => ActionType.WasteNot,
"MuscleMemory" => ActionType.MuscleMemory,
"Reflect" => ActionType.Reflect,
"TrainedEye" => ActionType.TrainedEye,
"Veneration" => ActionType.Veneration,
"StandardTouch" => ActionType.StandardTouch,
"GreatStrides" => ActionType.GreatStrides,
"Innovation" => ActionType.Innovation,
"QuickInnovation" => ActionType.QuickInnovation,
"BasicSynthesis" => ActionType.BasicSynthesis,
"BasicSynthesisTraited" => ActionType.BasicSynthesis,
"WasteNotII" => ActionType.WasteNot2,
"ByregotsBlessing" => ActionType.ByregotsBlessing,
"MuscleMemory" => ActionType.MuscleMemory,
"CarefulSynthesis" => ActionType.CarefulSynthesis,
"Manipulation" => ActionType.Manipulation,
"PrudentTouch" => ActionType.PrudentTouch,
"FocusedSynthesis" => ActionType.FocusedSynthesis,
"FocusedTouch" => ActionType.FocusedTouch,
"Reflect" => ActionType.Reflect,
"PreparatoryTouch" => ActionType.PreparatoryTouch,
"Groundwork" => ActionType.Groundwork,
"DelicateSynthesis" => ActionType.DelicateSynthesis,
"TrainedEye" => ActionType.TrainedEye,
"CarefulSynthesisTraited" => ActionType.CarefulSynthesis,
"AdvancedTouch" => ActionType.AdvancedTouch,
"GroundworkTraited" => ActionType.Groundwork,
"PrudentSynthesis" => ActionType.PrudentSynthesis,
"Groundwork" => ActionType.Groundwork,
"GroundworkTraited" => ActionType.Groundwork,
"BasicTouch" => ActionType.BasicTouch,
"StandardTouch" => ActionType.StandardTouch,
"AdvancedTouch" => ActionType.AdvancedTouch,
"ByregotsBlessing" => ActionType.ByregotsBlessing,
"PrudentTouch" => ActionType.PrudentTouch,
"PreparatoryTouch" => ActionType.PreparatoryTouch,
"TrainedFinesse" => ActionType.TrainedFinesse,
{ } actionValue => throw new Exception($"Unknown action {actionValue}"),
"RefinedTouch" => ActionType.RefinedTouch,
"MastersMend" => ActionType.MastersMend,
"ImmaculateMend" => ActionType.ImmaculateMend,
"WasteNot" => ActionType.WasteNot,
"WasteNotII" => ActionType.WasteNot2,
"Manipulation" => ActionType.Manipulation,
"TrainedPerfection" => ActionType.TrainedPerfection,
"Observe" => ActionType.Observe,
"DelicateSynthesis" => ActionType.DelicateSynthesis,
"DelicateSynthesisTraited" => ActionType.DelicateSynthesis,

// Old actions?
_ => null
};
if (actionType.HasValue)
actions.Add(actionType.Value);
Expand Down
4 changes: 2 additions & 2 deletions Craftimizer/Utils/Gearsets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ public record struct GearsetItem(uint itemId, bool isHq, GearsetMateria[] materi

static Gearsets()
{
LevelToCLvlLUT = new int[90];
LevelToCLvlLUT = new int[100];
for (uint i = 0; i < 80; ++i) {
var level = i + 1;
LevelToCLvlLUT[i] = LuminaSheets.ParamGrowSheet.GetRow(level)!.CraftingLevel;
}
for (var i = 80; i < 90; ++i)
for (var i = 80; i < 100; ++i)
{
var level = i + 1;
LevelToCLvlLUT[i] = (int)LuminaSheets.RecipeLevelTableSheet.First(r => r.ClassJobLevel == level).RowId;
Expand Down
2 changes: 2 additions & 0 deletions Craftimizer/Windows/SynthHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,8 @@ bool HasEffect(ushort id)
WasteNot2 = GetEffectStack((ushort)EffectType.WasteNot2.StatusId()),
MuscleMemory = GetEffectStack((ushort)EffectType.MuscleMemory.StatusId()),
Manipulation = GetEffectStack((ushort)EffectType.Manipulation.StatusId()),
Expedience = HasEffect((ushort)EffectType.Expedience.StatusId()),
TrainedPerfection = HasEffect((ushort)EffectType.TrainedPerfection.StatusId()),
HeartAndSoul = HasEffect((ushort)EffectType.HeartAndSoul.StatusId()),
},
ActionStates = CurrentActionStates
Expand Down
12 changes: 10 additions & 2 deletions Simulator/ActionStates.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -28,6 +30,12 @@ public void MutateState(BaseAction baseAction)
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;
}
}
54 changes: 7 additions & 47 deletions Simulator/Actions/ActionType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ public enum ActionType : byte
ByregotsBlessing,
CarefulObservation,
CarefulSynthesis,
DaringTouch,
DelicateSynthesis,
FinalAppraisal,
FocusedSynthesis,
FocusedTouch,
GreatStrides,
Groundwork,
HastyTouch,
HeartAndSoul,
ImmaculateMend,
Innovation,
IntensiveSynthesis,
Manipulation,
Expand All @@ -29,20 +29,23 @@ public enum ActionType : byte
PreparatoryTouch,
PrudentSynthesis,
PrudentTouch,
QuickInnovation,
RapidSynthesis,
RefinedTouch,
Reflect,
StandardTouch,
TrainedEye,
TrainedFinesse,
TrainedPerfection,
TricksOfTheTrade,
Veneration,
WasteNot,
WasteNot2,

StandardTouchCombo,
AdvancedTouchCombo,
FocusedSynthesisCombo,
FocusedTouchCombo,
ObservedAdvancedTouchCombo,
RefinedTouchCombo,
}

public static class ActionUtils
Expand All @@ -68,47 +71,4 @@ public static int Level(this ActionType me) =>

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(),
};
}
4 changes: 2 additions & 2 deletions Simulator/Actions/AdvancedTouch.cs
Original file line number Diff line number Diff line change
@@ -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;
}
3 changes: 2 additions & 1 deletion Simulator/Actions/BaseAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ public virtual void Use(Simulator s)
UseSuccess(s);

s.ReduceCP(CPCost(s));
s.ReduceDurability(DurabilityCost);
if (!s.HasEffect(EffectType.TrainedPerfection))
s.ReduceDurability(DurabilityCost);

if (IncreasesStepCount)
{
Expand Down
23 changes: 15 additions & 8 deletions Simulator/Actions/BaseComboAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@ protected bool BaseCouldUse(Simulator s) =>

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.
Expand All @@ -36,10 +39,14 @@ public static bool VerifyDurability3(int durabilityA, int durabilityB, int durab
{
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;
Expand Down
13 changes: 13 additions & 0 deletions Simulator/Actions/DaringTouch.cs
Original file line number Diff line number Diff line change
@@ -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);
}
8 changes: 7 additions & 1 deletion Simulator/Actions/DelicateSynthesis.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 0 additions & 13 deletions Simulator/Actions/FocusedSynthesis.cs

This file was deleted.

8 changes: 0 additions & 8 deletions Simulator/Actions/FocusedSynthesisCombo.cs

This file was deleted.

13 changes: 0 additions & 13 deletions Simulator/Actions/FocusedTouch.cs

This file was deleted.

8 changes: 0 additions & 8 deletions Simulator/Actions/FocusedTouchCombo.cs

This file was deleted.

Loading

0 comments on commit 1c4fd0a

Please sign in to comment.