Even more moves
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-05-05 16:58:03 +02:00
parent 292c303fc0
commit 7727f92f4e
132 changed files with 624 additions and 171 deletions

View File

@@ -76,9 +76,16 @@ public static class MoveTurnExecutor
if (failed)
{
// TODO: fail handling
executingMove.MoveChoice.Fail();
return;
}
ExecuteMove(executingMove);
if (executingMove.Hits.All(x => x.HasFailed) || (executingMove.UseMove.Category != MoveCategory.Status &&
executingMove.Hits.All(x => x.Damage == 0)))
{
executingMove.MoveChoice.Fail();
}
}
public static void ExecuteMove(IExecutingMove executingMove)

View File

@@ -20,7 +20,7 @@ public interface IHitData
/// <summary>
/// The base power of the hit.
/// </summary>
byte BasePower { get; }
ushort BasePower { get; }
/// <summary>
/// The effectiveness of the hit.
@@ -55,7 +55,7 @@ public record HitData : IHitData
public bool IsCritical { get; internal set; }
/// <inheritdoc />
public byte BasePower { get; internal set; }
public ushort BasePower { get; internal set; }
/// <inheritdoc />
public float Effectiveness { get; internal set; }

View File

@@ -76,6 +76,11 @@ public interface ILearnedMove : IDeepCloneable
/// </summary>
bool TryUse(byte amount = 1);
/// <summary>
/// Reduce the remaining PP by a certain amount. If the number of PP is already 0, return false.
/// </summary>
bool ReduceUses(byte amount = 1);
/// <summary>
/// Set the remaining PP to the max amount of PP.
/// </summary>
@@ -139,6 +144,20 @@ public class LearnedMoveImpl : ILearnedMove
return true;
}
/// <inheritdoc />
public bool ReduceUses(byte amount = 1)
{
if (CurrentPp == 0)
return false;
if (CurrentPp >= amount)
CurrentPp -= amount;
else
CurrentPp = 0;
return true;
}
/// <summary>
/// Restore the PP to the maximum amount of PP.
/// </summary>

View File

@@ -403,6 +403,12 @@ public interface IPokemon : IScriptSource, IDeepCloneable
/// </summary>
void ChangeAbility(IAbility ability);
/// <summary>
/// Whether the Pokémon is levitating. This is used for moves like Magnet Rise, and abilities such as
/// Levitate.
/// </summary>
bool IsFloating { get; }
/// <summary>
/// Converts the data structure to a serializable format.
/// </summary>
@@ -1206,6 +1212,17 @@ public class PokemonImpl : ScriptSource, IPokemon
}
}
/// <inheritdoc />
public bool IsFloating
{
get
{
var isFloating = Types.Any(x => x.Name == "flying");
this.RunScriptHook(x => x.IsFloating(this, ref isFloating));
return isFloating;
}
}
/// <inheritdoc />
public SerializedPokemon Serialize() => new(this);