No message if all mons were out

voloved 2023-02-17 16:43:33 -05:00
parent 64f9faefcf
commit d23766ac9d
1 changed files with 39 additions and 9 deletions

@ -29,7 +29,12 @@ index f73cae167..45995acdb 100644
for (viaSentIn = 0, i = 0; i < PARTY_SIZE; i++)
{
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) == SPECIES_NONE || GetMonData(&gPlayerParty[i], MON_DATA_HP) == 0)
- if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) == SPECIES_NONE || GetMonData(&gPlayerParty[i], MON_DATA_HP) == 0)
+ if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) == SPECIES_NONE || GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG)
+ || GetMonData(&gPlayerParty[i], MON_DATA_HP) == 0)
continue;
if (gBitTable[i] & sentIn)
viaSentIn++;
@@ -3299,11 +3299,8 @@ static void Cmd_getexp(void)
if (item == ITEM_ENIGMA_BERRY)
holdEffect = gSaveBlock1Ptr->enigmaBerry.holdEffect;
@ -94,7 +99,16 @@ index f73cae167..45995acdb 100644
gBattleScripting.getexpState = 5;
gBattleMoveDamage = 0; // used for exp
}
+ else if (GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_SPECIES) == SPECIES_NONE
+ || GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_IS_EGG))
+ {
+ gBattleScripting.getexpState = 5;
+ gBattleMoveDamage = 0; // used for exp
+ }
else
{
// music change in wild battle after fainting a poke
if (!(gBattleTypeFlags & BATTLE_TYPE_TRAINER) && gBattleMons[0].hp && !gBattleStruct->wildVictorySong)
@@ -3383,17 +3368,17 @@ static void Cmd_getexp(void)
}
@ -137,15 +151,31 @@ index f73cae167..45995acdb 100644
gBattleStruct->expGetterMonId++;
if (gBattleStruct->expGetterMonId < PARTY_SIZE)
gBattleScripting.getexpState = 2; // loop again
+ else if (!gExpShareCheck && FlagGet(FLAG_EXP_SHARE)){
+ gExpShareCheck = TRUE;
+ gBattleStruct->expGetterMonId = 0;
+ PREPARE_WORD_NUMBER_BUFFER(gBattleTextBuff3, 5, gExpShareExp);
+ PrepareStringBattle(STRINGID_PKMNGAINEDEXPALL, gBattleStruct->expGetterBattlerId);
+ gBattleScripting.getexpState = 2; // loop again
- else
- gBattleScripting.getexpState = 6; // we're done
+ else{
+ s32 totalMon = 0;
+ s32 viaSentIn = 0;
+ sentIn = gSentPokesToOpponent[(gBattlerFainted & 2) >> 1];
+ for (viaSentIn = 0, i = 0; i < PARTY_SIZE; i++) // To see if every mon has seen battle
+ {
+ if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) == SPECIES_NONE || GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG)
+ || GetMonData(&gPlayerParty[i], MON_DATA_HP) == 0)
+ continue;
+ totalMon++;
+ if (gBitTable[i] & sentIn)
+ viaSentIn++;
+ }
+ if (!gExpShareCheck && FlagGet(FLAG_EXP_SHARE) && totalMon>viaSentIn){
+ gExpShareCheck = TRUE;
+ gBattleStruct->expGetterMonId = 0;
+ PREPARE_WORD_NUMBER_BUFFER(gBattleTextBuff3, 5, gExpShareExp);
+ PrepareStringBattle(STRINGID_PKMNGAINEDEXPALL, gBattleStruct->expGetterBattlerId);
+ gBattleScripting.getexpState = 2; // loop again
+ }
+ else
+ gBattleScripting.getexpState = 6; // we're done
+ }
else
gBattleScripting.getexpState = 6; // we're done
}
break;
```