Skip to content
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

Fix Item usability in battle - Previously Albeleon 2.30 #1482

Merged
merged 1 commit into from Nov 7, 2018

Conversation

Projects
None yet
4 participants
@fmatthew5876
Copy link
Contributor

fmatthew5876 commented Nov 5, 2018

2.30: RM2000 + RM2003: Mark as "unusable" the objects of type "speci

If I understand this correctly the purpose of the new line in ÌsitemUsable is to ensure that the items are always selectable semi-ot: occasion_field1 is btw confusing, maybe we should think about a better name

I see multiple flaws here:
item.actor_set could be also item.class_set, therefore we should fine a way to get this handled by IsItemUsable imo. (maybe move the check from IsItemUsable to CheckEnable, then the codepath is free)

Also actor_set could be smaller than the ID, resulting in an out-of-bounds read.

@fmatthew5876 fmatthew5876 changed the title "2.30: RM2000 + RM2003: Mark as "unusable" the objects of type "speci… Albeleon Battle Fixes 2.5 of N Nov 5, 2018

@fmatthew5876 fmatthew5876 force-pushed the fmatthew5876:alb_2.30 branch from 3ab80e1 to c220128 Nov 6, 2018

@fmatthew5876 fmatthew5876 changed the title Albeleon Battle Fixes 2.5 of N 2.30: RM2000 + RM2003: Mark as "unusable" the objects of type "speci… Nov 6, 2018

@fmatthew5876

This comment has been minimized.

Copy link
Contributor Author

fmatthew5876 commented Nov 6, 2018

I've checked and the following behavior exists in battles when the item is not "usable"

RM2k:

  • Special: Actor cannot select the item
  • Medicine: Anyone can use, but if used on actor who cannot use then there is no effect.
  • Book: Cannot be used in battle

RM2k3:

  • Special: Actor cannot select the item
  • Equipment with skill use: Actor cannot select the item
  • Book: Cannot be used in battle
  • Medicine:
    • equipment_setting == actor: Anyone can select, but if used on actor who cannot use then there is no effect.
    • equipment_setting == class: Anyone can select, even if class is set to not usable! (BUG in rm2k3)?

@CherryDT Maybe another rm2k3 bug here for you.

@fmatthew5876 fmatthew5876 force-pushed the fmatthew5876:alb_2.30 branch 2 times, most recently from 29b896c to 674d96e Nov 6, 2018

@fmatthew5876

This comment has been minimized.

Copy link
Contributor Author

fmatthew5876 commented Nov 6, 2018

I've reimplemented this from scratch. Tested the behavior against both rm2k and rm2k3. All matching.

I've opted to fix the rm2k3 class bug here.

@fmatthew5876 fmatthew5876 changed the title 2.30: RM2000 + RM2003: Mark as "unusable" the objects of type "speci… Fix Item usability in battle - Previously Albeleon 2.30 Nov 6, 2018

@Ghabry Ghabry added this to the 0.5.5 (or 0.6.0) -> we will see milestone Nov 6, 2018

@@ -1243,6 +1243,11 @@ bool Game_BattleAlgorithm::Item::Execute() {

if (item.type == RPG::Item::Type_medicine) {
this->healing = true;
if (GetTarget()->GetType() == Game_Battler::Type_Ally && !static_cast<Game_Actor*>(GetTarget())->IsItemUsable(item.ID)) {
//No effect, but doesn't behave like a dodge or damage to set healing and success to true.

This comment has been minimized.

@Ghabry

Ghabry Nov 6, 2018

Member

whitespace after //

@Ghabry

This comment has been minimized.

Copy link
Member

Ghabry commented Nov 6, 2018

Could you add a comment to Game_Battler:IsItemUsable which mentions this bug (that RPG2k3 only cares about actor_set for medicine in battle)? Better preserve this knowledge, if this is ever a problem later.

@CherryDT

This comment has been minimized.

Copy link

CherryDT commented Nov 6, 2018

Another thing which I'd put as "compat mode"...
There are so many bugs, especially in RM2k3, which are for me a conflict between "supporting existing RM games" and "building a game engine usable on its own which can be even better than RM"

@Ghabry

This comment has been minimized.

Copy link
Member

Ghabry commented Nov 6, 2018

I find this bug especially silly because first they added this ridiculous global radio button and then they failed to implement it correctly. 😥

How to do this compat mode thing? Maybe add a new enum to "Player::engine" (EngineEasyRPG and when this is set by a (default) setting in our editor the compat mode is off)

Correctly handle item usability in battle
* Medicines always selectable by all, but silently no effect
  if used on actor who cannot use.
* Other items not selectable if not usable.
* Rm2k3 has a bug where medicines always usable if
  equipment_setting == class. We fix the bug here.

@fmatthew5876 fmatthew5876 force-pushed the fmatthew5876:alb_2.30 branch from 674d96e to 4010ba2 Nov 6, 2018

@fmatthew5876

This comment has been minimized.

Copy link
Contributor Author

fmatthew5876 commented Nov 6, 2018

Fixed comments. I put the bug comment in battlealgorithm, because Game_Actor::IsItemUsable() is also used by the menu in the field, and here it behaves correctly.

@Ghabry

Ghabry approved these changes Nov 6, 2018

@carstene1ns carstene1ns added the Battle label Nov 7, 2018

@carstene1ns carstene1ns merged commit 02c402e into EasyRPG:master Nov 7, 2018

6 checks passed

Android (armeabi-v7a) Build finished.
Details
GNU/Linux Build finished.
Details
OSX Build finished.
Details
Windows (x64) Build finished.
Details
Windows (x86) Build finished.
Details
web Build finished.
Details

@fmatthew5876 fmatthew5876 deleted the fmatthew5876:alb_2.30 branch Nov 15, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.