An interesting find with stats.

Discuss anything related to hacking ROMs of the Telefang games here.
Blaziken257
Posts: 983
Joined: Fri Dec 22, 2006 11:52 am

Re: An interesting find with stats.

Post by Blaziken257 »

I was playing with Corrupt, and I happened to find another variable that influences a Denjuu's stats. Why is it that when you hack a Denjuu's base stats to all be the same, the stats themselves are all different? For example, if you hack Crypto's base stats all to 10, he'll have 14 HP, 12 Speed, 16 Attack, 14 Defense, 12 Denma Attack, and 12 Denma Defense at Level 5. That doesn't even make any sense! And why is is that two Denjuu can have the same base stats, yet have different max stats? For example, Fungus and Keshi both have base Speeds of 14, but their max Speeds are 112 and 63, respectively -- a difference of 49! So there HAS to be something else influencing stats!

Well, guess what... now I found it.

You see, there are variables (which I will call "Level Influence" throughout this topic) that make certain stats increase faster than others when a Denjuu raises levels. These variables are in offsets $9C715-$9CB28, and there are 6 bytes for every Denjuu, which makes sense, because each Denjuu has 6 stats (HP, Speed, Attack, Defense, Denma Attack, and Denma Defense in that order). Essentially, the higher the variables, the more a stat raises when it levels up. I experimented with these variables to find what exactly how they worked. I set all these variables to 100 for every Denjuu, then looked at the stats of low-level Denjuu. I found the following:

Lv. 2: 50 + Base Stat
Lv. 3: 100 + Base Stat
Lv. 4: 150 + Base Stat
Lv. 5: 200 + Base Stat

See a pattern here? For every level increased, the stat increases by half of the Level Influence. Or if you want to look at it another way, for every two levels, the stat increases by the Level Influence. I changed these values and got similar results (e.g. when I changed them to 50, the stats increased by 25 each level). These Level Influence variables are multiplied by the level subtracted by 1, then divided by 2, and finally added to the base stat. Actually, a formula might help:

Stat = Base stat + (Level - 1) * Level Influence / 2

This looks confusing, though not as much as the stat formula in Pokémon. And I could figure it out without any assembly code, too!

Also, some notes:

- If a stat exceeds 255, it will be reduced mod 256. So, if a stat ends up being 256, it will become 0. 257->1, 258->2, 259->3, 260->4, and so on. In practice, this never happens, because the designers were careful to prevent this. Just be aware of this if you plan to hack Denjuu's stats. (This means Level Influence variables should never be any higher than 5. If it's at 5, the highest base stat you can have without overflow is 10. If it's at 4, the highest base stat you can have without overflow is 59, which is higher than anything in the game. At 3, the highest base stat you can have is 108; at 2, it's 157, and at 1, it's 206.)

- If a stat ends up being a fraction (which is possible if the level is an even number, and the level influence is an odd number), it either rounds up or down depending on the situation. So far, I've only seen the stat round up if the Denjuu is at Level 2 (probably to balance it out). It seems to round down in all other cases. So if a Denjuu is at Level 2, a stat of 9.5 will become 10, but if a Denjuu is at any other level, then 9.5 would become 9.

- Because of the nature of the formula, if the level is 1 or the Level Influence is 0 (neither of which are possible without hacking), then the stat will be equal to the base stat. That's really low!

Now let's do an example with Crypto, and let's suppose it's at Level 5!

As we already established months ago, Crypto's base stats are: 38 HP, 10 Speed, 16 Attack, 10 Defense, 06 Denma Attack, 06 Denma Defense.

Now, we have to find the Level Influences. Since the offset of the data starts at $9C715, Crypto is Denjuu #5, and there are 6 bytes for every Denjuu, Crypto's data goes from $9C72D-$9C732. These bytes are:

02 01 03 02 01 01

This means for every two levels, Crypto will gain 2 HP, 1 Speed, 3 Attack (not very surprising), 2 Defense, 1 Denma Attack, and 1 Denma Defense.

Now that we have that, we are ready to do the math!

First, let's do HP:

HP = Base HP + (Level - 1) * Level Influence / 2
HP = 38 + (5 - 1) * 2 / 2
HP = 38 + 4 * 2 / 2
HP = 38 + 8 / 2
HP = 38 + 4
HP = 42

Now Speed:

Speed = Base Speed + (Level - 1) * Level Influence / 2
Speed = 10 + (5 - 1) * 1 / 2
Speed = 10 + 4 * 1 / 2
Speed = 10 + 2
Speed = 12

