Merge branch 'master' into codex/add-fainted-pokemon-removal-feature-25ogww

This commit is contained in:
robjlyons 2026-02-10 16:57:28 +00:00 committed by GitHub
commit 5ba201db97
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 108 additions and 48 deletions

View File

@ -13,6 +13,14 @@ _PokemonFaintedText::
line "fainted!"
done
_PokemonRanAwayBadTrainingText::
text_ram wNameBuffer
text_start
line "ran away due"
cont "to your bad"
cont "training!"
prompt
_PlayerBlackedOutText::
text "<PLAYER> is out of"
line "useable #MON!"

View File

@ -268,7 +268,7 @@ StartBattle:
call SaveScreenTilesToBuffer1
ld a, [wWhichPokemon]
ld c, a
ld b, FLAG_SET
ld b, FLAG_TEST
push bc
ld hl, wPartyGainExpFlags
predef FlagActionPredef
@ -956,6 +956,12 @@ ReplaceFaintedEnemyMon:
ret
TrainerBattleVictory:
ld a, [wCurOpponent]
cp OPP_RIVAL1
jr nz, .notRival1Battle
xor a
ld [wWildEncounterCanCatch], a
.notRival1Battle
call EndLowHealthAlarm
ld b, MUSIC_DEFEATED_GYM_LEADER
ld a, [wGymLeaderNo]
@ -1106,15 +1112,48 @@ RemoveFaintedPlayerMon:
jr nc, .carelessTrainer ; if so, punish the player for being careless, as they shouldn't be fighting a very high leveled trainer with such a level difference
.regularFaint
farcall_ModifyPikachuHappiness PIKAHAPPY_FAINTED
ret
jr .handleRanAway
.carelessTrainer
farcall_ModifyPikachuHappiness PIKAHAPPY_CARELESSTRAINER
; fall through
.handleRanAway
call HandleFaintedPlayerMonRanAway
ret
PlayerMonFaintedText:
text_far _PlayerMonFaintedText
text_end
PlayerMonRanAwayBadTrainingText:
text_far _PokemonRanAwayBadTrainingText
text_end
HandleFaintedPlayerMonRanAway:
ld a, [wPartyCount]
cp 1
ret z ; don't remove the final party mon to avoid invalid 0-mon party state
ld a, [wPlayerMonNumber]
ld [wWhichPokemon], a
ld hl, wPartyMonNicks
call GetPartyMonName
ld hl, PlayerMonRanAwayBadTrainingText
call PrintText
xor a
ld [wRemoveMonFromBox], a
call RemovePokemon
ld a, [wPartyCount]
and a
ret z
dec a
ld b, a
ld a, [wPlayerMonNumber]
cp b
jr c, .done
ld a, b
ld [wPlayerMonNumber], a
.done
ret
MarkWildEncounterCatchUsed:
ld a, [wBattleType]
and a
@ -1498,9 +1537,7 @@ EnemySendOutFirstMon:
ld a, [wLinkState]
cp LINK_STATE_BATTLING
jr z, .next4
ld a, [wOptions]
bit BIT_BATTLE_SHIFT, a
jr nz, .next4
jr .next4 ; battle style is forced to SET
ld hl, TrainerAboutToUseText
call PrintText
hlcoord 0, 7

View File

