summaryrefslogtreecommitdiff
path: root/arm9
diff options
context:
space:
mode:
authorPikalaxALT <pikalaxalt@gmail.com>2020-08-27 16:21:24 -0400
committerPikalaxALT <pikalaxalt@gmail.com>2020-08-27 16:21:24 -0400
commite4ddc167504a65fabbeb77d9db6e4241b92b2a54 (patch)
tree87b2629fc0ffa1f3c4b93375cda96ef167f27675 /arm9
parent326934766a59d838c7313d2b9445ae548b1f7907 (diff)
parent186aa237dd5d843d119a3e0e1d404fe031f89dcf (diff)
Merge branch 'master' of github.com:pret/pokediamond into pikalax_work
Diffstat (limited to 'arm9')
-rw-r--r--arm9/arm9.lsf1
-rw-r--r--arm9/asm/scrcmd_18.s64
-rw-r--r--arm9/asm/script_pokemon_util.s436
-rw-r--r--arm9/global.inc2
-rw-r--r--arm9/src/scrcmd_18_c.c23
-rw-r--r--arm9/src/script_pokemon_util.c202
-rw-r--r--arm9/src/unk_02015CC0.c7
7 files changed, 232 insertions, 503 deletions
diff --git a/arm9/arm9.lsf b/arm9/arm9.lsf
index cf901bf4..f2ac2c77 100644
--- a/arm9/arm9.lsf
+++ b/arm9/arm9.lsf
@@ -168,6 +168,7 @@ Static arm9
Object scrcmd_15.o
Object scrcmd_16.o
Object scrcmd_17.o
+ Object scrcmd_18_c.o
Object scrcmd_18.o
Object scrcmd_19.o
Object scrcmd_20.o
diff --git a/arm9/asm/scrcmd_18.s b/arm9/asm/scrcmd_18.s
index 09cb74b0..4b0acb12 100644
--- a/arm9/asm/scrcmd_18.s
+++ b/arm9/asm/scrcmd_18.s
@@ -3,70 +3,6 @@
.text
- thumb_func_start ScrCmd_givemon
-ScrCmd_givemon: ; 0x020442BC
- push {r4-r7, lr}
- sub sp, #0x14
- add r4, r0, #0x0
- add r0, #0x80
- ldr r0, [r0, #0x0]
- ldr r0, [r0, #0x1c]
- ldr r0, [r0, #0x0]
- bl FUN_02034824
- add r6, r0, #0x0
- add r0, r4, #0x0
- add r0, #0x80
- ldr r5, [r0, #0x0]
- add r0, r4, #0x0
- bl ScriptReadHalfword
- add r1, r0, #0x0
- add r0, r4, #0x0
- add r0, #0x80
- ldr r0, [r0, #0x0]
- bl VarGet
- str r0, [sp, #0xc]
- add r0, r4, #0x0
- bl ScriptReadHalfword
- add r1, r0, #0x0
- add r0, r4, #0x0
- add r0, #0x80
- ldr r0, [r0, #0x0]
- bl VarGet
- add r7, r0, #0x0
- add r0, r4, #0x0
- bl ScriptReadHalfword
- add r1, r0, #0x0
- add r0, r4, #0x0
- add r0, #0x80
- ldr r0, [r0, #0x0]
- bl VarGet
- str r0, [sp, #0x10]
- add r0, r4, #0x0
- bl ScriptReadHalfword
- add r4, #0x80
- add r1, r0, #0x0
- ldr r0, [r4, #0x0]
- bl GetVarPointer
- add r4, r0, #0x0
- ldr r0, [r5, #0xc]
- bl SavArray_PlayerParty_get
- ldr r0, [sp, #0x10]
- lsl r3, r7, #0x18
- str r0, [sp, #0x0]
- str r6, [sp, #0x4]
- mov r0, #0xc
- str r0, [sp, #0x8]
- ldr r1, [r5, #0xc]
- ldr r2, [sp, #0xc]
- mov r0, #0xb
- lsr r3, r3, #0x18
- bl GiveMon
- strh r0, [r4, #0x0]
- mov r0, #0x0
- add sp, #0x14
- pop {r4-r7, pc}
- .balign 4
-
thumb_func_start ScrCmd_getpartyspecies
ScrCmd_getpartyspecies: ; 0x0204434C
; getpartyspecies XXXX, YYYY
diff --git a/arm9/asm/script_pokemon_util.s b/arm9/asm/script_pokemon_util.s
deleted file mode 100644
index 49ac1fa6..00000000
--- a/arm9/asm/script_pokemon_util.s
+++ /dev/null
@@ -1,436 +0,0 @@
- .include "asm/macros.inc"
- .include "global.inc"
-
- .text
-
- thumb_func_start MonNotFaintedOrEgg
-MonNotFaintedOrEgg: ; 0x0204A01C
- push {r4, lr}
- mov r1, #0xa2
- mov r2, #0x0
- add r4, r0, #0x0
- bl GetMonData
- cmp r0, #0x0
- bne _0204A030
- mov r0, #0x0
- pop {r4, pc}
-_0204A030:
- add r0, r4, #0x0
- mov r1, #0x4c
- mov r2, #0x0
- bl GetMonData
- cmp r0, #0x0
- bne _0204A042
- mov r0, #0x1
- pop {r4, pc}
-_0204A042:
- mov r0, #0x0
- pop {r4, pc}
- .balign 4
-
- thumb_func_start GiveMon
-GiveMon: ; 0x0204A048
- push {r3-r7, lr}
- sub sp, #0x20
- add r6, r1, #0x0
- add r5, r0, #0x0
- add r0, r6, #0x0
- add r7, r2, #0x0
- str r3, [sp, #0x10]
- bl Sav2_PlayerData_GetProfileAddr
- str r0, [sp, #0x14]
- add r0, r6, #0x0
- bl SavArray_PlayerParty_get
- str r0, [sp, #0x18]
- add r0, r5, #0x0
- bl AllocMonZeroed
- add r4, r0, #0x0
- bl ZeroMonData
- mov r0, #0x0
- str r0, [sp, #0x0]
- str r0, [sp, #0x4]
- str r0, [sp, #0x8]
- str r0, [sp, #0xc]
- ldr r2, [sp, #0x10]
- add r0, r4, #0x0
- add r1, r7, #0x0
- mov r3, #0x20
- bl CreateMon
- ldr r0, [sp, #0x40]
- ldr r1, [sp, #0x14]
- str r0, [sp, #0x0]
- ldr r3, [sp, #0x3c]
- add r0, r4, #0x0
- mov r2, #0x4
- str r5, [sp, #0x4]
- bl FUN_0206A014
- add r0, sp, #0x28
- ldrh r0, [r0, #0x10]
- mov r1, #0x6
- add r2, sp, #0x1c
- str r0, [sp, #0x1c]
- add r0, r4, #0x0
- bl SetMonData
- ldr r0, [sp, #0x18]
- add r1, r4, #0x0
- bl AddMonToParty
- add r5, r0, #0x0
- beq _0204A0BC
- add r0, r6, #0x0
- add r1, r4, #0x0
- bl FUN_0202C144
-_0204A0BC:
- add r0, r4, #0x0
- bl FreeToHeap
- add r0, r5, #0x0
- add sp, #0x20
- pop {r3-r7, pc}
-
- thumb_func_start GiveEgg
-GiveEgg: ; 0x0204A0C8
- push {r4-r7, lr}
- sub sp, #0xc
- add r4, r1, #0x0
- add r0, r4, #0x0
- add r5, r2, #0x0
- add r7, r3, #0x0
- bl Sav2_PlayerData_GetProfileAddr
- str r0, [sp, #0x8]
- add r0, r4, #0x0
- bl SavArray_PlayerParty_get
- add r6, r0, #0x0
- mov r0, #0x20
- bl AllocMonZeroed
- add r4, r0, #0x0
- bl ZeroMonData
- ldr r0, [sp, #0x20]
- ldr r1, [sp, #0x24]
- bl FUN_02015CF8
- mov r1, #0x4
- str r1, [sp, #0x0]
- str r0, [sp, #0x4]
- ldr r3, [sp, #0x8]
- add r0, r4, #0x0
- add r1, r5, #0x0
- add r2, r7, #0x0
- bl MOD05_SetEggStats
- add r0, r6, #0x0
- add r1, r4, #0x0
- bl AddMonToParty
- add r5, r0, #0x0
- add r0, r4, #0x0
- bl FreeToHeap
- add r0, r5, #0x0
- add sp, #0xc
- pop {r4-r7, pc}
- .balign 4
-
- thumb_func_start PartyMonSetMoveInSlot
-PartyMonSetMoveInSlot: ; 0x0204A120
- push {r3-r5, lr}
- add r5, r2, #0x0
- add r4, r3, #0x0
- bl GetPartyMonByIndex
- lsl r2, r5, #0x18
- add r1, r4, #0x0
- lsr r2, r2, #0x18
- bl MonSetMoveInSlot
- pop {r3-r5, pc}
- .balign 4
-
- thumb_func_start GetIdxOfFirstPartyMonWithMove
-GetIdxOfFirstPartyMonWithMove: ; 0x0204A138
- push {r3-r7, lr}
- str r0, [sp, #0x0]
- add r5, r1, #0x0
- bl GetPartyCount
- add r7, r0, #0x0
- mov r6, #0x0
- cmp r7, #0x0
- ble _0204A1A2
-_0204A14A:
- ldr r0, [sp, #0x0]
- add r1, r6, #0x0
- bl GetPartyMonByIndex
- mov r1, #0x4c
- mov r2, #0x0
- add r4, r0, #0x0
- bl GetMonData
- cmp r0, #0x0
- bne _0204A19C
- add r0, r4, #0x0
- mov r1, #0x36
- mov r2, #0x0
- bl GetMonData
- cmp r5, r0
- beq _0204A198
- add r0, r4, #0x0
- mov r1, #0x37
- mov r2, #0x0
- bl GetMonData
- cmp r5, r0
- beq _0204A198
- add r0, r4, #0x0
- mov r1, #0x38
- mov r2, #0x0
- bl GetMonData
- cmp r5, r0
- beq _0204A198
- add r0, r4, #0x0
- mov r1, #0x39
- mov r2, #0x0
- bl GetMonData
- cmp r5, r0
- bne _0204A19C
-_0204A198:
- add r0, r6, #0x0
- pop {r3-r7, pc}
-_0204A19C:
- add r6, r6, #0x1
- cmp r6, r7
- blt _0204A14A
-_0204A1A2:
- mov r0, #0xff
- pop {r3-r7, pc}
- .balign 4
-
- thumb_func_start CountAlivePokemon
-CountAlivePokemon: ; 0x0204A1A8
- push {r3-r7, lr}
- add r7, r0, #0x0
- bl GetPartyCount
- mov r5, #0x0
- add r6, r0, #0x0
- add r4, r5, #0x0
- cmp r6, #0x0
- ble _0204A1D2
-_0204A1BA:
- add r0, r7, #0x0
- add r1, r4, #0x0
- bl GetPartyMonByIndex
- bl MonNotFaintedOrEgg
- cmp r0, #0x0
- beq _0204A1CC
- add r5, r5, #0x1
-_0204A1CC:
- add r4, r4, #0x1
- cmp r4, r6
- blt _0204A1BA
-_0204A1D2:
- add r0, r5, #0x0
- pop {r3-r7, pc}
- .balign 4
-
- thumb_func_start GetFirstAliveMonInParty_CrashIfNone
-GetFirstAliveMonInParty_CrashIfNone: ; 0x0204A1D8
- push {r3-r7, lr}
- add r6, r0, #0x0
- bl GetPartyCount
- add r5, r0, #0x0
- mov r4, #0x0
- cmp r5, #0x0
- ble _0204A204
-_0204A1E8:
- add r0, r6, #0x0
- add r1, r4, #0x0
- bl GetPartyMonByIndex
- add r7, r0, #0x0
- bl MonNotFaintedOrEgg
- cmp r0, #0x0
- beq _0204A1FE
- add r0, r7, #0x0
- pop {r3-r7, pc}
-_0204A1FE:
- add r4, r4, #0x1
- cmp r4, r5
- blt _0204A1E8
-_0204A204:
- bl ErrorHandling
- mov r0, #0x0
- pop {r3-r7, pc}
-
- thumb_func_start GetFirstNonEggInParty
-GetFirstNonEggInParty: ; 0x0204A20C
- push {r3-r7, lr}
- add r6, r0, #0x0
- bl GetPartyCount
- lsl r0, r0, #0x10
- lsr r5, r0, #0x10
- ldr r4, _0204A244 ; =0x00000000
- beq _0204A240
-_0204A21C:
- add r0, r6, #0x0
- add r1, r4, #0x0
- bl GetPartyMonByIndex
- mov r1, #0x4c
- mov r2, #0x0
- add r7, r0, #0x0
- bl GetMonData
- cmp r0, #0x0
- bne _0204A236
- add r0, r7, #0x0
- pop {r3-r7, pc}
-_0204A236:
- add r0, r4, #0x1
- lsl r0, r0, #0x10
- lsr r4, r0, #0x10
- cmp r4, r5
- blo _0204A21C
-_0204A240:
- mov r0, #0x0
- pop {r3-r7, pc}
- .balign 4
-_0204A244: .word 0x00000000
-
- thumb_func_start HasEnoughAlivePokemonForDoubleBattle
-HasEnoughAlivePokemonForDoubleBattle: ; 0x0204A248
- push {r3, lr}
- bl CountAlivePokemon
- cmp r0, #0x2
- blt _0204A256
- mov r0, #0x1
- pop {r3, pc}
-_0204A256:
- mov r0, #0x0
- pop {r3, pc}
- .balign 4
-
- thumb_func_start GiveAllMonsTheSinnohChampRibbon
-GiveAllMonsTheSinnohChampRibbon: ; 0x0204A25C
- push {r3-r7, lr}
- mov r2, #0x1
- add r1, sp, #0x0
- add r7, r0, #0x0
- strb r2, [r1, #0x0]
- bl GetPartyCount
- add r6, r0, #0x0
- mov r5, #0x0
- cmp r6, #0x0
- ble _0204A298
-_0204A272:
- add r0, r7, #0x0
- add r1, r5, #0x0
- bl GetPartyMonByIndex
- mov r1, #0x4c
- mov r2, #0x0
- add r4, r0, #0x0
- bl GetMonData
- cmp r0, #0x0
- bne _0204A292
- add r0, r4, #0x0
- mov r1, #0x19
- add r2, sp, #0x0
- bl SetMonData
-_0204A292:
- add r5, r5, #0x1
- cmp r5, r6
- blt _0204A272
-_0204A298:
- pop {r3-r7, pc}
- .balign 4
-
- thumb_func_start ApplyPoisonStep
-ApplyPoisonStep: ; 0x0204A29C
- push {r3-r7, lr}
- sub sp, #0x10
- mov r7, #0x0
- str r0, [sp, #0x0]
- str r1, [sp, #0x4]
- add r6, r7, #0x0
- bl GetPartyCount
- add r4, r7, #0x0
- str r0, [sp, #0x8]
- cmp r0, #0x0
- ble _0204A310
-_0204A2B4:
- ldr r0, [sp, #0x0]
- add r1, r4, #0x0
- bl GetPartyMonByIndex
- add r5, r0, #0x0
- bl MonNotFaintedOrEgg
- cmp r0, #0x0
- beq _0204A308
- add r0, r5, #0x0
- mov r1, #0x9f
- mov r2, #0x0
- bl GetMonData
- mov r1, #0x88
- tst r0, r1
- beq _0204A308
- add r0, r5, #0x0
- mov r1, #0xa2
- mov r2, #0x0
- bl GetMonData
- str r0, [sp, #0xc]
- cmp r0, #0x1
- bls _0204A2EA
- sub r0, r0, #0x1
- str r0, [sp, #0xc]
-_0204A2EA:
- add r0, r5, #0x0
- mov r1, #0xa2
- add r2, sp, #0xc
- bl SetMonData
- ldr r0, [sp, #0xc]
- cmp r0, #0x1
- bne _0204A306
- ldr r2, [sp, #0x4]
- add r0, r5, #0x0
- mov r1, #0x7
- add r6, r6, #0x1
- bl MonApplyFriendshipMod
-_0204A306:
- add r7, r7, #0x1
-_0204A308:
- ldr r0, [sp, #0x8]
- add r4, r4, #0x1
- cmp r4, r0
- blt _0204A2B4
-_0204A310:
- cmp r6, #0x0
- beq _0204A31A
- add sp, #0x10
- mov r0, #0x2
- pop {r3-r7, pc}
-_0204A31A:
- cmp r7, #0x0
- beq _0204A324
- add sp, #0x10
- mov r0, #0x1
- pop {r3-r7, pc}
-_0204A324:
- mov r0, #0x0
- add sp, #0x10
- pop {r3-r7, pc}
- .balign 4
-
- thumb_func_start SurvivePoisoning
-SurvivePoisoning: ; 0x0204A32C
- push {r3-r4, lr}
- sub sp, #0x4
- mov r1, #0x9f
- mov r2, #0x0
- add r4, r0, #0x0
- bl GetMonData
- mov r1, #0x88
- tst r0, r1
- beq _0204A362
- add r0, r4, #0x0
- mov r1, #0xa2
- mov r2, #0x0
- bl GetMonData
- cmp r0, #0x1
- bne _0204A362
- mov r0, #0x0
- str r0, [sp, #0x0]
- add r0, r4, #0x0
- mov r1, #0x9f
- add r2, sp, #0x0
- bl SetMonData
- add sp, #0x4
- mov r0, #0x1
- pop {r3-r4, pc}
-_0204A362:
- mov r0, #0x0
- add sp, #0x4
- pop {r3-r4, pc}
diff --git a/arm9/global.inc b/arm9/global.inc
index 80972f5a..65ecb0e3 100644
--- a/arm9/global.inc
+++ b/arm9/global.inc
@@ -8482,3 +8482,5 @@
.extern gSineTable
.extern CARDi_IdentifyBackupCore
.extern CARDi_InitCommon
+.extern MonNotFaintedOrEgg
+.extern CountAlivePokemon
diff --git a/arm9/src/scrcmd_18_c.c b/arm9/src/scrcmd_18_c.c
new file mode 100644
index 00000000..d2753587
--- /dev/null
+++ b/arm9/src/scrcmd_18_c.c
@@ -0,0 +1,23 @@
+#include "global.h"
+#include "script.h"
+#include "party.h"
+#include "save_block_2.h"
+#include "unk_0204639C.h"
+#include "map_header.h"
+
+extern u16 VarGet(struct UnkStruct_0204639C* arg, u16 wk);
+extern u16 *GetVarPointer(struct UnkStruct_0204639C* arg, u16);
+extern BOOL GiveMon(u32 heap_id, struct SaveBlock2 * sav2, u16 species, u8 level, u16 item, u32 mapSec, u8 encounterType);
+
+THUMB_FUNC BOOL ScrCmd_givemon(struct ScriptContext* ctx)
+{
+ u32 mapSec = FUN_02034824(*(ctx->unk80->unk1C));
+ struct UnkStruct_0204639C *savePtr = ctx->unk80;
+ u16 species = VarGet(ctx->unk80, ScriptReadHalfword(ctx));
+ u16 level = VarGet(ctx->unk80, ScriptReadHalfword(ctx));
+ u16 item = VarGet(ctx->unk80, ScriptReadHalfword(ctx));
+ u16 * varPtr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx));
+ struct PlayerParty * party = SavArray_PlayerParty_get((struct SaveBlock2 *) savePtr->unkC);
+ *varPtr = GiveMon(11, (struct SaveBlock2 *) savePtr->unkC, species, level, item, mapSec, 12);
+ return FALSE;
+}
diff --git a/arm9/src/script_pokemon_util.c b/arm9/src/script_pokemon_util.c
new file mode 100644
index 00000000..fccdb15e
--- /dev/null
+++ b/arm9/src/script_pokemon_util.c
@@ -0,0 +1,202 @@
+#include "global.h"
+#include "heap.h"
+#include "party.h"
+#include "player_data.h"
+#include "pokemon.h"
+#include "save_block_2.h"
+#include "unk_02015CC0.h"
+#include "unk_0202C144.h"
+#include "module_05.h"
+#include "constants/items.h"
+#include "constants/script_pokemon_util.h"
+
+#pragma thumb on
+
+BOOL MonNotFaintedOrEgg(struct Pokemon * pokemon)
+{
+ if (GetMonData(pokemon, MON_DATA_HP, NULL) == 0)
+ return FALSE;
+ if (GetMonData(pokemon, MON_DATA_IS_EGG, NULL))
+ return FALSE;
+ return TRUE;
+}
+
+BOOL GiveMon(u32 heap_id, struct SaveBlock2 * sav2, u16 species, u8 level, u16 item, u32 mapSec, u32 encounterType)
+{
+ u32 ptr;
+ struct PlayerData * data = Sav2_PlayerData_GetProfileAddr(sav2);
+ struct PlayerParty * party = SavArray_PlayerParty_get(sav2);
+ struct Pokemon * mon = AllocMonZeroed(heap_id);
+ ZeroMonData(mon);
+ CreateMon(mon, species, level, 32, 0, 0, OT_ID_PLAYER_ID, 0);
+ FUN_0206A014(mon, data, ITEM_POKE_BALL, mapSec, encounterType, heap_id);
+ ptr = item;
+ SetMonData(mon, MON_DATA_HELD_ITEM, &ptr);
+ BOOL isAdded = AddMonToParty(party, mon);
+ if (isAdded)
+ {
+ FUN_0202C144(sav2, mon);
+ }
+ FreeToHeap(mon);
+ return isAdded;
+}
+
+/* Seems to have something to do with Manaphy Egg*/
+BOOL GiveEgg(u32 heapId, struct SaveBlock2 * sav2, u16 species, int level, int metLocIndex, int a3)
+{
+ struct PlayerData * data = Sav2_PlayerData_GetProfileAddr(sav2);
+ struct PlayerParty * party = SavArray_PlayerParty_get(sav2);
+ struct Pokemon * mon = AllocMonZeroed(32);
+ ZeroMonData(mon);
+ MOD05_SetEggStats(mon, species, level, data, 4, FUN_02015CF8(metLocIndex, a3));
+ BOOL isAdded = AddMonToParty(party, mon);
+ FreeToHeap(mon);
+ return isAdded;
+}
+
+void PartyMonSetMoveInSlot(struct PlayerParty * party, int partySlot, int moveSlot, u16 move)
+{
+ struct Pokemon * mon = GetPartyMonByIndex(party, partySlot);
+ MonSetMoveInSlot(mon, move, moveSlot);
+}
+
+int GetIdxOfFirstPartyMonWithMove(struct PlayerParty * party, int move)
+{
+ int partyCount = GetPartyCount(party);
+
+ for (int i = 0; i < partyCount; i++)
+ {
+ struct Pokemon * mon = GetPartyMonByIndex(party, i);
+
+ if (GetMonData(mon, MON_DATA_IS_EGG, NULL))
+ continue;
+ if (GetMonData(mon, MON_DATA_MOVE1, NULL) == move
+ || GetMonData(mon, MON_DATA_MOVE2, NULL) == move
+ || GetMonData(mon, MON_DATA_MOVE3, NULL) == move
+ || GetMonData(mon, MON_DATA_MOVE4, NULL) == move)
+ return i;
+ }
+ return 0xFF;
+}
+
+int CountAlivePokemon(struct PlayerParty * party)
+{
+ int partyCount = GetPartyCount(party);
+ int i;
+ int aliveCount = 0;
+
+ for (i = 0; i < partyCount; i++)
+ {
+ struct Pokemon * mon = GetPartyMonByIndex(party, i);
+
+ if(MonNotFaintedOrEgg(mon))
+ aliveCount++;
+ }
+ return aliveCount;
+}
+
+struct Pokemon * GetFirstAliveMonInParty_CrashIfNone(struct PlayerParty * party)
+{
+ int i;
+ int partyCount = GetPartyCount(party);
+
+ for (i = 0; i < partyCount; i++)
+ {
+ struct Pokemon * mon = GetPartyMonByIndex(party, i);
+
+ if(MonNotFaintedOrEgg(mon))
+ return mon;
+ }
+ ErrorHandling();
+ return 0;
+}
+
+struct Pokemon * GetFirstNonEggInParty(struct PlayerParty * party)
+{
+ u16 i;
+ u16 partyCount = GetPartyCount(party);
+
+ for (i = 0; i < partyCount; i++)
+ {
+ struct Pokemon * mon = GetPartyMonByIndex(party, i);
+
+ if (!GetMonData(mon, MON_DATA_IS_EGG, NULL))
+ return mon;
+ }
+ return 0;
+}
+
+BOOL HasEnoughAlivePokemonForDoubleBattle(struct PlayerParty * party)
+{
+ return (CountAlivePokemon(party) >= 2);
+}
+
+void GiveAllMonsTheSinnohChampRibbon(struct PlayerParty * party)
+{
+ u8 var = 1;
+ int partyCount = GetPartyCount(party);
+
+
+ for (int i = 0; i < partyCount; i++)
+ {
+ struct Pokemon * mon = GetPartyMonByIndex(party, i);
+
+ if (GetMonData(mon, MON_DATA_IS_EGG, NULL))
+ continue;
+
+ SetMonData(mon, MON_DATA_SINNOH_CHAMP_RIBBON, &var);
+ }
+}
+
+int ApplyPoisonStep(struct PlayerParty * party, int location)
+{
+ u32 hp;
+ int numPoisoned = 0;
+ int numHealed = 0;
+ int partyCount = GetPartyCount(party);
+
+ for (int i = 0; i < partyCount; i++)
+ {
+ struct Pokemon * mon = GetPartyMonByIndex(party, i);
+
+ if(!MonNotFaintedOrEgg(mon))
+ continue;
+
+ if (!(GetMonData(mon, MON_DATA_STATUS, NULL) & 0x88))
+ continue;
+
+ hp = GetMonData(mon, MON_DATA_HP, NULL);
+ if (hp > 1)
+ hp--;
+ SetMonData(mon, MON_DATA_HP, &hp);
+ if (hp == 1)
+ {
+ numHealed++;
+ MonApplyFriendshipMod(mon, FRIENDSHIP_EVENT_HEAL_FIELD_PSN, location);
+ }
+ numPoisoned++;
+ }
+
+ if (numHealed != 0)
+ return FLDPSN_HEAL;
+
+ if (numPoisoned != 0)
+ return FLDPSN_PSN;
+
+ return FLDPSN_NONE;
+}
+
+BOOL SurvivePoisoning(struct Pokemon * mon)
+{
+ int status;
+ if (GetMonData(mon, MON_DATA_STATUS, NULL) & 0x88)
+ {
+ if (GetMonData(mon, MON_DATA_HP, NULL) == 1)
+ {
+ status = 0;
+ SetMonData(mon, MON_DATA_STATUS, &status);
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
diff --git a/arm9/src/unk_02015CC0.c b/arm9/src/unk_02015CC0.c
index 5da221d0..d068fd12 100644
--- a/arm9/src/unk_02015CC0.c
+++ b/arm9/src/unk_02015CC0.c
@@ -1,12 +1,13 @@
#include "global.h"
#include "unk_02015CC0.h"
+#include "constants/map_sections.h"
#pragma thumb on
const u16 UNK_020ED72C[] = {
- 0,
- 2000,
- 3000
+ 0,
+ METLOC_DAY_CARE_COUPLE,
+ METLOC_LOVELY_PLACE
};
int FUN_02015CC0(u16 a0)