Experience on caught mon

This commit is contained in:
DizzyEggg 2018-08-03 18:01:14 +02:00
parent 28b4d0d9dc
commit 39f9b1ddf0
6 changed files with 16 additions and 1 deletions

View file

@ -2,6 +2,7 @@
#include "constants/battle_script_commands.h"
#include "constants/battle_anim.h"
#include "constants/battle_string_ids.h"
#include "constants/battle_config.h"
#include "constants/items.h"
#include "constants/songs.h"
.include "asm/macros.inc"
@ -61,10 +62,16 @@ BattleScript_SafariBallThrow::
handleballthrow
BattleScript_SuccessBallThrow::
setbyte sMON_CAUGHT, TRUE
jumpifhalfword CMP_EQUAL, gLastUsedItem, ITEM_SAFARI_BALL, BattleScript_PrintCaughtMonInfo
incrementgamestat 0xB
BattleScript_PrintCaughtMonInfo::
printstring STRINGID_GOTCHAPKMNCAUGHT
jumpifbyte CMP_NOT_EQUAL, sEXP_CATCH, TRUE, BattleScript_TryPrintCaughtMonInfo
setbyte sGIVEEXP_STATE, 0x0
getexp BS_TARGET
sethword gBattle_BG2_X, 0x0
BattleScript_TryPrintCaughtMonInfo:
trysetcaughtmondexflags BattleScript_TryNicknameCaughtMon
printstring STRINGID_PKMNDATAADDEDTODEX
waitstate

View file

@ -635,7 +635,7 @@ struct BattleScripting
s32 painSplitHp;
s32 bideDmg;
u8 multihitString[6];
u8 unused_E;
bool8 expOnCatch;
u8 twoTurnsMoveStringId;
u8 animArg1;
u8 animArg2;
@ -658,6 +658,7 @@ struct BattleScripting
u8 field_23;
u8 windowsType; // 0 - normal, 1 - battle arena
u8 multiplayerId;
bool8 monCaught;
};
// rom_80A5C6C

View file

@ -12,5 +12,6 @@
#define B_ABILITY_WEATHER GEN_6 // Up to gen5 - weather induced by abilities such as Drought or Drizzle lasted till the battle's end or weather change by a move. From Gen6 onwards, weather caused by abilities lasts the same amount of turns as induced from a move.
#define B_GALE_WINGS GEN_6 // Gen7 requires full hp.
#define B_SOUND_SUBSTITUTE GEN_6 // Starting from gen6 sound moves bypass Substitute.
#define B_EXP_CATCH GEN_6 // Starting from gen6, pokemon get experience from catching.
#endif // GUARD_CONSTANTS_BATTLE_CONFIG_H

View file

@ -5,6 +5,7 @@
#define sPAINSPLIT_HP gBattleScripting
#define sBIDE_DMG gBattleScripting + 4
#define sMULTIHIT_STRING gBattleScripting + 8
#define sEXP_CATCH gBattleScripting + 0xE
#define sTWOTURN_STRINGID gBattleScripting + 0xF
#define sB_ANIM_ARG1 gBattleScripting + 0x10
#define sB_ANIM_ARG2 gBattleScripting + 0x11
@ -27,6 +28,7 @@
#define sFIELD_23 gBattleScripting + 0x23
#define sFIELD_24 gBattleScripting + 0x24
#define sMULTIPLAYER_ID gBattleScripting + 0x25
#define sMON_CAUGHT gBattleScripting + 0x26
#define cEFFECT_CHOOSER gBattleCommunication + 3
#define cMULTISTRING_CHOOSER gBattleCommunication + 5

View file

@ -3036,6 +3036,8 @@ static void BattleStartClearSetData(void)
gHitMarker |= HITMARKER_NO_ANIMATIONS;
gBattleScripting.battleStyle = gSaveBlock2Ptr->optionsBattleStyle;
gBattleScripting.expOnCatch = (B_EXP_CATCH >= GEN_6);
gBattleScripting.monCaught = FALSE;
gMultiHitCounter = 0;
gBattleOutcome = 0;

View file

@ -233,6 +233,8 @@ static void CreateBattlerSprite(u8 battler)
{
if (GetMonData(&gEnemyParty[gBattlerPartyIndexes[battler]], MON_DATA_HP) == 0)
return;
if (gBattleScripting.monCaught) // Don't create opponent sprite if it has been caught.
return;
SetMultiuseSpriteTemplateToPokemon(GetMonData(&gEnemyParty[gBattlerPartyIndexes[battler]], MON_DATA_SPECIES), GetBattlerPosition(battler));
gBattlerSpriteIds[battler] = CreateSprite(&gMultiuseSpriteTemplate, GetBattlerSpriteCoord(battler, 2), posY, sub_80A82E4(battler));