Combo actions for better macro quality
This commit is contained in:
@@ -7,6 +7,7 @@ public enum ActionCategory
|
||||
Quality,
|
||||
Durability,
|
||||
Buffs,
|
||||
Combo,
|
||||
Other
|
||||
}
|
||||
|
||||
|
||||
@@ -38,6 +38,11 @@ public enum ActionType : byte
|
||||
Veneration,
|
||||
WasteNot,
|
||||
WasteNot2,
|
||||
|
||||
StandardTouchCombo,
|
||||
AdvancedTouchCombo,
|
||||
FocusedSynthesisCombo,
|
||||
FocusedTouchCombo,
|
||||
}
|
||||
|
||||
public static class ActionUtils
|
||||
@@ -106,6 +111,10 @@ public static class ActionUtils
|
||||
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(),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
namespace Craftimizer.Simulator.Actions;
|
||||
|
||||
// Basic Touch -> Standard Touch -> Advanced Touch
|
||||
internal sealed class AdvancedTouchCombo : BaseAction
|
||||
{
|
||||
public override ActionCategory Category => ActionCategory.Combo;
|
||||
public override int Level => 84;
|
||||
public override uint ActionId => 100411;
|
||||
|
||||
public override bool IncreasesQuality => true;
|
||||
|
||||
public override int CPCost(Simulator s) => 18 + 18 + 18;
|
||||
|
||||
public override bool CanUse(Simulator s) =>
|
||||
// BasicTouch.DurabilityCost vv vv StandardTouch.DurabilityCost
|
||||
base.CanUse(s) && StandardTouchCombo.VerifyDurability3(s, 10, 10);
|
||||
|
||||
private static readonly BasicTouch ActionA = new();
|
||||
private static readonly StandardTouch ActionB = new();
|
||||
private static readonly AdvancedTouch ActionC = new();
|
||||
public override void Use(Simulator s)
|
||||
{
|
||||
s.ExecuteForced(ActionType.BasicTouch, ActionA);
|
||||
s.ExecuteForced(ActionType.StandardTouch, ActionB);
|
||||
ActionC.Use(s);
|
||||
}
|
||||
|
||||
public override string GetTooltip(Simulator s, bool addUsability) =>
|
||||
$"{ActionA.GetTooltip(s, addUsability)}\n{ActionB.GetTooltip(s, addUsability)}\n{ActionC.GetTooltip(s, addUsability)}";
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
namespace Craftimizer.Simulator.Actions;
|
||||
|
||||
// Observe -> Focused Synthesis
|
||||
internal sealed class FocusedSynthesisCombo : BaseAction
|
||||
{
|
||||
public override ActionCategory Category => ActionCategory.Combo;
|
||||
public override int Level => 67;
|
||||
public override uint ActionId => 100235;
|
||||
|
||||
public override bool IncreasesProgress => true;
|
||||
|
||||
public override int CPCost(Simulator s) => 7 + 5;
|
||||
|
||||
public override bool CanUse(Simulator s) =>
|
||||
// Observe.DurabilityCost v
|
||||
base.CanUse(s) && StandardTouchCombo.VerifyDurability2(s, 0);
|
||||
|
||||
private static readonly Observe ActionA = new();
|
||||
private static readonly FocusedSynthesis ActionB = new();
|
||||
public override void Use(Simulator s)
|
||||
{
|
||||
s.ExecuteForced(ActionType.Observe, ActionA);
|
||||
ActionB.Use(s);
|
||||
}
|
||||
|
||||
public override string GetTooltip(Simulator s, bool addUsability) =>
|
||||
$"{ActionA.GetTooltip(s, addUsability)}\n{ActionB.GetTooltip(s, addUsability)}";
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
namespace Craftimizer.Simulator.Actions;
|
||||
|
||||
// Observe -> Focused Touch
|
||||
internal sealed class FocusedTouchCombo : BaseAction
|
||||
{
|
||||
public override ActionCategory Category => ActionCategory.Combo;
|
||||
public override int Level => 68;
|
||||
public override uint ActionId => 100243;
|
||||
|
||||
public override bool IncreasesQuality => true;
|
||||
|
||||
public override int CPCost(Simulator s) => 7 + 18;
|
||||
|
||||
public override bool CanUse(Simulator s) =>
|
||||
// Observe.DurabilityCost v
|
||||
base.CanUse(s) && StandardTouchCombo.VerifyDurability2(s, 0);
|
||||
|
||||
private static readonly Observe ActionA = new();
|
||||
private static readonly FocusedTouch ActionB = new();
|
||||
public override void Use(Simulator s)
|
||||
{
|
||||
s.ExecuteForced(ActionType.Observe, ActionA);
|
||||
ActionB.Use(s);
|
||||
}
|
||||
|
||||
public override string GetTooltip(Simulator s, bool addUsability) =>
|
||||
$"{ActionA.GetTooltip(s, addUsability)}\n{ActionB.GetTooltip(s, addUsability)}";
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
namespace Craftimizer.Simulator.Actions;
|
||||
|
||||
// Basic Touch -> Standard Touch
|
||||
internal sealed class StandardTouchCombo : BaseAction
|
||||
{
|
||||
public override ActionCategory Category => ActionCategory.Combo;
|
||||
public override int Level => 18;
|
||||
public override uint ActionId => 100004;
|
||||
|
||||
public override bool IncreasesQuality => true;
|
||||
|
||||
public override int CPCost(Simulator s) => 18 + 18;
|
||||
|
||||
public override bool CanUse(Simulator s) =>
|
||||
// BasicTouch.DurabilityCost vv
|
||||
base.CanUse(s) && VerifyDurability2(s, 10);
|
||||
|
||||
private static readonly BasicTouch ActionA = new();
|
||||
private static readonly StandardTouch ActionB = new();
|
||||
public override void Use(Simulator s)
|
||||
{
|
||||
s.ExecuteForced(ActionType.BasicTouch, ActionA);
|
||||
ActionB.Use(s);
|
||||
}
|
||||
|
||||
public override string GetTooltip(Simulator s, bool addUsability) =>
|
||||
$"{ActionA.GetTooltip(s, addUsability)}\n{ActionB.GetTooltip(s, addUsability)}";
|
||||
|
||||
public static bool VerifyDurability2(Simulator s, int durabilityA)
|
||||
{
|
||||
var d = s.Durability;
|
||||
var wasteNots = s.HasEffect(EffectType.WasteNot) || s.HasEffect(EffectType.WasteNot2);
|
||||
|
||||
// -A
|
||||
d -= (int)MathF.Ceiling(durabilityA * (wasteNots ? .5f : 1f));
|
||||
if (d <= 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.
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool VerifyDurability3(Simulator s, int durabilityA, int durabilityB)
|
||||
{
|
||||
var d = s.Durability;
|
||||
var wasteNots = Math.Max(s.GetEffectDuration(EffectType.WasteNot), s.GetEffectDuration(EffectType.WasteNot2));
|
||||
var manips = s.GetEffectDuration(EffectType.Manipulation);
|
||||
|
||||
d -= (int)MathF.Ceiling(durabilityA * wasteNots > 0 ? .5f : 1f);
|
||||
if (d <= 0)
|
||||
return false;
|
||||
|
||||
if (manips > 0)
|
||||
d += 5;
|
||||
|
||||
if (wasteNots > 0)
|
||||
wasteNots--;
|
||||
|
||||
d -= (int)MathF.Ceiling(durabilityB * wasteNots > 0 ? .5f : 1f);
|
||||
|
||||
if (d <= 0)
|
||||
return false;
|
||||
|
||||
// If we can do the second action and still have durability left to survive to the next
|
||||
// step (even before the Manipulation modifier), we can certainly do the next action.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -57,13 +57,18 @@ public class Simulator
|
||||
return ActionResponse.CannotUseAction;
|
||||
}
|
||||
|
||||
ExecuteForced(action, baseAction);
|
||||
|
||||
return ActionResponse.UsedAction;
|
||||
}
|
||||
|
||||
public void ExecuteForced(ActionType action, BaseAction baseAction)
|
||||
{
|
||||
baseAction.Use(this);
|
||||
ActionStates.MutateState(action);
|
||||
ActionCount++;
|
||||
|
||||
ActiveEffects.DecrementDuration();
|
||||
|
||||
return ActionResponse.UsedAction;
|
||||
}
|
||||
|
||||
public int GetEffectStrength(EffectType effect) =>
|
||||
|
||||
Reference in New Issue
Block a user