fix:Status healing berries preventing from healing-by-rest#77
Open
gikouw wants to merge 3 commits intoFlame442:masterfrom
Open
fix:Status healing berries preventing from healing-by-rest#77gikouw wants to merge 3 commits intoFlame442:masterfrom
gikouw wants to merge 3 commits intoFlame442:masterfrom
Conversation
Flame442
requested changes
Dec 16, 2024
| self.current = status | ||
| self.sleep_timer.set_turns(turns) | ||
| msg += f"{self.pokemon.name} fell asleep{source}!\n" | ||
| if self.pokemon.last_move.effect == 38: |
Owner
There was a problem hiding this comment.
Similar to #76, the more correct way to check for the move is the use the move argument to apply_status. That ensures the move is being used to apply the status, rather than just hoping the last move is the correct one.
| @@ -700,9 +700,6 @@ def use(self, attacker, defender, battle, *, use_pp=True, override_sleep=False, | |||
| msg += defender.nv.apply_status("sleep", battle, attacker=attacker, move=self) | |||
| if self.effect == 38: | |||
| msg += attacker.nv.apply_status("sleep", battle, attacker=attacker, move=self, turns=3, force=True) | |||
Owner
There was a problem hiding this comment.
I would add a comment here that the healing logic is handled in apply_status.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously
The eat_berry function was called before healing and healing was bounded with the condition of sleep which can be already cured by lum berry or chesto berry therefore the pokemon never gets healed
Changes
Moved the healing block of code into the apply status function itself.
healing the pokemon(move user) if the status being applied is sleep(by self) and the pokemon is successfully induced to sleep and the last move used is rest
now, eat_berry function is called after healing.
the only way this could break is if the (last move stays rest(of the user) AND the sleep status is applied by some other behavior by the user)
which is not possible as of my understanding