@ -68,8 +68,10 @@ ApplyOutOfBattlePoisonDamage:
callfar PlayPikachuSoundClip
callfar_ModifyPikachuHappiness PIKAHAPPY_PSNFNT
.curMonNotPlayerPikachu
call HandlePoisonFaintedMonRanAway
pop de
pop hl
jr .restartAfterRemoval
.nextMon
inc hl
inc hl
@ -84,7 +86,28 @@ ApplyOutOfBattlePoisonDamage:
ld hl, wWhichPokemon
inc [hl]
pop hl
jr .applyDamageLoop
jp .applyDamageLoop
.restartAfterRemoval
ld a, [wPartyCount]
and a
jr z, .applyDamageLoopDone
ld a, [wWhichPokemon]
ld b, a
ld a, [wPartyCount]
cp b
jr z, .applyDamageLoopDone
ld hl, wPartySpecies
ld a, [wWhichPokemon]
ld c, a
ld b, 0
add hl, bc
ld d, h
ld e, l
ld hl, wPartyMon1Status
ld bc, PARTYMON_STRUCT_LENGTH
ld a, [wWhichPokemon]
call AddNTimes
jp .applyDamageLoop
.applyDamageLoopDone
ld hl, wPartyMon1Status
ld a, [wPartyCount]
@ -125,6 +148,34 @@ ApplyOutOfBattlePoisonDamage:
ld [wOutOfBattleBlackout], a
ret
PoisonFaintedMonRanAwayText:
text_far _PokemonRanAwayBadTrainingText
text_end
HandlePoisonFaintedMonRanAway:
ld a, [wPartyCount]
cp 1
ret z ; don't remove the final party mon to avoid invalid 0-mon party state
ld hl, wPartyMonNicks
call GetPartyMonName
ld hl, PoisonFaintedMonRanAwayText
call PrintText
xor a
ld [wRemoveMonFromBox], a
call RemovePokemon
ld a, [wPartyCount]
and a
ret z
dec a
ld b, a
ld a, [wWhichPokemon]
cp b
jr c, .done
ld a, b
ld [wWhichPokemon], a
.done
ret
Func_c4c7:
ld a, [wStepCounter]
and a

View File

@ -531,6 +531,7 @@ ItemUseBall:
ld [hl], a
ld a, [wEnemyMonSpecies]
ld [wCapturedMonSpecies], a
call MarkWildEncounterCatchUsedItem
ld [wCurPartySpecies], a
ld [wPokedexNum], a
call MarkWildEncounterCatchUsedItem

View File

@ -10,17 +10,8 @@ AskName:
ld a, [wCurPartySpecies]
ld [wNamedObjectIndex], a
call GetMonName
ld hl, DoYouWantToNicknameText
call PrintText
hlcoord 14, 7
lb bc, 8, 15
ld a, TWO_OPTION_MENU
ld [wTextBoxID], a
call DisplayTextBoxID
pop hl
ld a, [wCurrentMenuItem]
and a
jr nz, .declinedNickname
.enterNickname
ld a, [wUpdateSpritesEnabled]
push af
xor a
@ -40,13 +31,8 @@ AskName:
ld [wUpdateSpritesEnabled], a
ld a, [wStringBuffer]
cp '@'
ret nz
.declinedNickname
ld d, h
ld e, l
ld hl, wNameBuffer
ld bc, NAME_LENGTH
jp CopyData
jr z, .enterNickname ; force a nickname (can't skip with empty input)
ret
DoYouWantToNicknameText:
text_far _DoYouWantToNicknameText

View File

@ -175,38 +175,15 @@ OptionsMenu_BattleAnimations:
.Off: db "OFF@"
OptionsMenu_BattleStyle:
ldh a, [hJoy5]
and PAD_LEFT | PAD_RIGHT
jr nz, .buttonPressed
ld a, [wOptions]
and 1 << BIT_BATTLE_SHIFT
jr .nothingPressed
.buttonPressed
ld a, [wOptions]
xor 1 << BIT_BATTLE_SHIFT
or 1 << BIT_BATTLE_SHIFT ; force SET
ld [wOptions], a
.nothingPressed
ld bc, 0
sla a
sla a
rl c
ld hl, .Strings
add hl, bc
add hl, bc
ld e, [hl]
inc hl
ld d, [hl]
ld de, .Set
hlcoord 14, 6
call PlaceString
and a ; clear carry flag
ret
.Strings:
dw .Shift
dw .Set
.Shift: db "SHIFT@"
.Set: db "SET @"