Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pv2 wiz1989 241202 #59

Merged
merged 15 commits into from
Jan 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion asm/macros/battle_script.inc
Original file line number Diff line number Diff line change
Expand Up @@ -928,8 +928,9 @@
.4byte \failInstr
.endm

.macro setdestinybond
.macro trysetdestinybond failInstr:req
.byte 0xaa
.4byte \failInstr
.endm

.macro trysetdestinybondtohappen
Expand Down Expand Up @@ -1682,6 +1683,11 @@
.byte \battler
.4byte \failInstr
.endm

.macro jumpifcommanderactive jumpInstr:req
callnative BS_JumpIfCommanderActive
.4byte \jumpInstr
.endm

.macro tryhitswitchtarget failInstr:req
callnative BS_TryHitSwitchTarget
Expand Down
54 changes: 52 additions & 2 deletions data/battle_scripts_1.s
Original file line number Diff line number Diff line change
Expand Up @@ -3276,6 +3276,7 @@ BattleScript_EffectRoar::
attackstring
ppreduce
jumpifroarfails BattleScript_ButItFailed
jumpifcommanderactive BattleScript_ButItFailed
jumpifability BS_TARGET, ABILITY_GUARD_DOG, BattleScript_ButItFailed
jumpifability BS_TARGET, ABILITY_SUCTION_CUPS, BattleScript_AbilityPreventsPhasingOut
jumpifstatus3 BS_TARGET, STATUS3_ROOTED, BattleScript_PrintMonIsRooted
Expand Down Expand Up @@ -4061,7 +4062,7 @@ BattleScript_EffectDestinyBond::
attackcanceler
attackstring
ppreduce
setdestinybond
trysetdestinybond BattleScript_ButItFailed
attackanimation
waitanimation
printstring STRINGID_PKMNTRYINGTOTAKEFOE
Expand Down Expand Up @@ -8036,11 +8037,52 @@ BattleScript_CostarActivates::

BattleScript_ZeroToHeroActivates::
pause B_WAIT_TIME_SHORT
call BattleScript_AbilityPopUp
call BattleScript_AbilityPopUpScripting
printstring STRINGID_ZEROTOHEROTRANSFORMATION
waitmessage B_WAIT_TIME_LONG
end3

BattleScript_CommanderActivates::
pause B_WAIT_TIME_SHORT
call BattleScript_AbilityPopUpScripting
printstring STRINGID_COMMANDERACTIVATES
waitmessage B_WAIT_TIME_LONG
BattleScript_CommanderAtkIncrease:
setbyte sSTAT_ANIM_PLAYED, FALSE
playstatchangeanimation BS_ATTACKER, BIT_ATK | BIT_DEF | BIT_SPATK | BIT_SPDEF | BIT_SPEED, STAT_CHANGE_BY_TWO
setstatchanger STAT_ATK, 2, FALSE
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_ALLOW_PTR, BattleScript_CommanderDefIncrease
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_INCREASE, BattleScript_CommanderDefIncrease
printfromtable gStatUpStringIds
waitmessage B_WAIT_TIME_LONG
BattleScript_CommanderDefIncrease:
setstatchanger STAT_DEF, 2, FALSE
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_ALLOW_PTR, BattleScript_CommanderSpAtkIncrease
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_INCREASE, BattleScript_CommanderSpAtkIncrease
printfromtable gStatUpStringIds
waitmessage B_WAIT_TIME_LONG
BattleScript_CommanderSpAtkIncrease:
setstatchanger STAT_SPATK, 2, FALSE
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_ALLOW_PTR, BattleScript_CommanderSpDefIncrease
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_INCREASE, BattleScript_CommanderSpDefIncrease
printfromtable gStatUpStringIds
waitmessage B_WAIT_TIME_LONG
BattleScript_CommanderSpDefIncrease:
setstatchanger STAT_SPDEF, 2, FALSE
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_ALLOW_PTR, BattleScript_CommanderSpeedIncrease
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_INCREASE, BattleScript_CommanderSpeedIncrease
printfromtable gStatUpStringIds
waitmessage B_WAIT_TIME_LONG
BattleScript_CommanderSpeedIncrease:
setstatchanger STAT_SPEED, 2, FALSE
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_ALLOW_PTR, BattleScript_CommanderEnd
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_INCREASE, BattleScript_CommanderEnd
printfromtable gStatUpStringIds
waitmessage B_WAIT_TIME_LONG
BattleScript_CommanderEnd:
restoreattacker
end3

