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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue