Loads of work on getting data ready.
This commit is contained in:
26
Scripts/Items/heal_item.as
Normal file
26
Scripts/Items/heal_item.as
Normal file
@@ -0,0 +1,26 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user