Registrarse

[Rutina] [ASM] [RF] Sistema de obtención de experiencia estilo B/W

Lumbreon

Soy nuevo XD :3
Bueno no redactaré mucho porque mi teclado está horriblemente mal, pero básicamente esta rutina cambia la formula de ganancia de experiencia de Rojo Fuego por la de B/W, que toma en cuenta el nivel del Pokémon derrotado y otros factores.

La rutina
Código:
.text
.align 2
.thumb
.thumb_func

Main:
push {r0-r7}

GetVictorLevel:

/*Gets party position and adds 100*X based on it*/
/*Then gets level and compares it to 0 and 100*/
/*If the Pokemon is level 100, it won’t gain exp.*/
/*If the Pokemon is level 0 (they don’t exist) they won’t gain exp. either*/
/*The level zero check is in case you use an exp. All patch*/
/*If you do, it won’t give exp. to blank party spaces*/

ldr r0, [r5]
ldrb r1, [r0, #0x10]
mov r0, #0x64
mul r0, r1
ldr r1, .FirstPoke
add r0, r0, r1
mov r1, #0x38
bl Decrypt
cmp r0, #0x64
beq Noexp.
cmp r0, #0x0
beq Noexp.
mov r6, r0 /*puts your level in r6*/

CheckIfFainted:

/*Gets current HP of each pokemon and compares it to 0*/
/*If it’s 0, the Pokemon won’t gain exp.*/

ldr r0, [r5]
ldrb r1, [r0, #0x10]
mov r0, #0x64
mul r0, r1
ldr r1, .FirstPoke
add r0, r0, r1
mov r1, #0x39
bl Decrypt
cmp r0, #0x0
beq Noexp.	

GetBaseexp.:

/*Gets base exp. from base stats table*/
/*It does this by getting the species of the Defending Pokemon*/
/*Then it multiplies the index number by 0x1c (or 28)*/
/*It adds this to the offset of the Base Stat table*/
/*Then it adds 9 to the offset of the Pokemon’s Base Stats to get base exp.*/

ldr r0, .Defender
ldrb r0, [r0]
mov r4, #0x58
ldr r1, .UserBank
mul r4, r0
add r0, r1, r4
ldrh r1, [r0] /*species index*/
ldr r0, .BaseStatTable
mov r2, #0x1C
mul r1, r2
add r0, r0, r1
mov r2, #0x9
add r0, r0, r2
ldrb r4, [r0] /*puts base exp. in r4*/

GetOpponentLevel:

/*Gets opponent's level and puts into r5*/

ldr r0, .Defender
ldrb r0, [r0]
cmp r0, #0x1
beq Level1
b Level2

Level1:

/*It goes here if the target’s user bank number was 1*/
/*This is always the opponent in a single battle*/
/*In doubles this is the Pokemon on the right*/

mov r1, #0x64
mul r0, r1
ldr r2, .FirstFoeMinus1 /*The RAM offset of the opponent’s first Pokemon - 100*/
b GetTheLevel

Level2:

/*This is the Pokemon on the left in Double Battles*/
/*They have a user bank number of 3*/

mov r1, #0x64
mul r0, r1
ldr r2, .FirstFoeMinus2 /*The RAM offset of the opponent’s first Pokemon - 300*/

GetTheLevel:

/*Gets the RAM for the opponent’s first or second Pokemon*/
/*Depending on the user bank number*/

add r0, r0, r2
mov r1, #0x38
bl Decrypt
mov r5, r0

Multiply:

/*r4 = base exp..*/
/*r5 = foe’s level*/
/*This multiplies the base exp. by the opponent’s level*/
/*Then it multiplies the result by 20*/
/*Then it divides the whole thing by 100*/
/*This is the same as dividing it by 5*/
/*r0 is the top number, r1 is the bottom number*/

mul r4, r5
mov r1, r4 /*r1 is B x L*/
mov r0, #0x14
mul r0, r1 /*r0 = B x L*/
mov r1, #0x64 /*r1 = 100*/
bl Divide /*divides by 100*/
mov r3, r0

LevelStuff:

/*This multiplies the foe’s level by 2*/
/*Then adds 10 to the result*/
/*Then it multiplies that result by itself to square it*/
/*This is the top part of the level ratio*/

mov r2, #0x2
mov r1, r5 /*move foe level to r1*/
mul r1, r2 /*multiply foe level by 2*/
mov r2, #0xA
add r1, r1, r2 /*add 10 to 2 x Foe Level*/
mul r1, r1 /*multiply (2L+10) by itself*/

BottomLevel:

/*r5 = foe’s level*/
/*r6 = your level*/
/*This add your level to the opponent’s level*/
/*Then adds ten to that sum*/
/*multiplies by itself to square it*/

add r5, r5, r6
add r5, r5, r2
mul r5, r5

DivideAgain:

/*r1 = (2L+10)^2*/
/*r5 = (L+Lp+10)^2*/
/*r6 = (B x L) / 5*/
/*Stores answer to r0*/
/*Then moves answer to r2*/

mov r0, r1
mov r1, r5
mov r6, r3 /*move BL/5 to r6*/
mov r3, #0x64 /*multiply top by 100*/
mul r0, r3
bl Divide /*Divide top by bottom*/
mov r2, r0

DivideSomeMore:

/*r6 = BL/5*/
/*r2 = Level Ratio*/
/*Multiplies the 2nd term by 100*/
/*Then divides whole thing by 100*/

mul r6, r2 /*multiply BL/5 by (100*2ndTerm)*/
mov r0, r6
mov r1, #0x64
bl Divide /*Divides (BL/5)*(100*2ndTerm) by 100*/

LoadIntoExp:

/*Stores the final amount into the address at r1*/
/*This address at r1 is used for the final results of things*/
/*I believe the damage calculation for moves uses the same RAM address*/

ldr r1, .Storage /*stores value into exp.*/
mov r2, r9
str r0, [r1]
mov r9, r1

ReturnToItemCheck:

/*This returns to right before the exp.. Share check*/

pop {r0-r7}
ldr r1, .Return2
bx r1

Divide:
ldr r2, .Divider
bx r2	

Decrypt:
ldr r2, .Decrypter
bx r2

Noexp.:

/*This returns to right before the skip exp.. gain function*/

pop {r0-r7}
ldr r1, .Return1
bx r1

.align 2
.Return1:	.word 0x08021C6F
.Return2:	.word 0x08021D19
.Decrypter:	.word 0x0803Fad5
.Divider:	.word 0x081e379d
.FirstPoke:	.word 0x02024284
.BaseStatTable:	.word 0x09003FA4
.Attacker:	.word 0x02023D6B
.Defender:	.word 0x02023D6C
.UserBank:	.word 0x02023BE4
.Storage:	.word 0x02023D50
.FirstFoeMinus2:	.word 0x02023F64
.FirstFoeMinus1:	.word 0x02023FC8

Reemplazar los Bytes en 0x021c58
00 48 00 47 XX XX XX XX
Siendo XX XX XX XX el puntero permutado de la rutina mas 1
ej: 
offset: 740000
permutado: 01 00 74 08
Solo la adapte de Fire Red a Rojo Fuego, no traduje la información que dejó AkameTheBulbasaur

Aqui el Post original
Sin más que agregar. Me despido :cool:
 
Última edición:

MetalKaktus

A la luz del quinto día, mira al este
Miembro insignia
Bueno, es un aporte a tener en cuenta. Al final es algo que no se nota demasiado en el juego pero es un pequeño detalle.

A decir verdad nunca me he preguntado como funciona la forma en la que ganas experiencia en el Fire Red pero bueno. Se agradece el aporte igual igual ;)
 

pikachu240

Junior C# Developer
hola :D me gusta la idea de actualizar el algoritmo de obtención de experiencia pero necesito saber como se puede (Si se puede claro...) hacer para poder ponerlo junto el sistema de dar experiencia después de capturar un pokemon...lo digo porque he puesto el sistema y luego lo de capturar y cuando lo pruebo se queda bloqueado...solo cuando capturo un pokemon claro...alguna idea?
 

GlomiBabel

Usuario de platino
hola yo lo que necesito es que la obtención de exp en niveles mas altos sea mayor, no se que tengo que hacer (el hack rom es un fire red)
 
Arriba