More moves
This commit is contained in:
@@ -315,7 +315,7 @@ public interface IPokemon : IScriptSource, IDeepCloneable
|
||||
/// <summary>
|
||||
/// Damages the Pokemon by a certain amount of damage, from a damage source.
|
||||
/// </summary>
|
||||
void Damage(uint damage, DamageSource source, EventBatchId batchId = default);
|
||||
void Damage(uint damage, DamageSource source, EventBatchId batchId = default, bool forceDamage = false);
|
||||
|
||||
/// <summary>
|
||||
/// Forces the Pokémon to faint.
|
||||
@@ -326,7 +326,7 @@ public interface IPokemon : IScriptSource, IDeepCloneable
|
||||
/// 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.
|
||||
/// </summary>
|
||||
bool Heal(uint heal, bool allowRevive = false);
|
||||
bool Heal(uint heal, bool allowRevive = false, EventBatchId batchId = default, bool forceHeal = false);
|
||||
|
||||
/// <summary>
|
||||
/// Restores all PP of the Pokemon.
|
||||
@@ -943,12 +943,12 @@ public class PokemonImpl : ScriptSource, IPokemon
|
||||
public bool IsFainted => CurrentHealth == 0;
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Damage(uint damage, DamageSource source, EventBatchId batchId)
|
||||
public void Damage(uint damage, DamageSource source, EventBatchId batchId, bool forceDamage = false)
|
||||
{
|
||||
// If the Pokémon is already fainted, we don't need to do anything.
|
||||
if (IsFainted)
|
||||
return;
|
||||
if (BattleData is not null)
|
||||
if (BattleData is not null && !forceDamage)
|
||||
{
|
||||
var dmg = damage;
|
||||
this.RunScriptHook(script => script.ChangeIncomingDamage(this, source, ref dmg));
|
||||
@@ -1013,7 +1013,7 @@ public class PokemonImpl : ScriptSource, IPokemon
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool Heal(uint heal, bool allowRevive)
|
||||
public bool Heal(uint heal, bool allowRevive, EventBatchId batchId = default, bool forceHeal = false)
|
||||
{
|
||||
if (IsFainted && !allowRevive)
|
||||
return false;
|
||||
@@ -1023,13 +1023,19 @@ public class PokemonImpl : ScriptSource, IPokemon
|
||||
heal = maxAmount;
|
||||
if (heal == 0)
|
||||
return false;
|
||||
var prevented = false;
|
||||
this.RunScriptHook(x => x.PreventHeal(this, heal, allowRevive, ref prevented));
|
||||
if (prevented)
|
||||
return false;
|
||||
if (!forceHeal)
|
||||
{
|
||||
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));
|
||||
BattleData?.Battle.EventHook.Invoke(new HealEvent(this, CurrentHealth, newHealth)
|
||||
{
|
||||
BatchId = batchId,
|
||||
});
|
||||
CurrentHealth = newHealth;
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user