This commit is contained in:
36
Plugins/PkmnLib.Plugin.Gen7/AI/AIDamageFunctions.cs
Normal file
36
Plugins/PkmnLib.Plugin.Gen7/AI/AIDamageFunctions.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using PkmnLib.Dynamic.AI.Explicit;
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
using PkmnLib.Static.Moves;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.AI;
|
||||
|
||||
public static class AIDamageFunctions
|
||||
{
|
||||
internal static void PredictedDamageScore(IExplicitAI ai, MoveOption option, ref int score)
|
||||
{
|
||||
var target = option.Target;
|
||||
if (target == null)
|
||||
return;
|
||||
if (option.Move.Move.Category == MoveCategory.Status)
|
||||
return;
|
||||
var damage = option.EstimatedDamage;
|
||||
if (target.Volatile.TryGet<SubstituteEffect>(out var substitute))
|
||||
{
|
||||
var health = substitute.Health;
|
||||
score += (int)Math.Min(15.0f * damage / health, 20);
|
||||
return;
|
||||
}
|
||||
|
||||
score += (int)Math.Min(15.0f * damage / target.CurrentHealth, 30);
|
||||
|
||||
if (damage > target.CurrentHealth * 1.1f)
|
||||
{
|
||||
score += 10;
|
||||
if ((option.Move.Move.HasFlag("multi_hit") && target.CurrentHealth == target.MaxHealth &&
|
||||
target.ActiveAbility?.Name == "sturdy") || target.HasHeldItem("focus_sash"))
|
||||
{
|
||||
score += 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user