Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#1 2020-08-15 00:32:26

Ferropexola
Member
Registered: 2020-06-08
Post 20/25

Replacing Mimic

I want to replace Mimic with Ice Fang. I've removed the move in most places, but effects_commands.asm is a little confusing to me. Several places where Mimic is located seems to have relevance elsewhere, in particular, this one.

.player
ld c, a
ld a, MON_MOVES
call UserPartyAttr

ld a, BATTLE_VARS_MOVE
call GetBattleVar
cp MIMIC
jr z, .mimic

This is used in CheckMimicUsed, which is used in a different .player, which is used in .proceed, which is used in BattleCommand_DoTurn.

I'm not sure if deleting every instance of Mimic is what I need to do, or if there is alternate code that I need to write. What do you think?


Just because you can, doesn't mean you have to.

Offline

#2 2020-08-15 01:41:19

Rangi
Member
Registered: 2016-05-09
Post 953/959

Re: Replacing Mimic

Whenever you see "cp MIMIC", you know the result will be nz, since no move will be equal to MIMIC. So edit the code to remove any logic exclusive to the z case, and then see how much of it becomes redundant or unused when the nz case is gone.

In this instance, the whole point of the CheckMimicUsed routine is to return nc if the current battler (the player or the enemy) is currently using Mimic, or c(arry) if they're not using Mimic. So you can delete that whole routine, and in any code that calls it, assume it would return carry.

(The only time CheckMimicUsed is called, it's followed by "ret c", so you can turn that into an unconditional "ret".)

Offline

#3 2020-08-15 13:25:05

Ferropexola
Member
Registered: 2020-06-08
Post 21/25

Re: Replacing Mimic

Thanks Rangi. CheckMimicUsed is also followed by pop hl before ret c, so should I delete pop hl, or leave it in?

Edit: I left pop hl in, and everything seems to work fine. I'll return if something goes wrong.

Last edited by Ferropexola (2020-08-15 13:34:05)


Just because you can, doesn't mean you have to.

Offline

#4 2020-08-15 19:38:46

Ferropexola
Member
Registered: 2020-06-08
Post 22/25

Re: Replacing Mimic

When I deleted some code, whatever causes PP to decrease became bugged. It will decrease in battle, but will reset after battle. I deleted push hl and pop hl as well as changing ret c to ret for .player where CheckMimicUsed was originally.

; mimic this part entirely if wildbattle
ld a, [wBattleMode]
dec a
jr z, .wild

ld hl, wOTPartyMon1PP
ld a, [wCurOTMon]

.player
call GetPartyLocation
-       push hl
-       CheckMimicUsed
-       pop hl
-       ret c
+      ret

.consume_pp
ldh a, [hBattleTurn]
and a
ld a, [wCurMoveNum]
jr z, .okay
ld a, [wCurEnemyMoveNum]

Happens in wild and trainer battles.

Last edited by Ferropexola (2020-08-15 19:43:20)


Just because you can, doesn't mean you have to.

Offline

#5 2020-08-15 20:06:46

Ferropexola
Member
Registered: 2020-06-08
Post 23/25

Re: Replacing Mimic

Fixed it. I deleted too much code.


Just because you can, doesn't mean you have to.

Offline

Board footer

Powered by FluxBB