Getting started with implementing an explicit AI, based on the Essentials one.
All checks were successful
Build / Build (push) Successful in 1m2s
All checks were successful
Build / Build (push) Successful in 1m2s
This commit is contained in:
@@ -30,21 +30,10 @@ public class HighestDamageAI : PokemonAI
|
||||
: battle.Library.MiscLibrary.ReplacementChoice(pokemon, opponentSide, 0);
|
||||
}
|
||||
|
||||
var movesWithDamage = moves.Select(move =>
|
||||
var movesWithDamage = moves.Select(move => new
|
||||
{
|
||||
var hitData = new CustomHitData
|
||||
{
|
||||
BasePower = move.MoveData.BasePower,
|
||||
Effectiveness =
|
||||
battle.Library.StaticLibrary.Types.GetEffectiveness(move.MoveData.MoveType, opponent.Types),
|
||||
Type = move.MoveData.MoveType,
|
||||
};
|
||||
return new
|
||||
{
|
||||
Move = move,
|
||||
Damage = battle.Library.DamageCalculator.GetDamage(null, move.MoveData.Category, pokemon, opponent, 1,
|
||||
0, hitData),
|
||||
};
|
||||
Move = move,
|
||||
Damage = AIHelpers.CalculateDamageEstimation(move.MoveData, pokemon, opponent, battle.Library),
|
||||
}).OrderByDescending(x => x.Damage).FirstOrDefault();
|
||||
if (movesWithDamage is null)
|
||||
{
|
||||
@@ -53,41 +42,4 @@ public class HighestDamageAI : PokemonAI
|
||||
var bestMove = movesWithDamage.Move;
|
||||
return new MoveChoice(pokemon, bestMove, opponentSide, 0);
|
||||
}
|
||||
|
||||
private class CustomHitData : IHitData
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public bool IsCritical => false;
|
||||
|
||||
/// <inheritdoc />
|
||||
public ushort BasePower { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public float Effectiveness { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public uint Damage => 0;
|
||||
|
||||
/// <inheritdoc />
|
||||
public TypeIdentifier? Type { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool IsContact => false;
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool HasFailed => false;
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Fail()
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void SetFlag(StringKey flag)
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool HasFlag(StringKey flag) => false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user