Now Attack:

Attack = Base Attack + (Level - 1) * Level Influence / 2
Attack = 16 + (5 - 1) * 3 / 2
Attack = 16 + 4 * 3 / 2
Attack = 16 + 12 / 2
Attack = 16 + 6
Attack = 22

See why Crypto has good Attack? Its base Attack is good, and it grows a lot per level!

Now Defense:

Defense = Base Defense + (Level - 1) * Level Influence / 2
Defense = 10 + (5 - 1) * 2 / 2
Defense = 10 + 4 * 2 / 2
Defense = 10 + 4
Defense = 14

Now Denma Attack:

Denma Attack = Base Denma Attack + (Level - 1) * Level Influence / 2
Denma Attack = 6 + (5 - 1) * 1 / 2
Denma Attack = 6 + 4 * 1 / 2
Denma Attack = 6 + 2
Denma Attack = 8

Finally, Denma Defense:

Denma Defense = Base Denma Defense + (Level - 1) * Level Influence / 2
Denma Defense = 6 + (5 - 1) * 1 / 2
Denma Defense = 6 + 4 * 1 / 2
Denma Defense = 6 + 2
Denma Defense = 8

Now it all makes sense! I would like to do one more example though, this time with a Level 2 Oshe:

Oshe's Base Stats are 32 HP, 08 Speed, 08 Attack, 11 Defense, 04 Denma Attack, and 04 Denma Defense. Oshe's data for level influence is from $9C721-$9C726. The data is:

02 01 02 02 01 01

So every 2 levels, Oshe gains 2 HP, 1 Speed, 2 Attack, 2 Defense, 1 Denma Attack, and 1 Denma Defense. Now let's find the stats!

HP:

HP = Base HP + (Level - 1) * Level Influence / 2
HP = 32 + (2 - 1) * 2 / 2
HP = 32 + 1 * 2 / 2
HP = 32 + 1
HP = 33

Speed:

Speed = Base Speed + (Level - 1) * Level Influence / 2
Speed = 8 + (2 - 1) * 1 / 2
Speed = 8 + 1 * 1 / 2
Speed = 8 + 1 / 2
Speed = 8.5

This one rounds up to 9. I think it rounds up because it's at Level 2. When a Denjuu is not at Level 2, I've seen it round down...

Attack:

Attack = Base Attack + (Level - 1) * Level Influence / 2
Attack = 8 + (2 - 1) * 2 / 2
Attack = 8 + 1 * 2 / 2
Attack = 8 + 1
Attack = 9

Defense:

Defense = Base Defense + (Level - 1) * Level Influence / 2
Defense = 11 + (2 - 1) * 2 / 2
Defense = 11 + 1 * 2 / 2
Defense = 11 + 1
Defense = 12

Denma Attack:

Denma Attack = Base Denma Attack + (Level - 1) * Level Influence / 2
Denma Attack = 4 + (2 - 1) * 1 / 2
Denma Attack = 4 + 1 * 1 / 2
Denma Attack = 4 + 1 / 2
Denma Attack = 4.5

Again, this one happens to round up, so it's 5.

Denma Defense

Denma Defense = Base Denma Defense + (Level - 1) * Level Influence / 2
Denma Defense = 4 + (2 - 1) * 1 / 2
Denma Defense = 4 + 1 * 1 / 2
Denma Defense = 4 + 1 / 2
Denma Defense = 4.5

Again, rounds up to 5.

So that's how stats work. And unlike Pokémon, there doesn't seem to be any DVs (random variables that make each Pokémon slightly different from each other) or EVs (variables that increase your stats from battling). Much simpler! Though, on the other hand, it seems a little too simple like this...

By the way, Telefang 2 might use the same pattern. Remember when each Denjuu seemed to have TWO base stats? Well one of them might affect the stat growth rate per level, just like this game! I need to figure out if it does!

And finally, I need to dump this data real soon... And maybe use it on Wikifang...
User avatar
andwhyisit
Site Admin
Posts: 1197
Joined: Fri Dec 14, 2007 9:24 pm

Re: An interesting find with stats.

Post by andwhyisit »

*builds a Blaziken257 shrine*

...

..what?

I really need to get a copy of Corrupt. Do we have the formula for calculating experience though? We could create a leveling table in Wikifang for every single Denjuu.
Blaziken257
Posts: 983
Joined: Fri Dec 22, 2006 11:52 am

Re: An interesting find with stats.

Post by Blaziken257 »

