-
Notifications
You must be signed in to change notification settings - Fork 186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cancel battle action if getting restriction state added by an event #2385
Conversation
If a battler gets a restriction state added by an event his battle action gets canceled.
@@ -370,6 +370,9 @@ bool Game_Battler::AddState(int state_id, bool allow_battle_states) { | |||
if (GetSignificantRestriction() != lcf::rpg::State::Restriction_normal) { | |||
SetIsDefending(false); | |||
SetCharged(false); | |||
if (GetBattleAlgorithm() != nullptr) { | |||
this->SetBattleAlgorithm(std::make_shared<Game_BattleAlgorithm::NoMove>(this)); | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, this is the right approach.
However, it's not clear whether this should be NoMove
Null
or if we just set the algo itself to nullptr
. Need to test the behavior carefully in 2k and 2k3.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At first I tried nullptr
but this approach throwed Invalid battle action
error messages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, nullptr
would mean it's up to the battle system to decide what to do, which would require more changes elsewhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could give a State that autocures 100% after 1 turn to test this. When it is healed in RPG_RT then NoMove is appropriate here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using NoMove works for me in your test case.
So the real difference between https://github.com/EasyRPG/Player/blob/master/src/scene_battle_rpg2k.cpp#L513
Both of them still cause battlers to process state changes. So in short, try to hit an enemy with a paralyze state before their turn, and then see if they flash or not. Make sure to test with no state messages displayed as messages also cause flash to occur, even for null. |
Oh right. I forgot that there is also a null action. Thought you mean nullptr |
@fmatthew5876 I did the test with RPG_RT now and if a paralyzed enemy is hit no flash occurs with state messages disabled. In EasyRPG the paralyzed enemy flashes on its turn but that already occurred before this PR. |
I'm ok with accepting this PR as it is, but please write up a new issue for flashing inconsistency with 2k battles. It may be more than just this PR. |
Submitted the issue now (#2388). |
This PR fixes #2169.
If a battler gets a restriction state added by an event his battle action gets canceled.