Implements a bunch more moves
This commit is contained in:
@@ -255,7 +255,7 @@ public class BattleSideImpl : ScriptSource, IBattleSide
|
||||
}
|
||||
}
|
||||
Battle.EventHook.Invoke(new SwitchEvent(Index, position, pokemon));
|
||||
pokemon.RunScriptHook(script => script.OnSwitchIn(pokemon));
|
||||
pokemon.RunScriptHook(script => script.OnSwitchIn(pokemon, position));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -317,6 +317,11 @@ public interface IPokemon : IScriptSource, IDeepCloneable
|
||||
/// </summary>
|
||||
void Damage(uint damage, DamageSource source, EventBatchId batchId = default);
|
||||
|
||||
/// <summary>
|
||||
/// Forces the Pokémon to faint.
|
||||
/// </summary>
|
||||
void Faint(DamageSource source, EventBatchId batchId = default);
|
||||
|
||||
/// <summary>
|
||||
/// Heals the Pokemon by a specific amount. Unless allow_revive is set to true, this will not
|
||||
/// heal if the Pokemon has 0 health. If the amount healed is 0, this will return false.
|
||||
@@ -967,6 +972,13 @@ public class PokemonImpl : ScriptSource, IPokemon
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Faint(DamageSource source, EventBatchId batchId = default)
|
||||
{
|
||||
CurrentHealth = 0;
|
||||
OnFaint(source);
|
||||
}
|
||||
|
||||
private void OnFaint(DamageSource source)
|
||||
{
|
||||
// If the Pokémon is not in a battle, we don't need to do anything.
|
||||
@@ -996,11 +1008,17 @@ public class PokemonImpl : ScriptSource, IPokemon
|
||||
{
|
||||
if (IsFainted && !allowRevive)
|
||||
return false;
|
||||
|
||||
var maxAmount = BoostedStats.Hp - CurrentHealth;
|
||||
if (heal > maxAmount)
|
||||
heal = maxAmount;
|
||||
if (heal == 0)
|
||||
return false;
|
||||
var prevented = false;
|
||||
this.RunScriptHook(x => x.PreventHeal(this, heal, allowRevive, ref prevented));
|
||||
if (prevented)
|
||||
return false;
|
||||
|
||||
var newHealth = CurrentHealth + heal;
|
||||
BattleData?.Battle.EventHook.Invoke(new HealEvent(this, CurrentHealth, newHealth));
|
||||
CurrentHealth = newHealth;
|
||||
|
||||
Reference in New Issue
Block a user