Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#1 2013-09-29 20:12:28

Crystal_
Member
From: Spain
Registered: 2012-09-16
Post 106/434
Website

Bug catching contest formula?

I know what the formula is:

(Maximum HP * 4) + Attack + Defense + Speed + Sp.Attack + Sp.Defense + A + int(Current HP/8)+B

A is based on the diversification values (DVs, individual values) of the caught Pokémon:
A starts with 0.
If half the Defense DV, rounded down, is odd, add 16 to A.
If half the Attack DV, rounded down, is odd, add 8 to A.
If half the Special DV, rounded down, is odd, add 4 to A.
If half the Speed DV, rounded down, is odd, add 1 to A.
If the Pokémon is holding an item, B is 1; otherwise B is 0.

but I can't find it in the Pokemon Crystal ROM. I went nuts searching for multiply calls and consectutive left shifts, but with no result. So my last hope is that maybe someone has toyed with it for a hack or something knows where it is located.

Offline

#2 2013-09-29 20:25:51

Miksy91
Member
Registered: 2010-10-16
Post 1,910/2,317

Re: Bug catching contest formula?

Umm... what? What is this formula about, and what should the result of it express?

P.S
The remaining 4 bits of Speed/Special DV value are used for both Sp. Attack and Sp. Defense.

Offline

#3 2013-09-29 20:53:16

Crystal_
Member
From: Spain
Registered: 2012-09-16
Post 107/434
Website

Re: Bug catching contest formula?

Miksy91 wrote:

Umm... what? What is this formula about, and what should the result of it express?[/qoute]

The amount of points given for each Pokemon in the bug catching contest. (that then determine whether you finish 1st, 2nd on 3rd and receive a prize accordingly).

P.S
The remaining 4 bits of Speed/Special DV value are used for both Sp. Attack and Sp. Defense.

Yeah, I just took the formula right from UPC. I suppose that the 4 special bytes are added twice.

Offline

#4 2013-09-30 06:27:04

Miksy91
Member
Registered: 2010-10-16
Post 1,911/2,317

Re: Bug catching contest formula?

Crystal_ wrote:

Yeah, I just took the formula right from UPC. I suppose that the 4 special bytes bits are added twice.

Yeah, but what is this about? What should the result even express?

On the other hand, you probably won't find values such as "HP * 4" because we can pick up a data value, such as "HP" here, and do mathematical operations to it (with asm) to multiply it by 4.

Last edited by Miksy91 (2013-09-30 06:27:19)

Offline

#5 2013-09-30 08:37:09

Crystal_
Member
From: Spain
Registered: 2012-09-16
Post 108/434
Website

Re: Bug catching contest formula?

sorry lol I answered your first question into the quote!

The amount of points given for each Pokemon in the bug catching contest. (that then determine whether you finish 1st, 2nd on 3rd and receive a prize accordingly).

^That's what the formula does.

(you may remeber winning lots of everstones in the contest with around 340 points, right? So it's this formula what determines that you got those 340 points.)

Offline

#6 2013-09-30 08:49:04

Miksy91
Member
Registered: 2010-10-16
Post 1,912/2,317

Re: Bug catching contest formula?

Crystal_ wrote:

sorry lol I answered your first question into the quote!

The amount of points given for each Pokemon in the bug catching contest. (that then determine whether you finish 1st, 2nd on 3rd and receive a prize accordingly).

I see.
In that case, I believe all the values are simply taken from battle ram memory. Some simple calculations are done with them, and that leads to the amount of points given after the battle.

How does bug catching contest even work? If you catch a pokemon, you'll get a certain amount of battle points for doing that right? If so, when you do that, some routine that does these calculations is run and stores the amount of received points somewhere in ram (by adding that to the original value that was stored there).

Crystal_ wrote:

(you may remeber winning lots of everstones in the contest with around 340 points, right? So it's this formula what determines that you got those 340 points.)

I don't remember ever getting that item as a prize from the contest, hahha!
(haven't really played bug catching contest much, or gsc as themselves for that matter either.)

Edit:
Anyways... to locate the routine easily, first look for the text string "HIRO had xxx points" or however it is displayed in the game (in other words, the sentence that displays the amount of points you have from the ram after the contest ends). Check what the ram address is and open the rom with bgb emulator. Set a breakpoint to that ram address and enter a battle. Catch the pokemon you run into, and that address is being written to. Now at this point, you have reached the end of the routine that does what you're looking for.

(This is just an assumption of how to find where the routine is. If it doesn't work, try figuring something else.)

Last edited by Miksy91 (2013-09-30 08:54:15)

Offline

#7 2013-09-30 19:46:03

Crystal_
Member
From: Spain
Registered: 2012-09-16
Post 109/434
Website

Re: Bug catching contest formula?

Ended up in some code that is indeed related to the bug catching contest but still, I can't find any formula. Thanks for your help anyway.

Offline

#8 2013-09-30 19:53:32

Miksy91
Member
Registered: 2010-10-16
Post 1,914/2,317

Re: Bug catching contest formula?

You'll need a bit more practice with following code with a debugger / asm editor. After you handle more and more "tricks" (backtracing, using contents of stack as help, etc.) you'll have a lot more possiblities for the debugger.

Last edited by Miksy91 (2013-09-30 19:54:23)

Offline

Board footer

Powered by FluxBB