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:
Martha Schilling 2024-07-01 18:58:19 +01:00
parent 7554222e3c
commit af83085749
7 changed files with 101 additions and 193 deletions

View file

@ -121,7 +121,7 @@ ItemAttributes:
; POKE_FLUTE
item_attribute $9999, HELD_NONE, 0, NO_LIMITS, ITEM, ITEMMENU_NOUSE, ITEMMENU_NOUSE
; EXP_SHARE
item_attribute 3000, HELD_NONE, 0, CANT_SELECT, ITEM, ITEMMENU_NOUSE, ITEMMENU_NOUSE
item_attribute 0, HELD_NONE, 0, CANT_SELECT | CANT_TOSS, KEY_ITEM, ITEMMENU_CURRENT, ITEMMENU_NOUSE
; OLD_ROD
item_attribute 0, HELD_NONE, 0, CANT_TOSS, KEY_ITEM, ITEMMENU_CLOSE, ITEMMENU_NOUSE
; GOOD_ROD
@ -294,9 +294,8 @@ ItemAttributes:
item_attribute 2100, HELD_NONE, 0, CANT_SELECT, ITEM, ITEMMENU_PARTY, ITEMMENU_NOUSE
; METAL_COAT
item_attribute 100, HELD_STEEL_BOOST, 10, CANT_SELECT, ITEM, ITEMMENU_NOUSE, ITEMMENU_NOUSE
; BUG: Dragon Scale, not Dragon Fang, boosts Dragon-type moves (see docs/bugs_and_glitches.md)
; DRAGON_FANG
item_attribute 100, HELD_NONE, 0, CANT_SELECT, ITEM, ITEMMENU_NOUSE, ITEMMENU_NOUSE
item_attribute 100, HELD_DRAGON_BOOST, 0, CANT_SELECT, ITEM, ITEMMENU_NOUSE, ITEMMENU_NOUSE
; BLK_AUGURITE
item_attribute 2100, HELD_NONE, 0, CANT_SELECT, ITEM, ITEMMENU_PARTY, ITEMMENU_NOUSE
; LEFTOVERS

View file