LOL... a shrine.

You should download Corrupt. I found it at the top of this page:

http://www.zophar.net/utilities/corruptutil.html

I don't have the formula for experience, though. Hopefully it isn't as complicated as Pokémon though.

Oh, and one last thing, I managed to dump the stat growth data. Of course, the numbers here represent how much the stats increase in two levels:

Code: Select all

                   HP  Spd Atk Def DAt DDf
#001 Tsunonasu    02  01  02  02  01  01 
#002 Kochia       02  02  02  02  02  01 
#003 Oshe         02  01  02  02  01  01 
#004 Keshi        02  01  02  02  02  02 
#005 Crypto       02  01  03  02  01  01 
#006 Monstera     03  01  02  02  02  02 
#007 Fungus       02  02  02  02  01  01 
#008 Hiougi       03  01  02  02  02  02 
#009 Punica       01  01  01  02  02  02 
#010 Gumi         03  01  02  02  02  01 
#011 Suguri       02  02  01  02  02  02 
#012 Ganraikou    02  02  02  02  02  02 
#013 Byakubu      02  02  02  02  01  01 
#014 Telopea      03  01  02  02  02  02 
#015 Mantea       03  01  02  02  02  01 
#016 Ixora        02  01  02  02  01  01 
#017 Myrtus       02  02  02  02  01  01 
#018 Lychnis      02  01  02  03  02  02 
#019 Lapeirousia  02  01  02  03  01  02 
#020 Bubaria      02  01  02  03  01  01 
#021 Angios       02  02  02  02  01  01 
#022 Gymnos       02  01  02  02  01  01 
#023 Liriope      01  02  01  01  02  02 
#024 Waratah      01  01  02  02  02  02 
#025 Sorghum      02  01  03  02  02  01 
#026 Eryngo       02  01  02  02  02  02 
#027 Noriutsugi   02  02  02  02  02  02 
#028 Pampas       02  01  02  02  02  02 
#029 Rhodanthe    02  02  02  01  01  01 
#030 Licorice     02  01  02  02  01  01 
#031 Viburnum     02  01  02  02  02  02 
#032 Funnel       02  01  03  02  01  01 
#033 Vanda        02  01  03  02  01  01 
#034 Uikyou       02  01  02  02  02  01 
#035 Obana        03  01  02  02  01  01 
#036 Firekokko    02  02  02  02  03  02 
#037 Raygoten     02  02  03  02  02  01 
#038 Drimarmor    02  01  02  02  02  01 
#039 Chamelan     02  01  02  02  02  02 
#040 Cryptoarm    03  01  03  02  02  02 
#041 Shellstera   03  02  02  02  02  02 
#042 Fungeist     03  02  02  02  02  02 
#043 Balltamus    03  01  02  02  02  02 
#044 Burenica     02  01  02  02  03  02 
#045 Geron        03  01  02  02  03  02 
#046 Berzelia     02  02  02  02  03  03 
#047 Nigella      02  01  02  03  01  02 
#048 Musa         03  01  02  02  03  03 
#049 Netaro       03  01  01  02  02  02 
#050 Nejiro       02  02  01  02  03  03 
#051 Godetia      02  01  02  02  02  01 
#052 Curcuma      02  01  02  02  03  03 
#053 Tessen       02  02  02  02  03  02 
#054 Heliopsis    02  01  02  02  02  02 
#055 Hagumanoki   02  01  03  02  02  02 
#056 Gilearth     02  01  02  02  01  01 
#057 Raygirth     02  02  03  02  02  01 
#058 Armaru       02  01  02  02  01  01 
#059 Chameraid    02  01  02  02  02  02 
#060 Cryptoride   03  01  03  02  02  02 
#061 Wormiterala  03  01  02  02  02  02 
#062 Funblade     03  02  02  02  02  02 
#063 Bulltamus    03  01  02  02  02  02 
#064 Puneedle     02  01  02  02  03  02 
#065 Kerorin      03  01  02  02  02  01 
#066 Sugulai      02  02  02  02  02  02 
#067 Cortos       02  02  02  02  02  02 
#068 Gaiurus      02  02  02  02  01  01 
#069              03  01  02  02  02  02 
#070 Octor        03  01  02  02  02  01 
#071 Hitodeight   02  01  02  02  01  01 
#072 Ghosboar     02  02  02  02  01  01 
#073 Rasenmai     02  01  02  03  02  02 
#074 Scorpil      02  01  02  03  01  02 
#075 Armcrab      02  01  02  03  01  01 
#076 Angiorn      03  02  02  02  01  01 
#077 Gymrace      03  01  02  02  01  01 
#078 Lirionpu     02  02  02  02  02  02 
#079 Waitah       01  01  02  02  02  02 
#080 Potzal       02  01  03  02  02  01 
#081              02  01  02  02  02  02 
#082 Gadhorou     02  02  02  02  02  02 
#083 Cliogera     02  01  02  02  02  02 
#084 Gust         02  02  02  01  02  01 
#085              02  01  02  02  01  01 
#086              02  01  02  02  02  02 
#087              02  01  03  02  01  01 
#088              03  01  03  03  01  01 
#089              02  01  02  02  02  01 
#090              03  01  02  02  02  01 
#091              02  01  02  02  03  02 
#092 Gymgarth     03  01  02  02  02  01 
#093              02  02  02  02  02  02 
#094 Warutah      01  01  02  02  03  02 
#095 Guntzatl     02  01  03  02  02  01 
#096              02  01  02  02  02  02 
#097 Badhorou     02  02  02  02  03  02 
#098 Lampgera     02  01  02  02  02  02 
#099 Tempest      02  02  02  02  02  01 
#100              02  01  02  02  02  01 
#101 Hiyu         03  01  02  02  02  02 
#102 Gamazumi     02  02  02  02  02  02 
#103 Papaver      04  01  02  02  02  02 
#104 Gamuru       02  01  03  02  01  01 
#105 Bouvardi     02  01  02  02  02  02 
#106 Gaultheria   02  01  02  03  01  01 
#107 Dipsacus     02  02  02  02  02  01 
#108 Kaya         02  02  03  02  02  02 
#109 Denfare      02  01  02  02  02  02 
#110 Angieon      03  02  02  02  02  01 
#111 Easydog      02  02  02  02  02  01 
#112 Tricerarmor  02  01  02  02  02  01 
#113 Cryptosnipe  04  01  03  02  02  02 
#114 Funboost     04  02  02  02  02  02 
#115 Veenica      02  01  02  02  03  02 
#116 Saiguliger   02  02  02  02  02  02 
#117 Armedurus    02  02  02  02  02  01 
#118 Octorifle    03  01  02  02  02  02 
#119 Eraserboar   02  02  02  02  02  01 
#120 Spearneedle  02  01  02  03  02  02 
#121 Gilgiearth   02  01  02  02  01  01 
#122 Uniarmor     02  01  02  02  01  02 
#123 Cryptoburn   03  01  03  02  02  02 
#124 Funmachine   03  02  02  02  02  02 
#125              02  01  02  02  03  02 
#126 Suguline     02  02  02  02  02  02 
#127 Machurus     02  02  02  02  01  01 
#128 Octagun      03  01  02  02  02  01 
#129 Mummyboar    02  02  02  02  01  01 
#130 Kingpin      02  01  02  03  01  02 
#131 Beebalm      02  02  02  02  01  01 
#132 Salal        02  02  02  02  02  02 
#133 Enishida     02  01  03  02  01  02 
#134 Tulbaghia    02  02  02  02  02  02 
#135 Kiringiku    02  02  03  02  02  02 
#136 Angilance    03  02  02  02  01  01 
#137 Gymganon     03  01  02  02  01  01 
#138              02  02  02  02  02  02 
#139 Wattah       02  01  02  02  02  02 
#140 Quetzaking   02  01  03  02  02  01 
#141              02  01  02  02  02  02 
#142 Punkhorou    02  02  02  02  02  02 
#143              02  01  02  02  02  02 
#144 Storm        02  02  02  02  03  02 
#145              02  01  02  02  01  01 
#146 Gypsophi     02  01  02  02  02  02 
#147 Ruscus       04  01  03  03  02  02 
#148 Maoran       02  02  02  02  02  02 
#149 Zea          01  02  02  02  02  02 
#150 Gonum        02  01  02  02  03  03 
#151 Angipower    03  02  02  02  02  01 
#152 Gymzyrus     04  01  02  02  02  01 
#153 Canonope     02  02  02  02  02  02 
#154 Calm         02  02  02  02  03  02 
#155 Ryuuguu      04  01  03  03  03  02 
#156 Gigagigerth  02  01  03  02  01  01 
#157 Barriarm     02  01  02  02  01  02 
#158 Cryptoknight 04  01  03  02  03  02 
#159 Fungwar      04  02  02  02  03  02 
#160 Bashou       04  01  03  02  03  03 
#161 Angigorgo    04  02  02  02  02  01 
#162 Gymbaron     03  01  02  02  01  01 
#163 Lirimonarch  02  02  02  02  02  02 
#164 Enteiou      02  01  02  02  02  02 
#165              02  01  02  02  02  02 
#166 Kanzou       02  02  03  02  03  02 
#167 Ornithogalum 02  02  03  02  03  02 
#168 Gentiana     02  02  03  02  03  02 
#169 Yarrow       04  01  03  03  02  03 
#170 Angioros     04  02  03  03  02  01 
#171 Gymzatan     04  01  03  03  02  01 
#172 Doomsday     04  01  03  03  02  03 
#173 Dendel       02  01  02  02  03  03 
#174 Teletel      02  01  02  02  03  03 
swampert22(imported)
Posts: 54
Joined: Sun Dec 23, 2007 4:04 am

Re: An interesting find with stats.

Post by swampert22(imported) »

You're the man Blaziken257! This is a pretty good discovery :D

Shall I add it to the program? There have been a couple of things discovered since I updated so it may be a good idea :lol:
Blaziken257
Posts: 983
Joined: Fri Dec 22, 2006 11:52 am

Re: An interesting find with stats.

Post by Blaziken257 »

Sure, you can add it! If you add it, you should make it so that it can calculate stats at given levels based on the base stats and the stat growth rate. And you should include a field for the level as well, or use 99 (the highest level) as a constant. Just for reference, the formula is:

Stat = Base Stat + (Level - 1) * Level Influence / 2

If you're going to use 99 as a constant for the level, then the equation reduces to:

Stat = Base Stat + 49 * Level Influence

And you also should warn if it causes the stat to overflow past 255 at high levels.

You should also check thoroughly whether it rounds down or up. I've only seen a stat round up if a Denjuu is at Level 2. Other than that, it's seemed to have rounded down. Of course, there may be other situations, so someone has to check that.

And what else did you find? I'm curious! Oh and by the way, if you're going to edit it, you should do Exp items in there as well. I think I bugged you about this on PokeCommunity already, though... and here's some information if you need it:

http://z15.invisionfree.com/Tulunk_Village...p?showtopic=319

