[FE7] Magic Sealing(?)

0801B17A 220A 0A is responsible for magic seal range?

The routine at 0801B148 is called by the AI for healing staff use (Also by the staff usability routines, I believe).

You’ll see the code

0801B160 6850     ldr     r0,[r2,#0x4]		@Class
0801B162 6A89     ldr     r1,[r1,#0x28]		@Character ability
0801B164 6A80     ldr     r0,[r0,#0x28]
0801B166 4301     orr     r1,r0
0801B168 2080     mov     r0,#0x80
0801B16A 04C0     lsl     r0,r0,#0x13		@0000 0100  0000 0000  0000 0000  0000 0000 Character ability 4 0x4 - Magic sealing
0801B16C 4001     and     r1,r0
0801B16E 2900     cmp     r1,#0x0
0801B170 D007     beq     #0x801B182		@No magic sealing -- loop.
0801B172 2010     mov     r0,#0x10
0801B174 5610     ldsb    r0,[r2,r0]		@XLocation
0801B176 2111     mov     r1,#0x11
0801B178 5651     ldsb    r1,[r2,r1]		@YLocation
0801B17A 220A     mov     r2,#0xA			@Range?
0801B17C 1C2B     mov     r3,r5				@-1?

I’m going to try tweaking that 0xA to see if I can change the magic sealing range. Also,

0801B14C 2481     mov     r4,#0x81			@First enemy

Tweaking this to see if I can make a player magic seal.

.

Edit: It doesn’t appear to control the range, unfortunately. But I shall find what does; it can’t be far from here.

1 Like

Magic sealing seems to write to the fog-of-war map. I need to find how it’s written though…

This is why it messes up when people put the Magic seal on FOW maps, huh.

1 Like

Edit:
Oh, wait. It looks like this only affects which tiles are shaded on the map and doesn’t actually prevent units from using magic.

Edit Edit:
Actually, it appears this only affects the shaded tiles on the Player/Other Phase. On the Enemy Phase, the radius of the shaded tiles goes back to 10 spaces. What the…?

Radius of shaded tiles on player/other phase = 10 spaces.

08019906 220A mov r2, #0xA

Adjust radius size by changing 0x0A at 08019906

Edit Edit Edit:

Found the radius of the shaded tiles on the enemy phase:

080199D0 220A mov r2, #0xA

Yeah, any idea where the actual sealing takes place? I couldn’t find that, even when looking at the code for cannot use staves…

By lowering this particular value, I can get enemy magic users to attack and staff within 10 spaces of the magic seal. Staves seem to work fine, but attacks are buggy. The enemy tries to attack with “nothing” which may cause the game to hang up if animations are on. Player units are still sealed within the 10 spaces. So it looks like this value just tells the AI to not use magic/staves within X-amount spaces of the magic seal.

Got it! Finally.

08018766 280A cmp r0, #0xA
08018774 280A cmp r0, #0xA

The current character’s position is compared to magic seal’s position. Seal magic if difference between positions is <= 10. Only one of the comparisons is used depending on whether character is above or below magic seal.

To summarize, 5 values need to be changed:
08018766 : Range of magic seal
08018774 : Range of magic seal
08019906 : Range of shaded tiles on player/other phase
080199D0 : Range of shaded tiles on enemy phase
0801B17A : Range of area where AI cannot use magic/staves

1 Like

Cool, now let’s make a nightmare editor for this.

1
FE7 Magic Seal Editor
0
1
0x01B17B
NULL
NULL

Range of magic seal
0x018766
1
NEDU
NULL

Range of magic seal
0x018774
1
NEDU
NULL

Shaded tiles on player/other phase
0x019906
1
NEDU
NULL

Shaded tiles on enemy phase
0x0199D0
1
NEDU
NULL

AI cannot use magic/staves
0x01B17A
1
NEDU
NULL

1 Like

So I was messing around with this, and noticed that the ability only works with enemies (or maybe I just did something wrong). Is there any way to change that?

Probably. I’d have to look around the codes that Gryz has posted and change a few loop boundaries.

For FE8, these five values are at:
08018CE2
08018CF0
0801A03E
0801A108
0801B982

2 Likes