More move scripts
This commit is contained in:
@@ -487,6 +487,7 @@ public class PokemonImpl : ScriptSource, IPokemon
|
||||
WeightInKg = form.Weight;
|
||||
HeightInMeters = form.Height;
|
||||
Happiness = species.BaseHappiness;
|
||||
Volatile = new ScriptSet(this);
|
||||
if (!library.StaticLibrary.Natures.TryGet(natureName, out var nature))
|
||||
throw new KeyNotFoundException($"Nature {natureName} not found.");
|
||||
Nature = nature;
|
||||
@@ -532,6 +533,7 @@ public class PokemonImpl : ScriptSource, IPokemon
|
||||
AbilityIndex = form.FindAbilityIndex(ability) ??
|
||||
throw new KeyNotFoundException(
|
||||
$"Ability {ability.Name} not found on species {species.Name} form {form.Name}.");
|
||||
Volatile = new ScriptSet(this);
|
||||
_learnedMoves = serializedPokemon.Moves.Select(move =>
|
||||
{
|
||||
if (move == null)
|
||||
@@ -736,7 +738,7 @@ public class PokemonImpl : ScriptSource, IPokemon
|
||||
public ScriptContainer StatusScript { get; } = new();
|
||||
|
||||
/// <inheritdoc />
|
||||
public IScriptSet Volatile { get; } = new ScriptSet();
|
||||
public IScriptSet Volatile { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool HasHeldItem(StringKey itemName) => HeldItem?.Name == itemName;
|
||||
@@ -1097,6 +1099,11 @@ public class PokemonImpl : ScriptSource, IPokemon
|
||||
{
|
||||
if (!Library.ScriptResolver.TryResolve(ScriptCategory.Status, status, null, out var statusScript))
|
||||
throw new KeyNotFoundException($"Status script {status} not found");
|
||||
var preventStatus = false;
|
||||
this.RunScriptHook(script => script.PreventStatusChange(this, status, ref preventStatus));
|
||||
if (preventStatus)
|
||||
return false;
|
||||
|
||||
StatusScript.Set(statusScript);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user