2021-03-28 18:22:46 +00:00
|
|
|
namespace Pokemon{
|
|
|
|
[ItemUse effect=heal]
|
|
|
|
class HealItem : ItemUseScript {
|
|
|
|
uint _amount;
|
|
|
|
|
2021-10-23 12:20:18 +00:00
|
|
|
void OnInitialize(const narray<EffectParameter@>@ parameters) override {
|
2021-03-28 18:22:46 +00:00
|
|
|
_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;
|
|
|
|
}
|
|
|
|
|
2022-02-19 14:59:27 +00:00
|
|
|
void OnPokemonUse(Pokemon@ pkmn, bool isBattleUse) override {
|
2021-03-28 18:22:46 +00:00
|
|
|
pkmn.Heal(_amount);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|