Now I gotta finish finding the Denjuu encounter data... though the way it's set up, it may need a different program...

And I also gotta try Milnivri's program... I keep forgetting to do that!
swampert22(imported)
Posts: 54
Joined: Sun Dec 23, 2007 4:04 am

Re: An interesting find with stats.

Post by swampert22(imported) »

Thanks :P

Good Idea on the levels, but I may just have a max stat calculator into the program that alters when you change the base stat and level influence.

Well basically, what I meant by new discoveries, was the information you found on Exp. Items. I shall also be adding in the option to view the attacks in English, Romaji and Bootleg.

Does anybody know if there is a complete translated item list? I would like to add that too. :lol:

As for the encounter data, a new program will definately be needed :D
Blaziken257
Posts: 983
Joined: Fri Dec 22, 2006 11:52 am

Re: An interesting find with stats.

Post by Blaziken257 »

There's a translated item list here:

http://z15.invisionfree.com/Tulunk_Village...p?showtopic=297

There's more than the first post, though...

And with Exp. Items, don't forget to reverse the bits! That's the most tricky part. If your program matches this list, then you know you did it right!
swampert22(imported)
Posts: 54
Joined: Sun Dec 23, 2007 4:04 am

Re: An interesting find with stats.

Post by swampert22(imported) »

Blaziken257 wrote: There's a translated item list here:

http://z15.invisionfree.com/Tulunk_Village...p?showtopic=297

There's more than the first post, though...

And with Exp. Items, don't forget to reverse the bits! That's the most tricky part. If your program matches this list, then you know you did it right!
Yeah, I won't forget to reverse it. It's the same as the TMs in Pokémon, so I'll just copy my code from that! :lol:
Blaziken257
Posts: 983
Joined: Fri Dec 22, 2006 11:52 am

Re: An interesting find with stats.

Post by Blaziken257 »

LOL what? Pokémon reverses the bits too? Why would two different games have the same formatting? And the same weird formatting at that... Reversing bits was hard for me to figure out at first...
swampert22(imported)
Posts: 54
Joined: Sun Dec 23, 2007 4:04 am

Re: An interesting find with stats.

Post by swampert22(imported) »

Yeah It took me a while to figure it out too, it doesn't really make sense to reverse the bits either. Oh well at least we know now and it's pretty easy to program! :P
Post Reply