BattleScript_HospitalityActivates::
pause B_WAIT_TIME_SHORT
call BattleScript_AbilityPopUp
Expand Down Expand Up @@ -9558,6 +9600,14 @@ BattleScript_StickyBarbTransfer::
removeitem BS_TARGET
return

BattleScript_RedCardActivationNoSwitch::
playanimation BS_SCRIPTING, B_ANIM_HELD_ITEM_EFFECT
printstring STRINGID_REDCARDACTIVATE
waitmessage B_WAIT_TIME_LONG
removeitem BS_SCRIPTING
restoretarget
return

BattleScript_RedCardActivates::
playanimation BS_SCRIPTING, B_ANIM_HELD_ITEM_EFFECT
printstring STRINGID_REDCARDACTIVATE
Expand Down
Binary file modified data/layouts/PitArenaMine/map.bin
Binary file not shown.
Binary file modified data/layouts/PitArenaMine02/map.bin
Binary file not shown.
Binary file modified data/layouts/PitArenaMine03/map.bin
Binary file not shown.
4 changes: 2 additions & 2 deletions data/maps/PitArenaDesert03/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
{
"graphics_id": "OBJ_EVENT_GFX_VAR_1",
"x": 16,
"x": 15,
"y": 14,
"elevation": 0,
"movement_type": "MOVEMENT_TYPE_WANDER_UP_AND_DOWN",
Expand Down Expand Up @@ -81,7 +81,7 @@
},
{
"graphics_id": "OBJ_EVENT_GFX_VAR_1",
"x": 16,
"x": 15,
"y": 14,
"elevation": 0,
"movement_type": "MOVEMENT_TYPE_WANDER_UP_AND_DOWN",
Expand Down
4 changes: 2 additions & 2 deletions data/maps/PitArenaDirtPath02/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"object_events": [
{
"graphics_id": "OBJ_EVENT_GFX_VAR_0",
"x": 4,
"x": 5,
"y": 13,
"elevation": 0,
"movement_type": "MOVEMENT_TYPE_WANDER_UP_AND_DOWN",
Expand Down Expand Up @@ -68,7 +68,7 @@
},
{
"graphics_id": "OBJ_EVENT_GFX_VAR_0",
"x": 4,
"x": 5,
"y": 13,
"elevation": 0,
"movement_type": "MOVEMENT_TYPE_WANDER_UP_AND_DOWN",
Expand Down
8 changes: 4 additions & 4 deletions data/maps/PitArenaMine/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
},
{
"graphics_id": "OBJ_EVENT_GFX_VAR_3",
"x": 4,
"y": 13,
"x": 6,
"y": 12,
"elevation": 0,
"movement_type": "MOVEMENT_TYPE_WANDER_LEFT_AND_RIGHT",
"movement_range_x": 3,
Expand Down Expand Up @@ -107,8 +107,8 @@
},
{
"graphics_id": "OBJ_EVENT_GFX_VAR_3",
"x": 4,
"y": 13,
"x": 6,
"y": 12,
"elevation": 0,
"movement_type": "MOVEMENT_TYPE_WANDER_LEFT_AND_RIGHT",
"movement_range_x": 3,
Expand Down
2 changes: 0 additions & 2 deletions data/maps/PitEntrance/scripts.inc
Original file line number Diff line number Diff line change
Expand Up @@ -437,8 +437,6 @@ PitEntrance_Text_MoreInfo::
.string "Every 5th floor is a Heal/Shop floor\n"
.string "where you will be able to rest and\l"
.string "prepare for the next Trial.\p"
.string "Every ten floors there will be\n"
.string "a Move Tutor.\p"
.string "And every 25th floor there will be a\n"
.string "boss fight after that you will be able\l"
.string "to choose another random Pokémon.$"
Expand Down
22 changes: 11 additions & 11 deletions data/scripts/pit_mon_encounters.inc
Original file line number Diff line number Diff line change
Expand Up @@ -364,8 +364,8 @@ PitEncounter_Mover::
msgbox PitEncounter_NPCMoverOpen, MSGBOX_DEFAULT
message PitEncounter_NPCMoverOpen2
dynmultichoice 17, 1, 0, 5, 0, DYN_MULTICHOICE_CB_NONE, PitEncounter_NPCMover2, PitEncounter_NPCMover3, PitShop_ShopNPC_Option8
goto_if_eq VAR_RESULT, 0, PitEncounter_MoverSkip2
goto_if_eq VAR_RESULT, 1, PitEncounter_MoverSkip3
goto_if_eq VAR_RESULT, 0, PitEncounter_MoverSkip1
goto_if_eq VAR_RESULT, 1, PitEncounter_MoverSkip2
closemessage
EndOfMoverScript::
release
Expand All @@ -374,27 +374,27 @@ EndOfMoverScript::
PitEncounter_NPCMoverOpen:
.string "Abra has a special offer for you!\pIt can teleport you away.$"
PitEncounter_NPCMoverOpen2:
.string "Free Rare Candy Included With Purchase!$"
.string "Free Rare Candies included with purchase!$"

PitEncounter_MoverSkip2::
additem ITEM_RARE_CANDY, 2
PitEncounter_MoverSkip1::
additem ITEM_RARE_CANDY, 1
setflag FLAG_LEVEL_UP_TWICE
setflag FLAG_FLOOR_CLEARED
call PitEncounter_Common_AfterUse
callnative SetWarpTileActive
addvar VAR_PIT_FLOOR, 1
addvar VAR_PIT_FLOOR, 0
special DrawWholeMapView
goto Pit_Warp_Advance_Floor
release
end

PitEncounter_MoverSkip3::
additem ITEM_RARE_CANDY, 3
PitEncounter_MoverSkip2::
additem ITEM_RARE_CANDY, 2
setflag FLAG_FLOOR_CLEARED
setflag FLAG_LEVEL_UP_THRICE
callnative SetWarpTileActive
call PitEncounter_Common_AfterUse
addvar VAR_PIT_FLOOR, 2
addvar VAR_PIT_FLOOR, 1
special DrawWholeMapView
goto Pit_Warp_Advance_Floor
release
Expand Down Expand Up @@ -427,9 +427,9 @@ PitEncounter_NPCMoverNotEnoughMoneyText:
.string "Not enough money...$"

PitEncounter_NPCMover2:
.string "Skip 2 Floors$"
.string "Skip 1 Floor (1RC)$"
PitEncounter_NPCMover3:
.string "Skip 3 Floors$"
.string "Skip 2 Floors (2RC)$"
PitEncounter_NPCMover4:
.string "Wonder Trade$"

Expand Down
2 changes: 1 addition & 1 deletion data/text/frontier_brain.inc
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ gText_GriffinDefeat::
.string "You've won but at what cost…$"

gText_wiz1989Defeat::
.string "This is also great content!$"
.string "This was great content!$"

gText_AereonDefeat::
.string "Don't let your guard down!$"
Expand Down
Binary file modified data/tilesets/secondary/pit_arena_beach_cave/metatiles.bin
Binary file not shown.
Binary file modified graphics/pokemon/jellicent/overworld.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 13 additions & 1 deletion include/battle.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ struct ProtectStruct
u16 eatMirrorHerb:1;
u16 activateOpportunist:2; // 2 - to copy stats. 1 - stats copied (do not repeat). 0 - no stats to copy
u16 usedAllySwitch:1;
u16 padding:2;
// End of 16-bit bitfield
u32 physicalDmg;
u32 specialDmg;
u8 physicalBattlerId;
Expand Down Expand Up @@ -803,11 +805,15 @@ struct BattleStruct
u8 boosterEnergyActivates;
u8 distortedTypeMatchups;
u8 categoryOverride; // for Z-Moves and Max Moves
u8 commandingDondozo;
u16 commanderActive[MAX_BATTLERS_COUNT];
u32 stellarBoostFlags[NUM_BATTLE_SIDES]; // stored as a bitfield of flags for all types for each side
u8 fickleBeamBoosted:1;
u8 redCardActivates:1;
u8 padding:6;
u8 obedienceResult:3;
u8 padding:3;
u8 usedMicleBerry;
u8 usedEjectItem;
};

// The palaceFlags member of struct BattleStruct contains 1 flag per move to indicate which moves the AI should consider,
Expand Down Expand Up @@ -1147,6 +1153,12 @@ static inline u32 GetBattlerSide(u32 battler)
return GetBattlerPosition(battler) & BIT_SIDE;
}

static inline struct Pokemon* GetPartyBattlerData(u32 battler)
{
u32 index = gBattlerPartyIndexes[battler];
return (GetBattlerSide(battler) == B_SIDE_OPPONENT) ? &gEnemyParty[index] : &gPlayerParty[index];
}

static inline struct Pokemon *GetSideParty(u32 side)
{
return (side == B_SIDE_PLAYER) ? gPlayerParty : gEnemyParty;
Expand Down
2 changes: 2 additions & 0 deletions include/battle_script_commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ bool32 IsMoveNotAllowedInSkyBattles(u32 move);
bool32 DoSwitchInAbilities(u32 battlerId);
u8 GetFirstFaintedPartyIndex(u8 battlerId);
bool32 IsMoveAffectedByParentalBond(u32 move, u32 battler);
void SaveBattlerTarget(u32 battler);
void SaveBattlerAttacker(u32 battler);

extern void (* const gBattleScriptingCommandsTable[])(void);
extern const struct StatFractions gAccuracyStageRatios[];
Expand Down
2 changes: 2 additions & 0 deletions include/battle_scripts.h
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,7 @@ extern const u8 BattleScript_BattlerGotOverItsInfatuation[];
extern const u8 BattleScript_Pickpocket[];
extern const u8 BattleScript_StickyBarbTransfer[];
extern const u8 BattleScript_AttackerItemStatRaise[];
extern const u8 BattleScript_RedCardActivationNoSwitch[];
extern const u8 BattleScript_RedCardActivates[];
extern const u8 BattleScript_EjectButtonActivates[];
extern const u8 BattleScript_EjectPackActivate_Ret[];
Expand Down Expand Up @@ -479,6 +480,7 @@ extern const u8 BattleScript_CudChewActivates[];
extern const u8 BattleScript_SupremeOverlordActivates[];
extern const u8 BattleScript_CostarActivates[];
extern const u8 BattleScript_ZeroToHeroActivates[];
extern const u8 BattleScript_CommanderActivates[];
extern const u8 BattleScript_HospitalityActivates[];
extern const u8 BattleScript_ToxicDebrisActivates[];
extern const u8 BattleScript_EarthEaterActivates[];
Expand Down
1 change: 1 addition & 0 deletions include/battle_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -283,5 +283,6 @@ bool8 CanMonParticipateInSkyBattle(struct Pokemon *mon);
bool8 IsMonBannedFromSkyBattles(u16 species);
void RemoveBattlerType(u32 battler, u8 type);
u32 GetCalcedMoveBasePower(u32 move, u32 battlerAtk, u32 weather);
u32 DoesDestinyBondFail(u32 battler);

#endif // GUARD_BATTLE_UTIL_H
3 changes: 2 additions & 1 deletion include/config/battle.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
#define B_POWDER_RAIN GEN_LATEST // In Gen7+, Powder doesn't damage the user of a Fire type move in heavy rain.
#define B_AFTER_YOU_TURN_ORDER GEN_LATEST // In Gen8+, After You doesn't fail if the turn order wouldn't change after use.
#define B_QUASH_TURN_ORDER GEN_LATEST // In Gen8+, Quash-affected battlers move according to speed order. Before Gen8, Quash-affected battlers move in the order they were affected by Quash.
#define B_DESTINY_BOND_FAIL GEN_LATEST // In Gen7+, Destiny Bond fails if used repeatedly.

// Ability settings
#define B_EXPANDED_ABILITY_NAMES TRUE // If TRUE, ability names are increased from 12 characters to 16 characters.
Expand Down Expand Up @@ -165,7 +166,7 @@
#define B_MENTAL_HERB GEN_LATEST // In Gen5+, the Mental Herb cures Taunt, Encore, Torment, Heal Block, and Disable in addition to Infatuation from before.
#define B_TRAINERS_KNOCK_OFF_ITEMS TRUE // If TRUE, trainers can steal/swap your items (non-berries are restored after battle). In vanilla games trainers cannot steal items.
#define B_RETURN_STOLEN_NPC_ITEMS GEN_3 // In Gen5+, Thief and Covet no longer steal items from NPCs.
#define B_RESTORE_HELD_BATTLE_ITEMS GEN_LATEST // In Gen9, all non-berry items are restored after battle.
#define B_RESTORE_HELD_BATTLE_ITEMS GEN_9 // In Gen9, all non-berry items are restored after battle.
#define B_SOUL_DEW_BOOST GEN_LATEST // In Gens3-6, Soul Dew boosts Latis' Sp. Atk and Sp. Def. In Gen7+ it boosts the power of their Psychic and Dragon type moves instead.
#define B_NET_BALL_MODIFIER GEN_LATEST // In Gen7+, Net Ball's catch multiplier is x5 instead of x3.
#define B_DIVE_BALL_MODIFIER GEN_LATEST // In Gen4+, Dive Ball's effectiveness increases by x3.5 when Surfing or Fishing.
Expand Down
8 changes: 5 additions & 3 deletions include/constants/battle.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
#define STATUS3_YAWN_TURN(num) (((num) << 11) & STATUS3_YAWN)
#define STATUS3_IMPRISONED_OTHERS (1 << 13)
#define STATUS3_GRUDGE (1 << 14)
#define STATUS3___UNUSED (1 << 15)
#define STATUS3_COMMANDER (1 << 15)
#define STATUS3_GASTRO_ACID (1 << 16)
#define STATUS3_EMBARGO (1 << 17)
#define STATUS3_UNDERWATER (1 << 18)
Expand All @@ -186,7 +186,8 @@
#define STATUS3_LASER_FOCUS (1 << 29)
#define STATUS3_POWER_TRICK (1 << 30)
#define STATUS3_SKY_DROPPED (1 << 31) // Target of Sky Drop
#define STATUS3_SEMI_INVULNERABLE (STATUS3_UNDERGROUND | STATUS3_ON_AIR | STATUS3_UNDERWATER | STATUS3_PHANTOM_FORCE)
#define STATUS3_SEMI_INVULNERABLE_NO_COMMANDER (STATUS3_UNDERGROUND | STATUS3_ON_AIR | STATUS3_UNDERWATER | STATUS3_PHANTOM_FORCE) // Exception for Transform / Imposter
#define STATUS3_SEMI_INVULNERABLE (STATUS3_SEMI_INVULNERABLE_NO_COMMANDER | STATUS3_COMMANDER)

#define STATUS4_ELECTRIFIED (1 << 0)
#define STATUS4_MUD_SPORT (1 << 1) // Only used if B_SPORT_TURNS < GEN_6
Expand Down Expand Up @@ -404,8 +405,9 @@
#define MOVE_EFFECT_SECRET_POWER 77
#define MOVE_EFFECT_PSYCHIC_NOISE 78
#define MOVE_EFFECT_TERA_BLAST 79
#define MOVE_EFFECT_ORDER_UP 80

#define NUM_MOVE_EFFECTS 80
#define NUM_MOVE_EFFECTS 81

#define MOVE_EFFECT_AFFECTS_USER 0x2000
#define MOVE_EFFECT_CERTAIN 0x4000
Expand Down
1 change: 1 addition & 0 deletions include/constants/battle_move_effects.h
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ enum {
EFFECT_DRAGON_DARTS,
EFFECT_GUARDIAN_OF_ALOLA,
EFFECT_SHELL_SIDE_ARM,
EFFECT_ORDER_UP,
NUM_BATTLE_MOVE_EFFECTS,
};

Expand Down
3 changes: 2 additions & 1 deletion include/constants/battle_string_ids.h
Original file line number Diff line number Diff line change
Expand Up @@ -712,8 +712,9 @@
#define STRINGID_FOGLIFTED 710
#define STRINGID_PKMNMADESHELLGLEAM 711
#define STRINGID_FICKLEBEAMDOUBLED 712
#define STRINGID_COMMANDERACTIVATES 713

#define BATTLESTRINGS_COUNT 713
#define BATTLESTRINGS_COUNT 714

// This is the string id that gBattleStringsTable starts with.
// String ids before this (e.g. STRINGID_INTROMSG) are not in the table,
Expand Down
5 changes: 3 additions & 2 deletions include/global.h
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ struct SaveBlock2
u16 randomBattleWeather:2;
u16 optionsBattleSpeed:2;
u16 modeTrainerEVs:1;
u16 filler_9912:1;
u16 padding:1;
//end of u16

// #### running stats for The Pit - START ####
Expand Down Expand Up @@ -645,7 +645,8 @@ struct SaveBlock2
u8 hasRecievedShinyDust;
u8 forceNewRun;
u8 hasReceivedShedinja;
u8 pit_padding[63];
u8 modeMonoType; //0 = all types, rest is based on type defines in constants/pokemon.h
u8 pit_padding[62];

struct HallofFameTeam2 tempHofMon;

Expand Down
Loading
Loading