Fix a bunch of single player battle engine bugs

went through a bunch of the tutorials here;
https://github.com/pret/pokered/wiki/Bugs-and-Glitches#blaine-uses-super-potion-even-when-his-pok%C3%A9mon-arent-below-10-health

Overall:
- Blaine is no longer addicted to Super Potions
- CoolTrainerF no longer switches a lot
- Transformed Pokemon aren't presumed to be Dittos (very important given Animon)
- Status curing items don't remove modifiers anymore
- Learning new moves plays the sound in the correct bank
This commit is contained in:
May Evans 2022-08-31 14:42:36 +01:00
parent cab111d01b
commit 7c6bbb630f
3 changed files with 37 additions and 7 deletions

View file

@ -345,7 +345,7 @@ CooltrainerFAI:
; The intended 25% chance to consider switching will not apply. ; The intended 25% chance to consider switching will not apply.
; Uncomment the line below to fix this. ; Uncomment the line below to fix this.
cp 25 percent + 1 cp 25 percent + 1
; ret nc ret nc ; fixes the bug
ld a, 10 ld a, 10
call AICheckIfHPBelowFraction call AICheckIfHPBelowFraction
jp c, AIUseHyperPotion jp c, AIUseHyperPotion
@ -387,6 +387,9 @@ KogaAI:
BlaineAI: BlaineAI:
cp 25 percent + 1 cp 25 percent + 1
ret nc ret nc
ld a, 10
call AICheckIfHPBelowFraction
ret nc ; this fixes the super potion thing - PvK
jp AIUseSuperPotion jp AIUseSuperPotion
SabrinaAI: SabrinaAI:

View file

@ -473,9 +473,7 @@ ItemUseBall:
; Mirror Move even though the only wild Pokémon that knows Transform is Ditto. ; Mirror Move even though the only wild Pokémon that knows Transform is Ditto.
ld hl, wEnemyBattleStatus3 ld hl, wEnemyBattleStatus3
bit TRANSFORMED, [hl] bit TRANSFORMED, [hl]
jr z, .notTransformed jr z, .notTransformed ; removed lines that cause above bug - PvK
ld a, DITTO
ld [wEnemyMonSpecies2], a
jr .skip6 jr .skip6
.notTransformed .notTransformed
@ -909,7 +907,10 @@ ItemUseMedicine:
ld de, wBattleMonStats ld de, wBattleMonStats
ld bc, NUM_STATS * 2 ld bc, NUM_STATS * 2
call CopyData ; copy party stats to in-battle stat data call CopyData ; copy party stats to in-battle stat data
predef DoubleOrHalveSelectedStats xor a
ld [wCalculateWhoseStats], a
callfar CalculateModifiedStats
callfar ApplyBadgeStatBoosts
jp .doneHealing jp .doneHealing
.healHP .healHP
inc hl ; hl = address of current HP inc hl ; hl = address of current HP

View file

@ -205,12 +205,38 @@ TryingToLearnText:
text_far _TryingToLearnText text_far _TryingToLearnText
text_end text_end
OneTwoAndText: OneTwoAndText: ; uses the fixed move swap sound - PvK
text_far _OneTwoAndText text_far _OneTwoAndText
text_pause text_pause
text_asm text_asm
text_far _OneTwoAndText
text_pause
text_asm
push af
push bc
push de
push hl
ld a, $1
ld [wMuteAudioAndPauseMusic], a
call DelayFrame
ld a, [wAudioROMBank]
push af
ld a, BANK(SFX_Swap_1)
ld [wAudioROMBank], a
ld [wAudioSavedROMBank], a
call WaitForSoundToFinish
ld a, SFX_SWAP ld a, SFX_SWAP
call PlaySoundWaitForCurrent call PlaySound
call WaitForSoundToFinish
pop af
ld [wAudioROMBank], a
ld [wAudioSavedROMBank], a
xor a
ld [wMuteAudioAndPauseMusic], a
pop hl
pop de
pop bc
pop af
ld hl, PoofText ld hl, PoofText
ret ret