diff options
Diffstat (limited to 'items')
-rw-r--r-- | items/item_effects.asm | 48 | ||||
-rwxr-xr-x | items/pokeball_wobble.asm | 88 |
2 files changed, 114 insertions, 22 deletions
diff --git a/items/item_effects.asm b/items/item_effects.asm index aa6c8f795..ef05de8fd 100644 --- a/items/item_effects.asm +++ b/items/item_effects.asm @@ -338,11 +338,13 @@ endr ; catch rate than BRN/PSN/PAR, which in turn provide a higher catch rate than ; no status effect at all. But instead, it makes BRN/PSN/PAR provide no ; benefit. +; Uncomment the line below to fix this. ld b, a ld a, [EnemyMonStatus] and 1 << FRZ | SLP ld c, 10 jr nz, .addstatus + ; ld a, [EnemyMonStatus] and a ld c, 5 jr nz, .addstatus @@ -502,7 +504,7 @@ endr ld de, EnemyMonPP ld bc, NUM_MOVES call CopyBytes -.Transformed +.Transformed: ld a, [EnemyMonSpecies] ld [wWildMon], a @@ -578,7 +580,7 @@ endr ld a, FRIEND_BALL_HAPPINESS ld [hl], a -.SkipPartyMonFriendBall +.SkipPartyMonFriendBall: ld hl, Text_AskNicknameNewlyCaughtMon call PrintText @@ -615,7 +617,7 @@ endr jp .return_from_capture -.SendToPC +.SendToPC: call ClearSprites predef SentPkmnIntoBox @@ -630,14 +632,14 @@ endr jr nz, .BoxNotFullYet ld hl, wBattleResult set 7, [hl] -.BoxNotFullYet +.BoxNotFullYet: ld a, [CurItem] cp FRIEND_BALL jr nz, .SkipBoxMonFriendBall ; Bug: overwrites the happiness of the first mon in the box! ld a, FRIEND_BALL_HAPPINESS ld [sBoxMon1Happiness], a -.SkipBoxMonFriendBall +.SkipBoxMonFriendBall: call CloseSRAM ld hl, Text_AskNicknameNewlyCaughtMon @@ -672,7 +674,7 @@ endr call CloseSRAM -.SkipBoxMonNickname +.SkipBoxMonNickname: ld a, BANK(sBoxMonNicknames) call GetSRAMBank @@ -694,7 +696,7 @@ endr callba BugContest_SetCaughtContestMon jr .return_from_capture -.FinishTutorial +.FinishTutorial: ld hl, Text_GotchaMonWasCaught .shake_and_break_free @@ -780,7 +782,7 @@ GetPokedexEntryBank: pop hl ret -.PokedexEntryBanks +.PokedexEntryBanks: GLOBAL PokedexEntries1 GLOBAL PokedexEntries2 @@ -809,7 +811,7 @@ endr ld a, BANK(PokedexDataPointerTable) call GetFarHalfword -.SkipText +.SkipText: call GetPokedexEntryBank call GetFarByte inc hl @@ -888,7 +890,7 @@ endr ld b, $1 ret -.WeightsTable +.WeightsTable: ; weight factor, boost db 2048 >> 8, 0 db 3072 >> 8, 20 @@ -1215,10 +1217,10 @@ SunStone: ; ee0f jp UseDisposableItem -.NoEffect +.NoEffect: call WontHaveAnyEffectMessage -.DecidedNotToUse +.DecidedNotToUse: xor a ld [wItemEffectSucceeded], a ret @@ -1594,7 +1596,7 @@ GetItemHealingAction: ; f058 (3:7058) ret ; f071 (3:7071) -.healingactions: ; f071 +.healingactions ; f071 ; item, party menu action text, status db ANTIDOTE, PARTYMENUTEXT_HEAL_PSN, 1 << PSN db BURN_HEAL, PARTYMENUTEXT_HEAL_BRN, 1 << BRN @@ -1618,7 +1620,7 @@ StatusHealer_Jumptable: ; f09e (3:709e) rst JumpTable ret -.dw: ; f0a3 (3:70a3) +.dw ; f0a3 (3:70a3) dw StatusHealer_ClearPalettes dw StatusHealer_NoEffect dw StatusHealer_ExitMenu @@ -1715,7 +1717,7 @@ FullRestore: ; f128 jp FullyHealStatus -.NotAtFullHealth +.NotAtFullHealth: call .FullRestore jp StatusHealer_Jumptable ; f144 @@ -2130,7 +2132,7 @@ rept 2 endr jr .next -.NotFound +.NotFound: scf .done ld e, [hl] @@ -2358,7 +2360,7 @@ endr ret ; f504 -.x_item_table: ; f504 +.x_item_table ; f504 db X_ATTACK, ATTACK db X_DEFEND, DEFENSE db X_SPEED, SPEED @@ -2411,7 +2413,7 @@ PokeFlute: ; f50c jp PrintText -.CureSleep +.CureSleep: ld de, PARTYMON_STRUCT_LENGTH ld c, PARTY_LENGTH @@ -2579,7 +2581,7 @@ Mysteryberry: ; f5bf cp 3 << 6 ; have 3 PP Ups already been used? jr c, .do_ppup -.CantUsePPUpOnSketch +.CantUsePPUpOnSketch: .pp_is_maxed_out ld hl, TextJump_PPIsMaxedOut call PrintText @@ -2622,7 +2624,7 @@ BattleRestorePP: ; f652 call PrintText jr FinishPPRestore -.UpdateBattleMonPP +.UpdateBattleMonPP: ld a, [CurPartyMon] ld hl, PartyMon1Moves ld bc, PARTYMON_STRUCT_LENGTH @@ -2826,7 +2828,7 @@ OpenBox: ; f769 jp UseDisposableItem ; f778 -.text: ; 0xf778 +.text ; 0xf778 ; There was a trophy inside! text_jump UnknownText_0x1c5d03 db "@" @@ -3182,7 +3184,7 @@ ComputeMaxPP: ; f881 dec c jr nz, .loop -.NoPPUp +.NoPPUp: ld [hl], b pop bc ret @@ -3315,3 +3317,5 @@ GetMthMoveOfCurrentMon: ; f969 add hl, bc ret ; f971 + +INCLUDE "items/pokeball_wobble.asm" diff --git a/items/pokeball_wobble.asm b/items/pokeball_wobble.asm new file mode 100755 index 000000000..7fb4d3e38 --- /dev/null +++ b/items/pokeball_wobble.asm @@ -0,0 +1,88 @@ +GetPokeBallWobble: ; f971 (3:7971) +; Returns whether a Poke Ball will wobble in the catch animation. +; Whether a Pokemon is caught is determined beforehand. + + push de + + ld a, [rSVBK] + ld d, a + push de + + ld a, 1 ; BANK(Buffer2) + ld [rSVBK], a + + ld a, [Buffer2] + inc a + ld [Buffer2], a + +; Wobble up to 3 times. + cp 3 + 1 + jr z, .finished + + ld a, [wWildMon] + and a + ld c, 0 ; next + jr nz, .done + + ld hl, .WobbleProbabilities + ld a, [Buffer1] + ld b, a +.loop + ld a, [hli] + cp b + jr nc, .checkwobble + inc hl + jr .loop + +.checkwobble + ld b, [hl] + call Random + cp b + ld c, 0 ; next + jr c, .done + ld c, 2 ; escaped + jr .done + +.finished + ld a, [wWildMon] + and a + ld c, 1 ; caught + jr nz, .done + ld c, 2 ; escaped + +.done + pop de + ld e, a + ld a, d + ld [rSVBK], a + ld a, e + pop de + ret + +.WobbleProbabilities: ; f9ba +; catch rate, chance of wobbling / 255 +; nLeft/255 = (nRight/255) ** 4 + db 1, 63 + db 2, 75 + db 3, 84 + db 4, 90 + db 5, 95 + db 7, 103 + db 10, 113 + db 15, 126 + db 20, 134 + db 30, 149 + db 40, 160 + db 50, 169 + db 60, 177 + db 80, 191 + db 100, 201 + db 120, 211 + db 140, 220 + db 160, 227 + db 180, 234 + db 200, 240 + db 220, 246 + db 240, 251 + db 254, 253 + db 255, 255 |