mirror of
https://github.com/thornAvery/jep-hack.git
synced 2026-02-06 16:15:24 +13:00
Gen 6+ Experience System
Makes the EXP. Share into a Key item and gives it to all party members. Changed several item descriptions to be less garbage Made the Dragon Fang boost attack like it should (Dragon Scale is left unchanged) The Lottery now gives you a Lucky Egg if you win 2nd Prize, the EXP Share is still obtained from Mr. Pokemon
This commit is contained in:
parent
7554222e3c
commit
af83085749
7 changed files with 101 additions and 193 deletions
|
|
@ -2188,97 +2188,28 @@ UpdateBattleStateAndExperienceAfterEnemyFaint:
|
|||
ld a, [wBattleResult]
|
||||
and BATTLERESULT_BITMASK
|
||||
ld [wBattleResult], a ; WIN
|
||||
call IsAnyMonHoldingExpShare
|
||||
jr z, .skip_exp
|
||||
ld hl, wEnemyMonBaseStats
|
||||
ld b, wEnemyMonEnd - wEnemyMonBaseStats
|
||||
.loop
|
||||
srl [hl]
|
||||
inc hl
|
||||
dec b
|
||||
jr nz, .loop
|
||||
|
||||
.skip_exp
|
||||
ld hl, wEnemyMonBaseStats
|
||||
ld de, wBackupEnemyMonBaseStats
|
||||
ld bc, wEnemyMonEnd - wEnemyMonBaseStats
|
||||
call CopyBytes
|
||||
xor a
|
||||
ld [wGivingExperienceToExpShareHolders], a
|
||||
; Preserve bits of non-fainted participants
|
||||
ld a, [wBattleParticipantsNotFainted]
|
||||
ld d, a
|
||||
push de
|
||||
call GiveExperiencePoints
|
||||
call IsAnyMonHoldingExpShare
|
||||
pop de
|
||||
; If Exp. Share is ON, give 50% EXP to non-participants
|
||||
ld a, [wExpShareToggle]
|
||||
and a
|
||||
ret z
|
||||
|
||||
ld hl, wEnemyMonBaseExp
|
||||
srl [hl]
|
||||
ld a, [wBattleParticipantsNotFainted]
|
||||
push af
|
||||
ld a, d
|
||||
xor %00111111
|
||||
ld [wBattleParticipantsNotFainted], a
|
||||
ld hl, wBackupEnemyMonBaseStats
|
||||
ld de, wEnemyMonBaseStats
|
||||
ld bc, wEnemyMonEnd - wEnemyMonBaseStats
|
||||
call CopyBytes
|
||||
ld a, $1
|
||||
ld [wGivingExperienceToExpShareHolders], a
|
||||
call GiveExperiencePoints
|
||||
pop af
|
||||
ld [wBattleParticipantsNotFainted], a
|
||||
ret
|
||||
|
||||
IsAnyMonHoldingExpShare:
|
||||
ld a, [wPartyCount]
|
||||
ld b, a
|
||||
ld hl, wPartyMon1
|
||||
ld c, 1
|
||||
ld d, 0
|
||||
.loop
|
||||
push hl
|
||||
push bc
|
||||
ld bc, MON_HP
|
||||
add hl, bc
|
||||
ld a, [hli]
|
||||
or [hl]
|
||||
pop bc
|
||||
pop hl
|
||||
jr z, .next
|
||||
|
||||
push hl
|
||||
push bc
|
||||
ld bc, MON_ITEM
|
||||
add hl, bc
|
||||
pop bc
|
||||
ld a, [hl]
|
||||
pop hl
|
||||
|
||||
cp EXP_SHARE
|
||||
jr nz, .next
|
||||
ld a, d
|
||||
or c
|
||||
ld d, a
|
||||
|
||||
.next
|
||||
sla c
|
||||
push de
|
||||
ld de, PARTYMON_STRUCT_LENGTH
|
||||
add hl, de
|
||||
pop de
|
||||
dec b
|
||||
jr nz, .loop
|
||||
|
||||
ld a, d
|
||||
ld e, 0
|
||||
ld b, PARTY_LENGTH
|
||||
.loop2
|
||||
srl a
|
||||
jr nc, .okay
|
||||
inc e
|
||||
|
||||
.okay
|
||||
dec b
|
||||
jr nz, .loop2
|
||||
ld a, e
|
||||
and a
|
||||
ret
|
||||
|
||||
StopDangerSound:
|
||||
xor a
|
||||
ld [wLowHealthAlarm], a
|
||||
|
|
@ -2595,10 +2526,6 @@ PlayVictoryMusic:
|
|||
ld a, [wBattleMode]
|
||||
dec a
|
||||
jr nz, .trainer_victory
|
||||
push de
|
||||
call IsAnyMonHoldingExpShare
|
||||
pop de
|
||||
jr nz, .play_music
|
||||
ld hl, wPayDayMoney
|
||||
ld a, [hli]
|
||||
or [hl]
|
||||
|
|
@ -7064,7 +6991,6 @@ GiveExperiencePoints:
|
|||
bit 0, a
|
||||
ret nz
|
||||
|
||||
call .EvenlyDivideExpAmongParticipants
|
||||
xor a
|
||||
ld [wCurPartyMon], a
|
||||
ld bc, wPartyMon1Species
|
||||
|
|
@ -7433,40 +7359,6 @@ GiveExperiencePoints:
|
|||
.done
|
||||
jp ResetBattleParticipants
|
||||
|
||||
.EvenlyDivideExpAmongParticipants:
|
||||
; count number of battle participants
|
||||
ld a, [wBattleParticipantsNotFainted]
|
||||
ld b, a
|
||||
ld c, PARTY_LENGTH
|
||||
ld d, 0
|
||||
.count_loop
|
||||
xor a
|
||||
srl b
|
||||
adc d
|
||||
ld d, a
|
||||
dec c
|
||||
jr nz, .count_loop
|
||||
cp 2
|
||||
ret c
|
||||
|
||||
ld [wTempByteValue], a
|
||||
ld hl, wEnemyMonBaseStats
|
||||
ld c, wEnemyMonEnd - wEnemyMonBaseStats
|
||||
.base_stat_division_loop
|
||||
xor a
|
||||
ldh [hDividend + 0], a
|
||||
ld a, [hl]
|
||||
ldh [hDividend + 1], a
|
||||
ld a, [wTempByteValue]
|
||||
ldh [hDivisor], a
|
||||
ld b, 2
|
||||
call Divide
|
||||
ldh a, [hQuotient + 3]
|
||||
ld [hli], a
|
||||
dec c
|
||||
jr nz, .base_stat_division_loop
|
||||
ret
|
||||
|
||||
BoostExp:
|
||||
; Multiply experience by 1.5x
|
||||
push bc
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ ItemEffects:
|
|||
dw EvoStoneEffect ; FIRE_STONE
|
||||
dw EvoStoneEffect ; THUNDERSTONE
|
||||
dw EvoStoneEffect ; WATER_STONE
|
||||
dw NoEffect ; FAIRY_FEATHER
|
||||
dw NoEffect ; FAIRY_FEATHER
|
||||
dw VitaminEffect ; HP_UP
|
||||
dw VitaminEffect ; PROTEIN
|
||||
dw VitaminEffect ; IRON
|
||||
|
|
@ -70,7 +70,7 @@ ItemEffects:
|
|||
dw CoinCaseEffect ; COIN_CASE
|
||||
dw ItemfinderEffect ; ITEMFINDER
|
||||
dw PokeFluteEffect ; POKE_FLUTE
|
||||
dw NoEffect ; EXP_SHARE
|
||||
dw ExpShareEffect ; EXP_SHARE
|
||||
dw OldRodEffect ; OLD_ROD
|
||||
dw GoodRodEffect ; GOOD_ROD
|
||||
dw NoEffect ; SILVER_LEAF
|
||||
|
|
@ -215,11 +215,14 @@ ItemEffects:
|
|||
; This has been amended for architectural purposes, and because we have a shitload of SW97 items to add.
|
||||
|
||||
PokeBallEffect:
|
||||
; BUG: The Dude's catching tutorial may crash if his Poké Ball can't be used (see docs/bugs_and_glitches.md)
|
||||
ld a, [wBattleMode]
|
||||
dec a
|
||||
jp nz, UseBallInTrainerBattle
|
||||
|
||||
ld a, [wBattleType]
|
||||
cp BATTLETYPE_TUTORIAL
|
||||
jr z, .room_in_party ; Fixes a catching tutorial bug
|
||||
|
||||
ld a, [wPartyCount]
|
||||
cp PARTY_LENGTH
|
||||
jr nz, .room_in_party
|
||||
|
|
@ -232,11 +235,10 @@ PokeBallEffect:
|
|||
jp z, Ball_BoxIsFullMessage
|
||||
|
||||
.room_in_party
|
||||
; BUG: Using a Park Ball in non-Contest battles has a corrupt animation (see docs/bugs_and_glitches.md)
|
||||
xor a
|
||||
ld [wWildMon], a
|
||||
ld a, [wCurItem]
|
||||
cp PARK_BALL
|
||||
ld a, [wBattleType]
|
||||
cp BATTLETYPE_CONTEST ; Fixes the Park Ball corrupting graphics when used outside of a Contest
|
||||
call nz, ReturnToBattle_UseBall
|
||||
|
||||
ld hl, wOptions
|
||||
|
|
@ -341,12 +343,12 @@ PokeBallEffect:
|
|||
jr nz, .statuscheck
|
||||
ld a, 1
|
||||
.statuscheck
|
||||
; BUG: BRN/PSN/PAR do not affect catch rate (see docs/bugs_and_glitches.md)
|
||||
ld b, a
|
||||
ld a, [wEnemyMonStatus]
|
||||
and 1 << FRZ | SLP_MASK
|
||||
ld c, 10
|
||||
jr nz, .addstatus
|
||||
ld a, [wEnemyMonStatus] ; Fixes a bug where Burn, Poison and Paralysis have no effect on catch rate
|
||||
and a
|
||||
ld c, 5
|
||||
jr nz, .addstatus
|
||||
|
|
@ -358,10 +360,10 @@ PokeBallEffect:
|
|||
ld a, $ff
|
||||
.max_1
|
||||
|
||||
; BUG: HELD_CATCH_CHANCE has no effect (see docs/bugs_and_glitches.md)
|
||||
ld d, a
|
||||
push de
|
||||
ld a, [wBattleMonItem]
|
||||
ld b, a ; Fixes this effect having no effect when loaded
|
||||
farcall GetItemHeldEffect
|
||||
ld a, b
|
||||
cp HELD_CATCH_CHANCE
|
||||
|
|
@ -946,7 +948,7 @@ LoveBallMultiplier:
|
|||
inc d ; female
|
||||
.got_wild_gender
|
||||
|
||||
; BUG: Love Ball boosts catch rate for the wrong gender (see docs/bugs_and_glitches.md)
|
||||
; BUG?: Love Ball boosts catch rate for the same gender. We're currently keeping it because we're all gay.
|
||||
ld a, d
|
||||
pop de
|
||||
cp d
|
||||
|
|
@ -981,7 +983,7 @@ FastBallMultiplier:
|
|||
push bc
|
||||
|
||||
.loop
|
||||
; BUG: Fast Ball only boosts catch rate for three Pokémon (see docs/bugs_and_glitches.md)
|
||||
; BUG: Fast Ball only boosts catch rate for three Pokémon (not sure if this has been fixed here)
|
||||
ld a, BANK(FleeMons)
|
||||
call GetFarByte
|
||||
ld c, a
|
||||
|
|
@ -1876,19 +1878,16 @@ LoadCurHPIntoBuffer3:
|
|||
ld [wHPBuffer3], a
|
||||
ret
|
||||
|
||||
LoadHPIntoBuffer3: ; unreferenced
|
||||
ld a, d
|
||||
ld [wHPBuffer3 + 1], a
|
||||
ld a, e
|
||||
ld [wHPBuffer3], a
|
||||
ret
|
||||
ExpShareEffect:
|
||||
ld a, [wExpShareToggle]
|
||||
xor 1
|
||||
ld [wExpShareToggle], a
|
||||
and a
|
||||
ld hl, ExpShareToggleOn
|
||||
jp nz, PrintText
|
||||
|
||||
LoadHPFromBuffer3: ; unreferenced
|
||||
ld a, [wHPBuffer3 + 1]
|
||||
ld d, a
|
||||
ld a, [wHPBuffer3]
|
||||
ld e, a
|
||||
ret
|
||||
ld hl, ExpShareToggleOff
|
||||
jp PrintText
|
||||
|
||||
LoadCurHPIntoBuffer2:
|
||||
ld a, MON_HP
|
||||
|
|
@ -2712,6 +2711,14 @@ ItemGotOffText: ; unreferenced
|
|||
text_far _ItemGotOffText
|
||||
text_end
|
||||
|
||||
ExpShareToggleOff:
|
||||
text_far _ExpShareToggleOff
|
||||
text_end
|
||||
|
||||
ExpShareToggleOn:
|
||||
text_far _ExpShareToggleOn
|
||||
text_end
|
||||
|
||||
ApplyPPUp:
|
||||
ld a, MON_MOVES
|
||||
call GetPartyParamLocation
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue