Split CanUse into CouldUse & IsPossible
This commit is contained in:
@@ -25,8 +25,19 @@ public abstract class BaseAction
|
||||
public virtual int Efficiency(Simulator s) => 0;
|
||||
public virtual float SuccessRate(Simulator s) => 1f;
|
||||
|
||||
public virtual bool CanUse(Simulator s) =>
|
||||
s.Input.Stats.Level >= Level && s.CP >= CPCost(s);
|
||||
// Return true if it can be in the action pool now or in the future
|
||||
// e.g. if Heart and Soul is already used, it is impossible to use it again
|
||||
// or if it's a first step action and IsFirstStep is false
|
||||
public virtual bool IsPossible(Simulator s) =>
|
||||
s.Input.Stats.Level >= Level;
|
||||
|
||||
// Return true if it can be used now
|
||||
// This already assumes that IsPossible returns true *at some point before*
|
||||
public virtual bool CouldUse(Simulator s) =>
|
||||
s.CP >= CPCost(s);
|
||||
|
||||
public bool CanUse(Simulator s) =>
|
||||
IsPossible(s) && CouldUse(s);
|
||||
|
||||
public virtual void Use(Simulator s)
|
||||
{
|
||||
|
||||
@@ -7,8 +7,8 @@ public abstract class BaseComboAction : BaseAction
|
||||
|
||||
public sealed override ActionCategory Category => ActionCategory.Combo;
|
||||
|
||||
protected bool BaseCanUse(Simulator s) =>
|
||||
base.CanUse(s);
|
||||
protected bool BaseCouldUse(Simulator s) =>
|
||||
base.CouldUse(s);
|
||||
|
||||
private static bool VerifyDurability2(int durabilityA, int durability, in Effects effects)
|
||||
{
|
||||
|
||||
@@ -13,8 +13,10 @@ internal abstract class BaseComboAction<A, B> : BaseComboAction where A : BaseAc
|
||||
|
||||
public override int CPCost(Simulator s) => ActionA.CPCost(s) + ActionB.CPCost(s);
|
||||
|
||||
public override bool CanUse(Simulator s) =>
|
||||
BaseCanUse(s) && VerifyDurability2(s, ActionA.DurabilityCost);
|
||||
public override bool IsPossible(Simulator s) => ActionA.IsPossible(s) && ActionB.IsPossible(s);
|
||||
|
||||
public override bool CouldUse(Simulator s) =>
|
||||
BaseCouldUse(s) && VerifyDurability2(s, ActionA.DurabilityCost);
|
||||
|
||||
public override void Use(Simulator s)
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@ internal sealed class ByregotsBlessing : BaseAction
|
||||
public override int CPCost(Simulator s) => 24;
|
||||
public override int Efficiency(Simulator s) => 100 + (20 * s.GetEffectStrength(EffectType.InnerQuiet));
|
||||
|
||||
public override bool CanUse(Simulator s) => s.HasEffect(EffectType.InnerQuiet) && base.CanUse(s);
|
||||
public override bool CouldUse(Simulator s) => s.HasEffect(EffectType.InnerQuiet) && base.CouldUse(s);
|
||||
|
||||
public override void UseSuccess(Simulator s)
|
||||
{
|
||||
|
||||
@@ -12,10 +12,13 @@ internal sealed class CarefulObservation : BaseAction
|
||||
|
||||
public override int CPCost(Simulator s) => 0;
|
||||
|
||||
public override bool CanUse(Simulator s) => s.Input.Stats.IsSpecialist && s.ActionStates.CarefulObservationCount < 3;
|
||||
public override bool IsPossible(Simulator s) =>
|
||||
base.IsPossible(s) && s.Input.Stats.IsSpecialist && s.ActionStates.CarefulObservationCount < 3;
|
||||
|
||||
public override bool CouldUse(Simulator s) => s.ActionStates.CarefulObservationCount < 3;
|
||||
|
||||
public override void UseSuccess(Simulator s) => s.StepCondition();
|
||||
|
||||
public override string GetTooltip(Simulator s, bool addUsability) =>
|
||||
$"{base.GetTooltip(s, addUsability)}Specialist Only";
|
||||
$"{base.GetTooltip(s, addUsability)}Specialist Only\n";
|
||||
}
|
||||
|
||||
@@ -13,8 +13,11 @@ internal sealed class HeartAndSoul : BaseBuffAction
|
||||
|
||||
public override int CPCost(Simulator s) => 0;
|
||||
|
||||
public override bool CanUse(Simulator s) => s.Input.Stats.IsSpecialist && !s.ActionStates.UsedHeartAndSoul;
|
||||
public override bool IsPossible(Simulator s) =>
|
||||
base.IsPossible(s) && s.Input.Stats.IsSpecialist && !s.ActionStates.UsedHeartAndSoul;
|
||||
|
||||
public override bool CouldUse(Simulator s) => !s.ActionStates.UsedHeartAndSoul;
|
||||
|
||||
public override string GetTooltip(Simulator s, bool addUsability) =>
|
||||
$"{GetBaseTooltip(s, addUsability)}Specialist Only";
|
||||
$"{GetBaseTooltip(s, addUsability)}Specialist Only\n";
|
||||
}
|
||||
|
||||
@@ -11,9 +11,9 @@ internal sealed class IntensiveSynthesis : BaseAction
|
||||
public override int CPCost(Simulator s) => 6;
|
||||
public override int Efficiency(Simulator s) => 400;
|
||||
|
||||
public override bool CanUse(Simulator s) =>
|
||||
public override bool CouldUse(Simulator s) =>
|
||||
(s.Condition == Condition.Good || s.Condition == Condition.Excellent || s.HasEffect(EffectType.HeartAndSoul))
|
||||
&& base.CanUse(s);
|
||||
&& base.CouldUse(s);
|
||||
|
||||
public override void UseSuccess(Simulator s)
|
||||
{
|
||||
|
||||
@@ -10,7 +10,9 @@ internal sealed class Manipulation : BaseBuffAction
|
||||
public override byte Duration => 8;
|
||||
|
||||
public override int CPCost(Simulator s) => 96;
|
||||
public override bool CanUse(Simulator s) => s.Input.Stats.CanUseManipulation && base.CanUse(s);
|
||||
|
||||
public override bool IsPossible(Simulator s) =>
|
||||
s.Input.Stats.CanUseManipulation && base.IsPossible(s);
|
||||
|
||||
public override void Use(Simulator s)
|
||||
{
|
||||
|
||||
@@ -11,7 +11,9 @@ internal sealed class MuscleMemory : BaseAction
|
||||
public override int CPCost(Simulator s) => 6;
|
||||
public override int Efficiency(Simulator s) => 300;
|
||||
|
||||
public override bool CanUse(Simulator s) => s.IsFirstStep && base.CanUse(s);
|
||||
public override bool IsPossible(Simulator s) => s.IsFirstStep && base.IsPossible(s);
|
||||
|
||||
public override bool CouldUse(Simulator s) => s.IsFirstStep && base.CouldUse(s);
|
||||
|
||||
public override void UseSuccess(Simulator s)
|
||||
{
|
||||
|
||||
@@ -11,9 +11,9 @@ internal sealed class PreciseTouch : BaseAction
|
||||
public override int CPCost(Simulator s) => 18;
|
||||
public override int Efficiency(Simulator s) => 150;
|
||||
|
||||
public override bool CanUse(Simulator s) =>
|
||||
public override bool CouldUse(Simulator s) =>
|
||||
(s.Condition == Condition.Good || s.Condition == Condition.Excellent || s.HasEffect(EffectType.HeartAndSoul))
|
||||
&& base.CanUse(s);
|
||||
&& base.CouldUse(s);
|
||||
|
||||
public override void UseSuccess(Simulator s)
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@ internal sealed class PrudentSynthesis : BaseAction
|
||||
public override int CPCost(Simulator s) => 18;
|
||||
public override int Efficiency(Simulator s) => 180;
|
||||
|
||||
public override bool CanUse(Simulator s) =>
|
||||
public override bool CouldUse(Simulator s) =>
|
||||
!(s.HasEffect(EffectType.WasteNot) || s.HasEffect(EffectType.WasteNot2))
|
||||
&& base.CanUse(s);
|
||||
&& base.CouldUse(s);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ internal sealed class PrudentTouch : BaseAction
|
||||
public override int CPCost(Simulator s) => 25;
|
||||
public override int Efficiency(Simulator s) => 100;
|
||||
|
||||
public override bool CanUse(Simulator s) =>
|
||||
public override bool CouldUse(Simulator s) =>
|
||||
!(s.HasEffect(EffectType.WasteNot) || s.HasEffect(EffectType.WasteNot2))
|
||||
&& base.CanUse(s);
|
||||
&& base.CouldUse(s);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,9 @@ internal sealed class Reflect : BaseAction
|
||||
public override int CPCost(Simulator s) => 6;
|
||||
public override int Efficiency(Simulator s) => 100;
|
||||
|
||||
public override bool CanUse(Simulator s) => s.IsFirstStep && base.CanUse(s);
|
||||
public override bool IsPossible(Simulator s) => s.IsFirstStep && base.IsPossible(s);
|
||||
|
||||
public override bool CouldUse(Simulator s) => s.IsFirstStep && base.CouldUse(s);
|
||||
|
||||
public override void UseSuccess(Simulator s)
|
||||
{
|
||||
|
||||
@@ -10,11 +10,12 @@ internal sealed class TrainedEye : BaseAction
|
||||
|
||||
public override int CPCost(Simulator s) => 250;
|
||||
|
||||
public override bool CanUse(Simulator s) =>
|
||||
s.IsFirstStep &&
|
||||
public override bool IsPossible(Simulator s) => s.IsFirstStep &&
|
||||
!s.Input.Recipe.IsExpert &&
|
||||
s.Input.Stats.Level >= (s.Input.Recipe.ClassJobLevel + 10) &&
|
||||
base.CanUse(s);
|
||||
base.IsPossible(s);
|
||||
|
||||
public override bool CouldUse(Simulator s) => s.IsFirstStep && base.CouldUse(s);
|
||||
|
||||
public override void UseSuccess(Simulator s) =>
|
||||
s.IncreaseQualityRaw(s.Input.Recipe.MaxQuality - s.Quality);
|
||||
|
||||
@@ -12,7 +12,7 @@ internal sealed class TrainedFinesse : BaseAction
|
||||
public override int CPCost(Simulator s) => 32;
|
||||
public override int Efficiency(Simulator s) => 100;
|
||||
|
||||
public override bool CanUse(Simulator s) =>
|
||||
public override bool CouldUse(Simulator s) =>
|
||||
s.GetEffectStrength(EffectType.InnerQuiet) == 10
|
||||
&& base.CanUse(s);
|
||||
&& base.CouldUse(s);
|
||||
}
|
||||
|
||||
@@ -10,9 +10,9 @@ internal sealed class TricksOfTheTrade : BaseAction
|
||||
|
||||
public override int CPCost(Simulator s) => 0;
|
||||
|
||||
public override bool CanUse(Simulator s) =>
|
||||
public override bool CouldUse(Simulator s) =>
|
||||
(s.Condition == Condition.Good || s.Condition == Condition.Excellent || s.HasEffect(EffectType.HeartAndSoul))
|
||||
&& base.CanUse(s);
|
||||
&& base.CouldUse(s);
|
||||
|
||||
public override void UseSuccess(Simulator s)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user