summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpikalaxalt <PikalaxALT@gmail.com>2016-06-19 09:16:31 -0400
committerpikalaxalt <PikalaxALT@gmail.com>2016-06-19 09:16:31 -0400
commit1174049b262d27fd89a6da97f787d8bd01d4f5a6 (patch)
treeaa2036451be1482637806654b9ffc9298b8613c0
parent27926d7329c8cb946aee1720bdbc7a3665e9d64f (diff)
FINISH BANK 1
-rwxr-xr-xconstants/predef_constants.asm4
-rwxr-xr-xevent/happiness_egg.asm216
-rwxr-xr-xevent/special.asm197
-rw-r--r--main.asm27
4 files changed, 431 insertions, 13 deletions
diff --git a/constants/predef_constants.asm b/constants/predef_constants.asm
index 990181ab..8a3b2cf3 100755
--- a/constants/predef_constants.asm
+++ b/constants/predef_constants.asm
@@ -9,7 +9,7 @@
predef_const FillPP
predef_const TryAddMonToParty
predef_const AddTempmonToParty
- predef_const SentGetPkmnIntoFromBox
+ predef_const SentGetPkmnIntoFromBox ; $8
predef_const SentPkmnIntoBox
predef_const GiveEgg
predef_const AnimateHPBar
@@ -17,7 +17,7 @@
predef_const CalcPkmnStatC
predef_const CanLearnTMHMMove
predef_const GetTMHMMove
- predef_const Predef_LinkTextbox ; $ 10
+ predef_const Predef_LinkTextbox ; $10
predef_const PrintMoveDesc
predef_const UpdatePlayerHUD
predef_const PlaceGraphic
diff --git a/event/happiness_egg.asm b/event/happiness_egg.asm
new file mode 100755
index 00000000..8d738774
--- /dev/null
+++ b/event/happiness_egg.asm
@@ -0,0 +1,216 @@
+GetFirstPokemonHappiness:
+ ld hl, wPartyMon1Happiness
+ ld bc, $30
+ ld de, wPartySpecies
+.asm_7275
+ ld a, [de]
+ cp $fd
+ jr nz, .asm_727e
+ inc de
+ add hl, bc
+ jr .asm_7275
+
+.asm_727e
+ ld [wd151], a
+ ld a, [hl]
+ ld [wd173], a
+ call GetPokemonName
+ jp Function7542
+
+CheckFirstMonIsEgg:
+ ld a, [wPartySpecies]
+ ld [wd151], a
+ cp $fd
+ ld a, $1
+ jr z, .asm_7298
+ xor a
+.asm_7298
+ ld [wd173], a
+ call GetPokemonName
+ jp Function7542
+
+ChangeHappiness: ; 72a1 (1:72a1)
+ ld a, [wd005]
+ inc a
+ ld e, a
+ ld d, $0
+ ld hl, wPartyCount
+ add hl, de
+ ld a, [hl]
+ cp $fd
+ ret z
+ push bc
+ ld hl, wPartyMon1Happiness
+ ld bc, $30
+ ld a, [wd005]
+ call AddNTimes
+ pop bc
+ ld d, h
+ ld e, l
+ push de
+ ld a, [de]
+ cp $64
+ ld e, $0
+ jr c, .asm_72ce
+ inc e
+ cp $c8
+ jr c, .asm_72ce
+ inc e
+.asm_72ce
+ dec c
+ ld b, $0
+ ld hl, .Actions
+ add hl, bc
+ add hl, bc
+ add hl, bc
+ ld d, $0
+ add hl, de
+ ld a, [hl]
+ cp $64
+ pop de
+ ld a, [de]
+ jr nc, .asm_72e8
+ add [hl]
+ jr nc, .asm_72ec
+ ld a, $ff
+ jr .asm_72ec
+
+.asm_72e8
+ add [hl]
+ jr c, .asm_72ec
+ xor a
+.asm_72ec
+ ld [de], a
+ ld a, [wBattleMode]
+ and a
+ ret z
+ ld a, [wd005]
+ ld b, a
+ ld a, [wcfc9]
+ cp b
+ ret nz
+ ld a, [de]
+ ld [wBattleMonHappiness], a
+ ret
+
+.Actions:
+ db +5, +3, +2 ; Gained a level
+ db +5, +3, +2 ; Vitamin
+ db +1, +1, +0 ; X Item
+ db +3, +2, +1 ; Battled a Gym Leader
+ db +1, +1, +0 ; Learned a move
+ db -1, -1, -1 ; Lost to an enemy
+ db -5, -5, -10 ; Fainted due to poison
+ db -5, -5, -10 ; Lost to a much stronger enemy
+ db +1, +1, +1 ; Haircut (Y1)
+ db +3, +3, +1 ; Haircut (Y2)
+ db +5, +5, +2 ; Haircut (Y3)
+ db +1, +1, +1 ; Haircut (O1)
+ db +3, +3, +1 ; Haircut (O2)
+ db +10, +10, +4 ; Haircut (O3)
+ db -5, -5, -10 ; Used Heal Powder or Energypowder (bitter)
+ db -10, -10, -15 ; Used Energy Root (bitter)
+ db -15, -15, -20 ; Used Revival Herb (bitter)
+ db +3, +3, +1 ; Grooming
+
+StepHappiness::
+ ld hl, wd9c1
+ ld a, [hl]
+ inc a
+ and $1
+ ld [hl], a
+ ret nz
+ ld de, wPartyCount
+ ld a, [de]
+ and a
+ ret z
+ ld c, a
+ ld hl, wPartyMon1Happiness
+.asm_7349
+ inc de
+ ld a, [de]
+ cp EGG
+ jr z, .asm_7354
+ inc [hl]
+ jr nz, .asm_7354
+ ld [hl], $ff
+.asm_7354
+ push de
+ ld de, $30
+ add hl, de
+ pop de
+ dec c
+ jr nz, .asm_7349
+ ret
+
+DaycareStep::
+ ld a, [wdc40]
+ bit 0, a
+ jr z, .daycare_lady
+ ld a, [wdc76]
+ cp 100
+ jr nc, .daycare_lady
+ ld hl, wdc61
+ inc [hl]
+ jr nz, .daycare_lady
+ dec hl
+ inc [hl]
+ jr nz, .daycare_lady
+ dec hl
+ inc [hl]
+ ld a, [hl]
+ cp 5242880 / $10000
+ jr c, .daycare_lady
+ ld a, 5242880 / $10000
+ ld [hl], a
+.daycare_lady
+ ld a, [wdc77]
+ bit 0, a
+ jr z, .check_egg
+ ld a, [wdcaf]
+ cp 100
+ jr nc, .check_egg
+ ld hl, wdc9a
+ inc [hl]
+ jr nz, .check_egg
+ dec hl
+ inc [hl]
+ jr nz, .check_egg
+ dec hl
+ inc [hl]
+ ld a, [hl]
+ cp 5242880 / $10000
+ jr c, .check_egg
+ ld a, 5242880 / $10000
+ ld [hl], a
+.check_egg
+ ld hl, wdc40
+ bit 5, [hl]
+ ret z
+ ld hl, wdc78
+ dec [hl]
+ ret nz
+ call Random
+ ld [hl], a
+ callab Function171d1
+ ld a, [wd151]
+ cp 230
+ ld b, -1 + 32 percent
+ jr nc, .okay
+ ld a, [wd151]
+ cp 170
+ ld b, 16 percent
+ jr nc, .okay
+ ld a, [wd151]
+ cp 110
+ ld b, 12 percent
+ jr nc, .okay
+ ld b, 4 percent
+.okay
+ call Random
+ cp b
+ ret nc
+ ld hl, wdc40
+ res 5, [hl]
+ set 6, [hl]
+ ret
diff --git a/event/special.asm b/event/special.asm
new file mode 100755
index 00000000..3059d5cc
--- /dev/null
+++ b/event/special.asm
@@ -0,0 +1,197 @@
+Function73e1:
+ xor a
+ ld [wce5f], a
+ ld a, SHUCKLE
+ ld [wd004], a
+ ld a, $f
+ ld [wd040], a
+ predef TryAddMonToParty
+ jr nc, .asm_743f
+ ld bc, $30
+ ld a, [wPokemonData]
+ dec a
+ push af
+ push bc
+ ld hl, wPartyMon1Item
+ call AddNTimes
+ ld [hl], BERRY
+ pop bc
+ pop af
+ ld hl, wPartyMon1ID
+ call AddNTimes
+ ld a, $2
+ ld [hli], a
+ ld [hl], $6
+ ld a, [wPokemonData]
+ dec a
+ ld hl, wPartyMonNicknames
+ call SkipNames
+ ld de, ShuckieName
+ call CopyName2
+ ld a, [wPartyCount]
+ dec a
+ ld hl, wPartyMon6StatsEnd
+ call SkipNames
+ ld de, ManiaName
+ call CopyName2
+ ld hl, wd968
+ set 5, [hl]
+ ld a, $1
+ ld [wd173], a
+ ret
+
+.asm_743f
+ xor a
+ ld [wd173], a
+ ret
+
+ManiaName:
+ db "MANIA@"
+ShuckieName:
+ db "SHUCKIE@"
+
+Function7452:
+ callba Function50000
+ jr c, .asm_74ba
+ ld a, [wd004]
+ cp SHUCKLE
+ jr nz, .asm_74c0
+ ld a, [wd005]
+ ld hl, wPartyMon1ID
+ ld bc, $30
+ call AddNTimes
+ ld a, [hli]
+ cp $2
+ jr nz, .asm_74c0
+ ld a, [hl]
+ cp $6
+ jr nz, .asm_74c0
+ ld a, [wd005]
+ ld hl, wPartyMonOT
+ call SkipNames
+ ld de, ManiaName
+.asm_7483
+ ld a, [de]
+ cp [hl]
+ jr nz, .asm_74c0
+ cp "@"
+ jr z, .asm_748f
+ inc de
+ inc hl
+ jr .asm_7483
+
+.asm_748f
+ callba CheckCurPartyMonFainted
+ jr c, .asm_74c5
+ ld a, [wd005]
+ ld hl, wPartyMon1Happiness
+ ld bc, $30
+ call AddNTimes
+ ld a, [hl]
+ cp $96
+ ld a, $3
+ jr nc, .asm_74b6
+ xor a
+ ld [wd008], a
+ callab RemoveMonFromPartyOrBox
+ ld a, $2
+.asm_74b6
+ ld [wd173], a
+ ret
+
+.asm_74ba
+ ld a, $1
+ ld [wd173], a
+ ret
+
+.asm_74c0
+ xor a
+ ld [wd173], a
+ ret
+
+.asm_74c5
+ ld a, $4
+ ld [wd173], a
+ ret
+
+Function74cb:
+ callba Function50000
+ jr c, .asm_74e2
+ ld a, [wd004]
+ ld [wd173], a
+ ld [wd151], a
+ call GetPokemonName
+ jp Function7542
+
+.asm_74e2
+ xor a
+ ld [wd173], a
+ ret
+
+Function74e7:
+ ld hl, Data_752d
+ jr asm_74f4
+
+Function74ec:
+ ld hl, Data_7536
+ jr asm_74f4
+
+Function74f1:
+ ld hl, Data_753f
+asm_74f4
+ push hl
+ callba Function50000
+ pop hl
+ jr c, .asm_7522
+ ld a, [wCurPartySpecies]
+ cp EGG
+ jr z, .asm_7527
+ push hl
+ call GetCurNick
+ call Function7542
+ pop hl
+ call Random
+.asm_7510
+ sub [hl]
+ jr c, .asm_7518
+ inc hl
+ inc hl
+ inc hl
+ jr .asm_7510
+
+.asm_7518
+ inc hl
+ ld a, [hli]
+ ld [wd173], a
+ ld c, [hl]
+ call ChangeHappiness
+ ret
+
+.asm_7522
+ xor a
+ ld [wd173], a
+ ret
+
+.asm_7527
+ ld a, $1
+ ld [wd173], a
+ ret
+
+Data_752d:
+ db $4c, $02, $09
+ db $80, $03, $0a
+ db $ff, $04, $0b
+
+Data_7536:
+ db $9a, $02, $0c
+ db $4c, $03, $0d
+ db $ff, $04, $0e
+
+Data_753f:
+ db $ff, $02, $12
+
+Function7542: ; 7542 (1:7542)
+ ld hl, wStringBuffer1
+ ld de, wStringBuffer3
+ ld bc, PKMN_NAME_LENGTH
+ jp CopyBytes
diff --git a/main.asm b/main.asm
index ba6256a9..79f37924 100644
--- a/main.asm
+++ b/main.asm
@@ -202,14 +202,8 @@ INCLUDE "engine/math.asm"
ItemAttributes:
INCLUDE "items/item_attributes.asm"
INCLUDE "engine/npc_movement.asm"
-
-IF DEF(GOLD)
- dr $726c, $754e
-ENDC
-
-IF DEF(SILVER)
- dr $7232, $7514
-ENDC
+INCLUDE "event/happiness_egg.asm"
+INCLUDE "event/special.asm"
SECTION "bank2", ROMX, BANK[$2]
SwapTextboxPalettes::
@@ -252,7 +246,11 @@ CheckItem_::
GetTMHMNumber::
dr $d414, $d434
CheckTossableItem_::
- dr $d434, $e7a6
+ dr $d434, $e03f
+RemoveMonFromPartyOrBox:
+ dr $e03f, $e513
+CheckCurPartyMonFainted:
+ dr $e513, $e7a6
DoItemEffect_::
dr $e7a6, $fa3e
ENDC
@@ -268,7 +266,11 @@ CheckItem_::
GetTMHMNumber::
dr $d412, $d432
CheckTossableItem_::
- dr $d432, $e7a4
+ dr $d432, $e03d
+RemoveMonFromPartyOrBox:
+ dr $e03d, $e511
+CheckCurPartyMonFainted:
+ dr $e511, $e7a4
DoItemEffect_::
dr $e7a4, $fa3c
ENDC
@@ -316,7 +318,9 @@ TryLoadSaveFile: ; 14ef5
RunMapSetupScript::
dr $15484, $15612
Function15612:: ; 15612
- dr $15612, $1783e
+ dr $15612, $171d1
+Function171d1:
+ dr $171d1, $1783e
SECTION "bank6", ROMX, BANK[$6]
dr $18000, $1bdbc
@@ -402,6 +406,7 @@ SECTION "bank13", ROMX, BANK[$13]
dr $4c000, $50000
SECTION "bank14", ROMX, BANK[$14]
+Function50000:
dr $50000, $51b0b
BaseData:: ; 51b0b
dr $51b0b, $53a83