The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > ROM Hacking > Research & Development
Sign Up Rules/FAQ Live Battle Blogs Mark Forums Read

Notices

Research & Development Got a well-founded knack with ROM hacking? Love reverse-engineering the Pokémon games? Or perhaps you love your assembly language. This is the spot for polling and gathering your ideas, and then implementing them! Share your hypothesis, get ideas from others, and collaborate to create!
Research & Development programs in this forum are subject to moderator approval before they are displayed.


Advertise here

Reply
 
Thread Tools
  #1    
Old December 4th, 2013, 04:51 PM
DoesntKnowHowToPlay's Avatar
DoesntKnowHowToPlay
some loser
 
Join Date: Jan 2012

Advertise here


In XY, there is a new type of battle known as the Inverse Battle. In this mode, type match-ups are reversed- moves that are normally super-effective become ineffective, and moves that are normally resisted or would have no effect become super-effective. I did some poking at the type chart code recently and found that it's actually quite easy to implement these in FR.

"But that's easy! Just edit the well-documented type chart so every match-up is backwards!"

That isn't what this does. This hack hijacks the code that reads the type chart to make the game use the inverse of what's there. This means you can use a flag to have hacks with both regular and inverse battles.

The routine is as follows:

Code:
.align 2
.thumb
.thumb_func
push {r4, r5, lr}
mov r4, r0
mov r0, #0x02
lsl r0, #0x8
mov r1, #0x3D
add r0, r1
bl FlagCheck
cmp r0, #0x0
beq End
cmp r4, #0x0
beq SuperEffective
cmp r4, #0x5
beq SuperEffective
cmp r4, #0x14
beq Ineffective
b End

SuperEffective:
mov r4, #0x14
b End

Ineffective:
mov r4, #0x5

