AI preset curves and expandable optimisation (#1346)

* AI preset curves and expandable optimisation

Added preset curves for considerations to use just to avoid repeating the same variables all over the shop.

Moved common considerations for expanded actions onto the expandable action e.g. you need a free hand to be able to PickUpGloves so we'll just check it the once rather than for each action.

* FIX PRAGMA

Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
This commit is contained in:
metalgearsloth
2020-08-12 06:01:55 +10:00
committed by GitHub
parent c00a08f504
commit b34bd7c188
43 changed files with 409 additions and 127 deletions

View File

@@ -44,9 +44,7 @@ namespace Content.Server.AI.Utility.Actions.Combat.Melee
return new[]
{
considerationsManager.Get<MeleeWeaponEquippedCon>()
.InverseBoolCurve(context),
considerationsManager.Get<CanPutTargetInHandsCon>()
considerationsManager.Get<CanPutTargetInInventoryCon>()
.BoolCurve(context),
considerationsManager.Get<MeleeWeaponSpeedCon>()
.QuadraticCurve(context, 1.0f, 0.5f, 0.0f, 0.0f),

View File

@@ -66,16 +66,14 @@ namespace Content.Server.AI.Utility.Actions.Combat.Melee
return new[]
{
considerationsManager.Get<MeleeWeaponEquippedCon>()
.BoolCurve(context),
considerationsManager.Get<TargetIsDeadCon>()
.InverseBoolCurve(context),
considerationsManager.Get<TargetIsCritCon>()
.QuadraticCurve(context, -0.8f, 1.0f, 1.0f, 0.0f),
considerationsManager.Get<DistanceCon>()
.QuadraticCurve(context, 1.0f, 1.0f, 0.02f, 0.0f),
considerationsManager.Get<TargetDistanceCon>()
.PresetCurve(context, PresetCurve.Distance),
considerationsManager.Get<TargetHealthCon>()
.QuadraticCurve(context, 1.0f, 0.4f, 0.0f, -0.02f),
.PresetCurve(context, PresetCurve.TargetHealth),
considerationsManager.Get<MeleeWeaponSpeedCon>()
.QuadraticCurve(context, 1.0f, 0.5f, 0.0f, 0.0f),
considerationsManager.Get<MeleeWeaponDamageCon>()

View File

@@ -42,12 +42,8 @@ namespace Content.Server.AI.Utility.Actions.Combat.Melee
return new[]
{
considerationsManager.Get<FreeHandCon>()
.BoolCurve(context),
considerationsManager.Get<HasMeleeWeaponCon>()
.InverseBoolCurve(context),
considerationsManager.Get<DistanceCon>()
.QuadraticCurve(context, 1.0f, 1.0f, 0.02f, 0.0f),
considerationsManager.Get<TargetDistanceCon>()
.PresetCurve(context, PresetCurve.Distance),
considerationsManager.Get<MeleeWeaponDamageCon>()
.QuadraticCurve(context, 1.0f, 0.25f, 0.0f, 0.0f),
considerationsManager.Get<MeleeWeaponSpeedCon>()

View File

@@ -64,16 +64,14 @@ namespace Content.Server.AI.Utility.Actions.Combat.Melee
return new[]
{
considerationsManager.Get<CanUnarmedCombatCon>()
.BoolCurve(context),
considerationsManager.Get<TargetIsDeadCon>()
.InverseBoolCurve(context),
considerationsManager.Get<TargetIsCritCon>()
.QuadraticCurve(context, -0.8f, 1.0f, 1.0f, 0.0f),
considerationsManager.Get<DistanceCon>()
.QuadraticCurve(context, -1.0f, 1.0f, 1.02f, 0.0f),
considerationsManager.Get<TargetDistanceCon>()
.PresetCurve(context, PresetCurve.Distance),
considerationsManager.Get<TargetHealthCon>()
.QuadraticCurve(context, 1.0f, 0.4f, 0.0f, -0.02f),
.PresetCurve(context, PresetCurve.TargetHealth),
considerationsManager.Get<TargetAccessibleCon>()
.BoolCurve(context),
// TODO: Consider our Speed and Damage to compare this to using a weapon
@@ -81,4 +79,4 @@ namespace Content.Server.AI.Utility.Actions.Combat.Melee
};
}
}
}
}