Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#1 2015-11-22 14:36:18

Schattenjäger
Member
Registered: 2015-10-21
Post 15/25

Display Effectiveness for Dual Types

One of the bugs/glitches/errors in Red and Blue was the effectiveness display when a dual type pokémon was attacked. This confused me a lot as a kid. For instance, Grass-type moves do neutral damage to Gyarados, but if Gyarados is hit by a Grass-type move, the game erroneously states that the attack is "Not Very Effective". The damage itself is neutral, but the wrong text and sound effect are displayed.

display_effectiveness in pokered looks like this:

DisplayEffectiveness: ; 2fb7b (b:7b7b)
ld a, [wDamageMultipliers]
and a, $7F
cp a, $0A
ret z
ld hl, SuperEffectiveText
jr nc, .done
ld hl, NotVeryEffectiveText
.done
jp PrintText

Has anyone gotten around fixing this? I'm sure it's easy and could probably be fixed by shifting right/left at some point, but I'm not sure where to begin.

Offline

#2 2015-11-22 15:32:30

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 3,180/3,471

Re: Display Effectiveness for Dual Types

I know _Crystal has done it, but I was having trouble finding some of the routines he modified (it was more than just this one) to port the changes over since he has been redoing a lot of the engine. I'm planning to look into it again at some point but in the meantime, maybe he can help you.

Offline

#3 2015-11-22 16:08:05

Crystal_
Member
From: Spain
Registered: 2012-09-16
Post 346/417
Website

Re: Display Effectiveness for Dual Types

The problem is that the effectiveness against the first type is lost, since wDamageMultipliers gets overwritten during the calculation of the second type matchup.  I got around it by storing type matchups as flags instead of using the whole wDamageMultipliers byte to keep track of each type matchup. This way we can determine the effectiveness depending on which bits are set.

At a glance: https://github.com/xCrystal/pokered/com … a9384R1017

Neutral is now value 0 so we have to initialize wDamageMultipliers to 0 (instead of to $a). We also have to make sure to set the appropriate bit after each type matchup check if super effective or not very effective. If immune we just set al bits except bit 7 which is for STAB (we don't care about STAB anyway since it will do 0 damage): https://github.com/xCrystal/pokered/com … 131aaR1187

Then determine the result based on which bits are set.
Message: https://github.com/xCrystal/pokered/com … d49f0790R5
Sound: https://github.com/xCrystal/pokered/com … 4256dR2949

Last edited by Crystal_ (2015-11-22 16:08:48)

Offline

#4 2015-11-22 22:01:24

Fotomac
Member
Registered: 2015-10-25
Post 92/294

Re: Display Effectiveness for Dual Types

This is one fix I'm not planning on applying to my hack; it just makes the game more interesting for me, especially when I'm pitting a Weedle against a Weedle and we're attacking each other without any risk of Poison, with each attack punctuated by the usual "super effective" sound effect and the "It's super effective!" message, which only (in my opinion, at least) serves to make an otherwise dull early battle that much more awesome.

Offline

#5 2015-11-22 23:44:10

Schattenjäger
Member
Registered: 2015-10-21
Post 16/25

Re: Display Effectiveness for Dual Types

Thanks to you both, Mateo and Crystal_!

And Fotomac: Well, I guess that's one way of looking at it. :) Personally, I suffer from such a severe case of assburgerism where things "have to make sense" that the error really rubs me the wrong way, hah.

Last edited by Schattenjäger (2015-11-22 23:46:53)

Offline

Board footer

Powered by FluxBB