End:
ldr r5, .damageAddr
ldr r0, [r5, #0x0]
mul r0, r4
ldr r1, .returnAddr
bx r1

FlagCheck:
ldr r2, .flagAddr
bx r2


.align 2
.returnAddr: .word 0x0801e77d
.flagAddr: .word 0x0806e6d1
.damageAddr: .word 0x02023d50
.end
You can insert it anywhere. To call it, insert 00 49 08 47 at x1E770, followed by a pointer to where you inserted the method + 1. (For example, I inserted the method at x170900- I would put 00 49 08 47 01 09 17 08 at x1E770).

This code ties the Inverse Battle rules to flag x23D. If flag x23D is set, battles will use the Inverse Battle ruleset- otherwise they will work normally. If you want to use a different flag, you can change it quite easily by adjusting the values on the sixth and eighth lines. Note that in vanilla FireRed, flag x23D is used by the Pokeflute- if that script is still in the game you will want to pick a different one.
__________________

Yet Another Fire Red Hack

Physical/Special Split
Reply With Quote
  #2    
Old December 4th, 2013, 07:25 PM
MrDollSteak's Avatar
MrDollSteak
Formerly known as 11bayerf1
 
Join Date: Dec 2008
Location: Hong Kong
Age: 19
Gender: Male
That's fantastic Doesn't!

A very useful feature for hacks looking for different things!

You never cease to amaze me!
__________________
Reply With Quote
  #3    
Old December 5th, 2013, 12:46 AM
Flower's Avatar
Flower
ワイルドフラワー
 
Join Date: Nov 2013
Location: Void
Gender: Male
Nature: Quiet
Send a message via Skype™ to Flower
Awesome, will this be able to implement in Emerald as well?
__________________
PM | Flower | VM
Reply With Quote
  #4    
Old December 5th, 2013, 02:08 PM
itari's Avatar
itari
悪魔の妹
Community Supporter
 
Join Date: Mar 2010
Location: 紅魔館
Age: 17
Gender: Female
Nature: Relaxed
Ah, very nice.

Quite an impressive feature despite its simplicity. Well done.
__________________
Touhou Puppet Play: Sapphire

SubscriptAdvanced SongType Effectiveness EditorTilemap CreatorPython IPS Patcher
Reply With Quote
  #5    
Old December 5th, 2013, 03:34 PM
xGal's Avatar
xGal
du bist n00b
 
Join Date: Nov 2011
Location: A tree
Gender: Male
Nature: Bold
This routine just gave me an idea for my hack. Thanks for the routine! I will give you a credit if i will use it .
__________________
Hey guys, I made a soundcloud account not long ago, and I would be very happy if you guys will check it out: https://soundcloud.com/dewombat. Thanks .

Also, if you ever wanted to make a ROM hacking tool, click here: http://www.pokecommunity.com/showthread.php?t=334348
Reply With Quote
  #6    
Old December 5th, 2013, 06:24 PM
Merak's Avatar
Merak
Because reasons.
 
Join Date: Jul 2013
Age: 18
Gender: Male
Nature: Quiet
Okay, this is pretty cool. Nice job~
__________________
"it is nearly 11 pm and we're discussing an alien eating the personification of humanity's evil desires
help"


Credit for the userbar goes to xVaporeon; credit for the avatar goes to Snakeyem12.
MY WRITING
Reply With Quote
  #7    
Old 2 Weeks Ago, 03:45 AM
Lance32497
LanceKoijer of Pokemon_Addicts
 
Join Date: Aug 2014
Location: Criscanto town-Ginoa Region xD
Gender: Male
Nature: Adamant
Quote:
Originally Posted by DoesntKnowHowToPlay View Post


In XY, there is a new type of battle known as the Inverse Battle. In this mode, type match-ups are reversed- moves that are normally super-effective become ineffective, and moves that are normally resisted or would have no effect become super-effective. I did some poking at the type chart code recently and found that it's actually quite easy to implement these in FR.

"But that's easy! Just edit the well-documented type chart so every match-up is backwards!"

That isn't what this does. This hack hijacks the code that reads the type chart to make the game use the inverse of what's there. This means you can use a flag to have hacks with both regular and inverse battles.

The routine is as follows:

Code:
.align 2
.thumb
.thumb_func
push {r4, r5, lr}
mov r4, r0
mov r0, #0x02
lsl r0, #0x8
mov r1, #0x3D
add r0, r1
bl FlagCheck
cmp r0, #0x0
beq End
cmp r4, #0x0
beq SuperEffective
cmp r4, #0x5
beq SuperEffective
cmp r4, #0x14
beq Ineffective
b End

SuperEffective:
mov r4, #0x14
b End

Ineffective:
mov r4, #0x5

End:
ldr r5, .damageAddr
ldr r0, [r5, #0x0]
mul r0, r4
ldr r1, .returnAddr
bx r1

FlagCheck:
ldr r2, .flagAddr
bx r2


.align 2
.returnAddr: .word 0x0801e77d
.flagAddr: .word 0x0806e6d1
.damageAddr: .word 0x02023d50
.end
You can insert it anywhere. To call it, insert 00 49 08 47 at x1E770, followed by a pointer to where you inserted the method + 1. (For example, I inserted the method at x170900- I would put 00 49 08 47 01 09 17 08 at x1E770).

This code ties the Inverse Battle rules to flag x23D. If flag x23D is set, battles will use the Inverse Battle ruleset- otherwise they will work normally. If you want to use a different flag, you can change it quite easily by adjusting the values on the sixth and eighth lines. Note that in vanilla FireRed, flag x23D is used by the Pokeflute- if that script is still in the game you will want to pick a different one.
Why when I use it in a rom, when I use a move that the type is expanded, the game crashed?
Reply With Quote
  #8    
Old 1 Week Ago, 03:48 PM
LocksmithArmy's Avatar
LocksmithArmy
Mew!
 
Join Date: Feb 2013
Age: 25
Gender: Male
Quote:
Originally Posted by DoesntKnowHowToPlay View Post
Code:
.align 2
.thumb
.thumb_func
push {r4, r5, lr}
mov r4, r0
mov r0, #0x02
lsl r0, #0x8
mov r1, #0x3D
add r0, r1
bl FlagCheck
cmp r0, #0x0
beq End
cmp r4, #0x0
beq SuperEffective
cmp r4, #0x5
beq SuperEffective
cmp r4, #0x14
beq Ineffective
b End

SuperEffective:
mov r4, #0x14
b End

Ineffective:
mov r4, #0x5

End:
ldr r5, .damageAddr
ldr r0, [r5, #0x0]
mul r0, r4
ldr r1, .returnAddr
bx r1

FlagCheck:
ldr r2, .flagAddr
bx r2


.align 2
.returnAddr: .word 0x0801e77d
.flagAddr: .word 0x0806e6d1
.damageAddr: .word 0x02023d50
.end
I kinda wanna make this as a tool lol... but I dont know how to compile ASM into hex bytes...

how would I do that?

P.S. Amazing work, really cool option for any hack.

On a completely unrelated note, wouldn't this make a cool hold item... wouldn't know what to call it though lol
__________________

Last edited by LocksmithArmy; 1 Week Ago at 04:04 PM.
Reply With Quote
  #9    
Old 1 Week Ago, 04:22 PM
Deokishisu's Avatar
Deokishisu
Mr. Magius
 
Join Date: Feb 2006
Location: If I'm online, it's a safe bet I'm at a computer.
Gender: Male
Nature: Relaxed
Quote:
Originally Posted by LocksmithArmy View Post
On a completely unrelated note, wouldn't this make a cool hold item... wouldn't know what to call it though lol
Like an item that forces the inverse ruleset when a Pokemon that is holding one comes into battle?

It'd be super cool, but super broken. Put it on all your pure Ice-types. #IceMasterType

Or giving Normal-type moves unresisted coverage.

Last edited by Deokishisu; 1 Week Ago at 04:27 PM.
Reply With Quote
  #10    
Old 1 Week Ago, 05:53 PM
LocksmithArmy's Avatar
LocksmithArmy
Mew!
 
Join Date: Feb 2013
Age: 25
Gender: Male
Quote:
Originally Posted by Deokishisu View Post
Like an item that forces the inverse ruleset when a Pokemon that is holding one comes into battle?

It'd be super cool, but super broken. Put it on all your pure Ice-types. #IceMasterType

Or giving Normal-type moves unresisted coverage.
Ud have to only give 1 per game...
__________________
Reply With Quote
  #11    
Old 1 Week Ago, 03:17 PM
LocksmithArmy's Avatar
LocksmithArmy
Mew!
 
Join Date: Feb 2013
Age: 25
Gender: Male
Quote:
Originally Posted by DoesntKnowHowToPlay View Post


In XY, there is a new type of battle known as the Inverse Battle. In this mode, type match-ups are reversed- moves that are normally super-effective become ineffective, and moves that are normally resisted or would have no effect become super-effective. I did some poking at the type chart code recently and found that it's actually quite easy to implement these in FR.

"But that's easy! Just edit the well-documented type chart so every match-up is backwards!"

That isn't what this does. This hack hijacks the code that reads the type chart to make the game use the inverse of what's there. This means you can use a flag to have hacks with both regular and inverse battles.

The routine is as follows:

Code:
.align 2
.thumb
.thumb_func
push {r4, r5, lr}
mov r4, r0
mov r0, #0x02
lsl r0, #0x8
mov r1, #0x3D
add r0, r1
bl FlagCheck
cmp r0, #0x0
beq End
cmp r4, #0x0
beq SuperEffective
cmp r4, #0x5
beq SuperEffective
cmp r4, #0x14
beq Ineffective
b End

SuperEffective:
mov r4, #0x14
b End

Ineffective:
mov r4, #0x5

End:
ldr r5, .damageAddr
ldr r0, [r5, #0x0]
mul r0, r4
ldr r1, .returnAddr
bx r1

FlagCheck:
ldr r2, .flagAddr
bx r2


.align 2
.returnAddr: .word 0x0801e77d
.flagAddr: .word 0x0806e6d1
.damageAddr: .word 0x02023d50
.end
You can insert it anywhere. To call it, insert 00 49 08 47 at x1E770, followed by a pointer to where you inserted the method + 1. (For example, I inserted the method at x170900- I would put 00 49 08 47 01 09 17 08 at x1E770).

This code ties the Inverse Battle rules to flag x23D. If flag x23D is set, battles will use the Inverse Battle ruleset- otherwise they will work normally. If you want to use a different flag, you can change it quite easily by adjusting the values on the sixth and eighth lines. Note that in vanilla FireRed, flag x23D is used by the Pokeflute- if that script is still in the game you will want to pick a different one.
IBA1.JPG

Soo here is the tool I made... if it meets your approval I would like to publish it about the web (it seems to work as prescribed)

LSA - Inverse Battle Applier.zip
__________________
Reply With Quote
  #12    
Old 1 Week Ago, 06:39 PM
DoesntKnowHowToPlay's Avatar
DoesntKnowHowToPlay
some loser
 
Join Date: Jan 2012
Quote:
Originally Posted by LocksmithArmy View Post
Attachment 73380

Soo here is the tool I made... if it meets your approval I would like to publish it about the web (it seems to work as prescribed)

Attachment 73379
I'm fine with it, although I'd appreciate if you linked back to this thread wherever you distribute it.
__________________

Yet Another Fire Red Hack

Physical/Special Split
Reply With Quote
  #13    
Old 1 Week Ago, 07:10 PM
LocksmithArmy's Avatar
LocksmithArmy
Mew!
 
Join Date: Feb 2013
Age: 25
Gender: Male
Quote:
Originally Posted by DoesntKnowHowToPlay View Post
I'm fine with it, although I'd appreciate if you linked back to this thread wherever you distribute it.
Consider it done Thanks
__________________
Reply With Quote
  #14    
Old 1 Week Ago, 12:50 PM
byrikudouvlog's Avatar
byrikudouvlog
Romhacker promise
 
Join Date: Feb 2014
Location: Milano, IT
Gender: Female
Nature: Serious
how do i to set in a script the inverse batle?
someone can show me an expample please?
i'm not understand so
Reply With Quote
  #15    
Old 1 Week Ago, 12:54 PM
LocksmithArmy's Avatar
LocksmithArmy
Mew!
 
Join Date: Feb 2013
Age: 25
Gender: Male
Quote:
Originally Posted by byrikudouvlog View Post
how do i to set in a script the inverse batle?
someone can show me an expample please?
i'm not understand so
Code:
setflag 0x23D //turns on inverse battles
Code:
clearflag 0x23D //returns battles to normal
the flag you set or clear should be the flag you chose, not specifically 23D
__________________
Reply With Quote
Reply
Quick Reply

Sponsored Links


Advertise here
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Minimum Characters Per Post: 25



All times are UTC -8. The time now is 07:26 AM.


Style by Nymphadora, artwork by Sa-Dui.
Like our Facebook Page Follow us on Twitter © 2002 - 2014 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2014 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.