From 06d1da3d3c416706eee70a48d396e369ce675b1b Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Sat, 19 Feb 2022 15:59:27 +0100 Subject: [PATCH] Implements cheek pouch --- Scripts/Abilities/CheekPouch.as | 10 ++++++++++ Scripts/Interfaces/ItemUseScript.as | 4 ++-- Scripts/Interfaces/PkmnScript.as | 1 + Scripts/Items/heal_item.as | 2 +- fetch_tester.sh | 2 +- 5 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 Scripts/Abilities/CheekPouch.as diff --git a/Scripts/Abilities/CheekPouch.as b/Scripts/Abilities/CheekPouch.as new file mode 100644 index 0000000..f40e566 --- /dev/null +++ b/Scripts/Abilities/CheekPouch.as @@ -0,0 +1,10 @@ +namespace Gen7 { + [Ability effect=CheekPouch] + class CheekPouch : PkmnScript { + void OnAfterHeldItemConsume(Pokemon@ pokemon, const Item@ item) override { + if (item.HasFlag("berry")){ + pokemon.Heal(pokemon.MaxHealth / 4); + } + }; + } +} \ No newline at end of file diff --git a/Scripts/Interfaces/ItemUseScript.as b/Scripts/Interfaces/ItemUseScript.as index 3eccb19..dc936c5 100644 --- a/Scripts/Interfaces/ItemUseScript.as +++ b/Scripts/Interfaces/ItemUseScript.as @@ -4,6 +4,6 @@ shared abstract class ItemUseScript { bool IsPokemonUseItem(){ return false; }; bool IsUseValidForPokemon(Pokemon@){ return false; }; bool IsHoldable(){ return false; }; - void OnUse(){}; - void OnPokemonUse(Pokemon@){}; + void OnUse(Battle@){}; + void OnPokemonUse(Pokemon@, bool){}; } diff --git a/Scripts/Interfaces/PkmnScript.as b/Scripts/Interfaces/PkmnScript.as index 666e380..46c7389 100644 --- a/Scripts/Interfaces/PkmnScript.as +++ b/Scripts/Interfaces/PkmnScript.as @@ -45,6 +45,7 @@ shared abstract class PkmnScript { void OnEndTurn(){}; void OnDamage(Pokemon@, DamageSource, uint, uint){}; void OnFaint(Pokemon@, DamageSource){}; + void OnAfterHeldItemConsume(Pokemon@, const Item@){}; void PreventIncomingCritical(ExecutingMove@, Pokemon@, uint8, bool &inout){}; void ModifyCriticalStage(ExecutingMove@, Pokemon@, uint8, uint8 &inout){}; void OverrideCriticalModifier(ExecutingMove@, Pokemon@, uint8, float &inout){}; diff --git a/Scripts/Items/heal_item.as b/Scripts/Items/heal_item.as index ceb3638..5486788 100644 --- a/Scripts/Items/heal_item.as +++ b/Scripts/Items/heal_item.as @@ -19,7 +19,7 @@ namespace Pokemon{ return pokemon.CurrentHealth < pokemon.MaxHealth; } - void OnPokemonUse(Pokemon@ pkmn) override { + void OnPokemonUse(Pokemon@ pkmn, bool isBattleUse) override { pkmn.Heal(_amount); } } diff --git a/fetch_tester.sh b/fetch_tester.sh index 7c8edbd..ee74028 100755 --- a/fetch_tester.sh +++ b/fetch_tester.sh @@ -1,6 +1,6 @@ #!/bin/sh -TESTERVERSION=0.0.14 +TESTERVERSION=0.0.15 # Get the release information from the api for the specified version curl -X GET "https://git.p-epsilon.com/api/v1/repos/Deukhoofd/PokemonScriptTester/releases/tags/$TESTERVERSION" -H "accept: application/json" |