Mon creation in custom multi battles
This commit is contained in:
parent
539b05ff73
commit
d52016bc31
5 changed files with 67 additions and 11 deletions
|
@ -47,6 +47,8 @@ EverGrandeCity_PokemonLeague_1F_Pokemart_229624: @ 8229624
|
|||
end
|
||||
|
||||
EverGrandeCity_PokemonLeague_1F_EventScript_229636:: @ 8229636
|
||||
trainerbattle 10, 406, 0, NULL, EverGrandeCity_PokemonLeague_1F_Text_2297EF, NULL
|
||||
trainerbattle 11, 402, 0, NULL, EverGrandeCity_PokemonLeague_1F_Text_2297EF, NULL
|
||||
setvar VAR_0x8004, 11
|
||||
setvar VAR_0x8006, 404
|
||||
setvar VAR_0x8007, 3
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
|
||||
#define USE_BATTLE_DEBUG TRUE
|
||||
|
||||
extern void CB2_BattleDebugMenu(void);
|
||||
void CB2_BattleDebugMenu(void);
|
||||
|
||||
#endif // GUARD_BATTLE_DEBUG_H
|
||||
|
|
|
@ -2524,5 +2524,5 @@ static void BattleAICmd_if_doesnt_hold_berry(void)
|
|||
if (ItemId_GetPocket(item) == POCKET_BERRIES)
|
||||
gAIScriptPtr += 6;
|
||||
else
|
||||
T1_READ_PTR(gAIScriptPtr + 2);
|
||||
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 2);
|
||||
}
|
||||
|
|
|
@ -1143,10 +1143,10 @@ const u8 *BattleSetup_ConfigureTrainerBattle(const u8 *data)
|
|||
return EventScript_271362;
|
||||
case TRAINER_BATTLE_SET_TRAINER_A:
|
||||
TrainerBattleLoadArgs(sOrdinaryBattleParams, data);
|
||||
return NULL;
|
||||
return sTrainerBattleEndScript;
|
||||
case TRAINER_BATTLE_SET_TRAINER_B:
|
||||
TrainerBattleLoadArgs(sTrainerBOrdinaryBattleParams, data);
|
||||
return NULL;
|
||||
return sTrainerBattleEndScript;
|
||||
case TRAINER_BATTLE_12:
|
||||
if (gApproachingTrainerId == 0)
|
||||
{
|
||||
|
|
|
@ -1476,10 +1476,6 @@ void DoSpecialTrainerBattle(void)
|
|||
gBattleTypeFlags = BATTLE_TYPE_TRAINER | BATTLE_TYPE_DOUBLE | BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_MULTI | BATTLE_TYPE_INGAME_PARTNER;
|
||||
gPartnerSpriteId = gSpecialVar_0x8007;
|
||||
FillPartnerParty(gSpecialVar_0x8006 + TRAINER_CUSTOM_PARTNER);
|
||||
gApproachingTrainerId = 0;
|
||||
BattleSetup_ConfigureTrainerBattle(MossdeepCity_SpaceCenter_2F_EventScript_224157 + 1);
|
||||
gApproachingTrainerId = 1;
|
||||
BattleSetup_ConfigureTrainerBattle(MossdeepCity_SpaceCenter_2F_EventScript_224166 + 1);
|
||||
gPartnerTrainerId = gSpecialVar_0x8006 + TRAINER_CUSTOM_PARTNER;
|
||||
CreateTask(Task_StartBattleAfterTransition, 1);
|
||||
PlayMapChosenOrBattleBGM(0);
|
||||
|
@ -2302,7 +2298,7 @@ static void FillPartnerParty(u16 trainerId)
|
|||
u32 friendship;
|
||||
u16 monSetId;
|
||||
u32 otID;
|
||||
u8 trainerName[PLAYER_NAME_LENGTH + 1];
|
||||
u8 trainerName[(PLAYER_NAME_LENGTH * 3) + 1];
|
||||
SetFacilityPtrsGetLevel();
|
||||
|
||||
if (trainerId == TRAINER_STEVEN_PARTNER)
|
||||
|
@ -2331,10 +2327,68 @@ static void FillPartnerParty(u16 trainerId)
|
|||
}
|
||||
else if (trainerId >= TRAINER_CUSTOM_PARTNER)
|
||||
{
|
||||
otID = Random32();
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
ZeroMonData(&gPlayerParty[i + 3]);
|
||||
|
||||
for (i = 0; i < 3 && i < gTrainers[trainerId - TRAINER_CUSTOM_PARTNER].partySize; i++)
|
||||
{
|
||||
// Temporary.
|
||||
CreateMon(&gPlayerParty[3 + i], Random() % NUM_SPECIES, Random() % MAX_LEVEL, Random() % 31, 0, 0, 0, 0);
|
||||
do
|
||||
{
|
||||
j = Random32();
|
||||
} while (IsShinyOtIdPersonality(otID, j));
|
||||
|
||||
switch (gTrainers[trainerId - TRAINER_CUSTOM_PARTNER].partyFlags)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
const struct TrainerMonNoItemDefaultMoves *partyData = gTrainers[trainerId - TRAINER_CUSTOM_PARTNER].party.NoItemDefaultMoves;
|
||||
|
||||
CreateMon(&gPlayerParty[i + 3], partyData[i].species, partyData[i].lvl, partyData[i].iv * 31 / 255, TRUE, j, TRUE, otID);
|
||||
break;
|
||||
}
|
||||
case F_TRAINER_PARTY_CUSTOM_MOVESET:
|
||||
{
|
||||
const struct TrainerMonNoItemCustomMoves *partyData = gTrainers[trainerId - TRAINER_CUSTOM_PARTNER].party.NoItemCustomMoves;
|
||||
|
||||
CreateMon(&gPlayerParty[i + 3], partyData[i].species, partyData[i].lvl, partyData[i].iv * 31 / 255, TRUE, j, TRUE, otID);
|
||||
|
||||
for (j = 0; j < 4; j++)
|
||||
{
|
||||
SetMonData(&gPlayerParty[i + 3], MON_DATA_MOVE1 + j, &partyData[i].moves[j]);
|
||||
SetMonData(&gPlayerParty[i + 3], MON_DATA_PP1 + j, &gBattleMoves[partyData[i].moves[j]].pp);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case F_TRAINER_PARTY_HELD_ITEM:
|
||||
{
|
||||
const struct TrainerMonItemDefaultMoves *partyData = gTrainers[trainerId - TRAINER_CUSTOM_PARTNER].party.ItemDefaultMoves;
|
||||
|
||||
CreateMon(&gPlayerParty[i + 3], partyData[i].species, partyData[i].lvl, partyData[i].iv * 31 / 255, TRUE, j, TRUE, otID);
|
||||
|
||||
SetMonData(&gPlayerParty[i + 3], MON_DATA_HELD_ITEM, &partyData[i].heldItem);
|
||||
break;
|
||||
}
|
||||
case F_TRAINER_PARTY_CUSTOM_MOVESET | F_TRAINER_PARTY_HELD_ITEM:
|
||||
{
|
||||
const struct TrainerMonItemCustomMoves *partyData = gTrainers[trainerId - TRAINER_CUSTOM_PARTNER].party.ItemCustomMoves;
|
||||
|
||||
CreateMon(&gPlayerParty[i + 3], partyData[i].species, partyData[i].lvl, partyData[i].iv * 31 / 255, TRUE, j, TRUE, otID);
|
||||
|
||||
SetMonData(&gPlayerParty[i + 3], MON_DATA_HELD_ITEM, &partyData[i].heldItem);
|
||||
|
||||
for (j = 0; j < 4; j++)
|
||||
{
|
||||
SetMonData(&gPlayerParty[i + 3], MON_DATA_MOVE1 + j, &partyData[i].moves[j]);
|
||||
SetMonData(&gPlayerParty[i + 3], MON_DATA_PP1 + j, &gBattleMoves[partyData[i].moves[j]].pp);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
StringCopy(trainerName, gTrainers[trainerId - TRAINER_CUSTOM_PARTNER].trainerName);
|
||||
SetMonData(&gPlayerParty[i + 3], MON_DATA_OT_NAME, trainerName);
|
||||
}
|
||||
}
|
||||
else if (trainerId == TRAINER_EREADER)
|
||||
|
|
Loading…
Reference in a new issue