26 lines
641 B
ActionScript
26 lines
641 B
ActionScript
namespace Pokemon{
|
|
[ItemUse effect=heal]
|
|
class HealItem : ItemUseScript {
|
|
uint _amount;
|
|
|
|
void OnInitialize(const array<EffectParameter@> &in parameters) override {
|
|
_amount = uint(parameters[0].AsInt());
|
|
}
|
|
|
|
bool IsItemUsable() override {
|
|
return true;
|
|
}
|
|
|
|
bool IsPokemonUseItem() override {
|
|
return true;
|
|
}
|
|
|
|
bool IsUseValidForPokemon(Pokemon@ pokemon) override {
|
|
return pokemon.CurrentHealth < pokemon.MaxHealth;
|
|
}
|
|
|
|
void OnPokemonUse(Pokemon@ pkmn) override {
|
|
pkmn.Heal(_amount);
|
|
}
|
|
}
|
|
} |