@ -389,7 +389,7 @@ LeafStoneDesc:
MetalPowderDesc:
db "Raises DEFENSE of"
next "DITTO. (HOLD)@"
next "DITTO and MIMMEO.@"
NuggetDesc:
db "Made of pure gold."
@ -465,7 +465,7 @@ ItemfinderDesc:
ExpShareDesc:
db "Shares battle EXP."
next "Points. (HOLD)@"
next "Points.@"
OldRodDesc:
db "Use by water to"
@ -504,8 +504,8 @@ RedScaleDesc:
next "red GYARADOS.@"
SecretPotionDesc:
db "Fully heals any"
next "#MON.@"
db "It can heal any"
next "#MON illness.@"
SSTicketDesc:
db "A ticket for the"
@ -528,8 +528,8 @@ MoomooMilkDesc:
next "HP by 100.@"
QuickClawDesc:
db "Raises 1st strike"
next "ratio. (HOLD)@"
db "May allow the user"
next "to move first.@"
PsnCureBerryDesc:
db "A self-cure for"
@ -540,11 +540,11 @@ GoldLeafDesc:
next "colored leaf.@"
SoftSandDesc:
db "Powers up ground-"
db "Powers up GROUND-"
next "type moves. (HOLD)@"
SharpBeakDesc:
db "Powers up flying-"
db "Powers up FLYING-"
next "type moves. (HOLD)@"
PrzCureBerryDesc:
@ -560,7 +560,7 @@ IceBerryDesc:
next "burn. (HOLD)@"
PoisonBarbDesc:
db "Powers up poison-"
db "Powers up POISON-"
next "type moves. (HOLD)@"
KingsRockDesc:
@ -587,7 +587,7 @@ BigMushroomDesc:
next "Sell high.@"
SilverPowderDesc:
db "Powers up bug-type"
db "Powers up BUG-type"
next "moves. (HOLD)@"
BluApricornDesc:
@ -608,18 +608,18 @@ CleanseTagDesc:
next "#MON. (HOLD)@"
MysticWaterDesc:
db "Powers up water-"
db "Powers up WATER-"
next "type moves. (HOLD)@"
TwistedSpoonDesc:
db "Powers up psychic-"
db "Powers up PSYCHIC-"
next "type moves. (HOLD)@"
WhtApricornDesc:
db "A white APRICORN.@"
BlackbeltDesc:
db "Boosts fighting-"
db "Boosts FIGHTING-"
next "type moves. (HOLD)@"
BlkApricornDesc:
@ -631,7 +631,7 @@ PnkApricornDesc:
next "@"
BlackGlassesDesc:
db "Powers up dark-"
db "Powers up DARK-"
next "type moves. (HOLD)@"
SlowpokeTailDesc:
@ -639,23 +639,23 @@ SlowpokeTailDesc:
next "high.@"
PinkBowDesc:
db "Powers up normal-"
db "Powers up NORMAL-"
next "type moves. (HOLD)@"
StickDesc:
db "An ordinary stick."
next "Sell low.@"
db "Ups crit ratio of"
next "FARFETCH'D. (HOLD)@"
SmokeBallDesc:
db "Escape from wild"
next "#MON. (HOLD)@"
NeverMeltIceDesc:
db "Powers up ice-type"
db "Powers up ICE-type"
next "moves. (HOLD)@"
MagnetDesc:
db "Boosts electric-"
db "Boosts ELECTRIC-"
next "type moves. (HOLD)@"
MiracleBerryDesc:
@ -675,7 +675,7 @@ EverStoneDesc:
next "(HOLD)@"
SpellTagDesc:
db "Powers up ghost-"
db "Powers up GHOST-"
next "type moves. (HOLD)@"
RageCandyBarDesc:
@ -691,16 +691,16 @@ BlueCardDesc:
next "points.@"
MiracleSeedDesc:
db "Powers up grass-"
db "Powers up GRASS-"
next "type moves. (HOLD)@"
ThickClubDesc:
db "A bone of some"
next "sort. Sell low.@"
db "Raises ATTACK of"
next "the CUBONE line.@"
FocusBandDesc:
db "May prevent faint-"
next "ing. (HOLD)@"
db "It may prevent"
next "fainting. (HOLD)@"
EnergyPowderDesc:
db "Restores #MON"
@ -719,7 +719,7 @@ RevivalHerbDesc:
next "#MON. Bitter.@"
HardStoneDesc:
db "Powers up rock-"
db "Powers up ROCK-"
next "type moves. (HOLD)@"
LuckyEggDesc:
@ -735,8 +735,8 @@ MachinePartDesc:
next "the POWER PLANT.@"
EggTicketDesc:
db "May use at Golden-"
next "rod trade corner.@"
db "This item cannot"
next "be used.@"
LostItemDesc:
db "The # DOLL lost"
@ -758,7 +758,7 @@ PassDesc:
next "MAGNET TRAIN.@"
CharcoalDesc:
db "Powers up fire-"
db "Powers up FIRE-"
next "type moves. (HOLD)@"
BerryJuiceDesc:
@ -770,11 +770,11 @@ ScopeLensDesc:
next "hit ratio. (HOLD)@"
MetalCoatDesc:
db "Powers up steel-"
db "Powers up STEEL-"
next "type moves. (HOLD)@"
DragonFangDesc:
db "Powers up dragon-"
db "Powers up DRAGON-"
next "type moves. (HOLD)@"
LeftoversDesc:
@ -786,8 +786,8 @@ MysteryBerryDesc:
next "for PP. (HOLD)@"
DragonScaleDesc:
db "A rare dragon-type"
next "item.@"
db "Powers up DRAGON-"
next "type moves. (HOLD)@"
BerserkGeneDesc:
db "Boosts ATTACK but"
@ -818,8 +818,8 @@ FastBallDesc:
next "ing fast #MON.@"
LightBallDesc:
db "An odd, electrical"
next "orb. (HOLD)@"
db "Ups SPECIAL ATTACK"
next "of PIKACHU. (HOLD)@"
FriendBallDesc:
db "A BALL that makes"
@ -846,7 +846,7 @@ SunStoneDesc:
next "kinds of #MON.@"
PolkadotBowDesc:
db "Powers up normal-"
db "Powers up NORMAL-"
next "type moves. (HOLD)@"
AntiquePotDesc:
@ -921,24 +921,24 @@ MirageMailDesc:
next "(HOLD)@"
FairyFeatherDesc:
db "Powers up fairy-"
db "Powers up FAIRY-"
next "type moves. (HOLD)@"
OldAmberDesc:
db "Amber with DNA of"
next "an ancient #MON."
db "Fossilized resin"
next "containing DNA.@"
DomeFossilDesc:
db "A dome-shaped fossil"
next "of an ancient #MON."
db "The shell of an"
next "ancient #MON.@"
HelixFossilDesc:
db "A swirl-shaped fossil"
next "of an ancient #MON."
db "The shell of an"
next "ancient #MON.@"
WingFossilDesc:
db "A wing-shaped fossil"
next "of an ancient #MON."
db "The wing of an"
next "ancient #MON.@"
HeartStoneDesc:
db "Evolves certain"

View file

@ -1409,6 +1409,16 @@ _ItemGotOffText::
text "."
prompt
_ExpShareToggleOn::
text "The EXP.SHARE was"
line "turned on."
prompt
_ExpShareToggleOff::
text "The EXP.SHARE was"
line "turned off."
prompt
_KnowsMoveText::
text_ram wStringBuffer1
text " knows"

View file

@ -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

View file

@ -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

View file

@ -82,7 +82,7 @@ RadioTower1FLuckyNumberManScript:
playsound SFX_2ND_PLACE
waitsfx
promptbutton
giveitem EXP_SHARE
giveitem LUCKY_EGG
iffalse .BagFull
itemnotify
setflag ENGINE_LUCKY_NUMBER_SHOW
@ -275,8 +275,8 @@ RadioTower1FLuckyNumberManOkayMatchText:
cont "three numbers!"
para "You've won second"
line "prize, an EXP."
cont "SHARE!"
line "prize, a LUCKY"
cont "EGG!"
done
RadioTower1FLuckyNumberManWeakMatchText:

View file

@ -3020,7 +3020,7 @@ wRegisteredItem:: db
wPlayerState:: db
wHallOfFameCount:: db
ds 1
wExpShareToggle:: db
wTradeFlags:: flag_array NUM_NPC_TRADES
ds 1
wMooMooBerries:: db