Skip to content

Commit

Permalink
Merge pull request #196 from BuffelSaft/early-game
Browse files Browse the repository at this point in the history
Early game tweaks
  • Loading branch information
BuffelSaft authored Sep 5, 2021
2 parents e480e83 + 19f0eb9 commit 46069b8
Show file tree
Hide file tree
Showing 24 changed files with 312 additions and 87 deletions.
12 changes: 12 additions & 0 deletions asm/macros/battle_ai_script.inc
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,18 @@
.4byte \ptr
.endm

.macro if_species battler:req, species:req, ptr:req
.byte 0x7D
.byte \battler
.2byte \species
.4byte \ptr
.endm

.macro if_target_can_go_down ptr:req
.byte 0x7E
.4byte \ptr
.endm

@ useful script macros
.macro if_has_physical_move battler:req, ptr:req
if_has_move_with_split \battler, SPLIT_PHYSICAL, \ptr
Expand Down
86 changes: 74 additions & 12 deletions data/battle_ai_scripts.s
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "constants/moves.h"
#include "constants/battle_move_effects.h"
#include "constants/hold_effects.h"
#include "constants/species.h"
#include "constants/pokemon.h"
.include "asm/macros/battle_ai_script.inc"

Expand Down Expand Up @@ -425,8 +426,8 @@ AI_CBM_Defog:
goto AI_CBM_EvasionDown

AI_CBM_PsychicShift:
if_not_status AI_USER, STATUS1_ANY, Score_Minus10
if_status AI_TARGET, STATUS1_ANY, Score_Minus10
if_not_status AI_USER, STATUS1_ANY, Score_Minus30
if_status AI_TARGET, STATUS1_ANY, Score_Minus30
if_status AI_USER, STATUS1_PARALYSIS, AI_CBM_Paralyze
if_status AI_USER, STATUS1_PSN_ANY, AI_CBM_Toxic
if_status AI_USER, STATUS1_BURN, AI_CBM_WillOWisp
Expand Down Expand Up @@ -805,6 +806,7 @@ AI_CBM_Reflect: @ 82DC53A

AI_CBM_Paralyze: @ 82DC545
if_type_effectiveness AI_EFFECTIVENESS_x0, Score_Minus30
call AI_CBM_ParalyzeCheckTWave
get_ability AI_TARGET
if_equal ABILITY_LIMBER, Score_Minus30
if_status AI_TARGET, STATUS1_ANY, Score_Minus30
Expand All @@ -813,6 +815,17 @@ AI_CBM_Paralyze: @ 82DC545
if_side_affecting AI_TARGET, SIDE_STATUS_SAFEGUARD, Score_Minus30
end

AI_CBM_ParalyzeCheckTWave:
if_move MOVE_THUNDER_WAVE AI_CBM_ParalyzeCheckTWaveAbsorbed
end

AI_CBM_ParalyzeCheckTWaveAbsorbed:
get_ability AI_TARGET
if_equal ABILITY_VOLT_ABSORB, Score_Minus30
if_equal ABILITY_LIGHTNING_ROD, Score_Minus30
if_equal ABILITY_MOTOR_DRIVE, Score_Minus30
end

AI_CBM_Substitute: @ 82DC568
if_status2 AI_USER, STATUS2_SUBSTITUTE, Score_Minus8
if_hp_less_than AI_USER, 26, Score_Minus10
Expand Down Expand Up @@ -965,15 +978,16 @@ CheckIfTargetAllyBlocksTorment:
end

AI_CBM_WillOWisp: @ 82DC6B4
if_status AI_TARGET, STATUS1_ANY, Score_Minus30
get_ability AI_TARGET
if_equal ABILITY_WATER_VEIL, Score_Minus10
if_equal ABILITY_WATER_BUBBLE, Score_Minus10
if_equal ABILITY_FLARE_BOOST, Score_Minus10
if_equal ABILITY_FLASH_FIRE, Score_Minus10
if_status AI_TARGET, STATUS1_ANY, Score_Minus10
if_type AI_TARGET, TYPE_FIRE, Score_Minus10
if_equal ABILITY_WATER_VEIL, Score_Minus30
if_equal ABILITY_WATER_BUBBLE, Score_Minus30
if_equal ABILITY_FLARE_BOOST, Score_Minus30
if_equal ABILITY_FLASH_FIRE, Score_Minus30
if_equal ABILITY_MAGIC_GUARD, Score_Minus5
if_type AI_TARGET, TYPE_FIRE, Score_Minus30
if_type AI_TARGET, TYPE_GRASS, CheckIfFlowerVeilBlocksMove
if_side_affecting AI_TARGET, SIDE_STATUS_SAFEGUARD, Score_Minus10
if_side_affecting AI_TARGET, SIDE_STATUS_SAFEGUARD, Score_Minus30
end

AI_CBM_HelpingHand: @ 82DC6E3
Expand Down Expand Up @@ -1201,6 +1215,23 @@ AI_FaintWithPriority_ScoreUp:
score +10
end

AI_ShouldKingsShield:
if_move MOVE_KINGS_SHIELD, AI_ShouldKingsShield2
end

@ Discourage King's Shield if user is Shield form
AI_ShouldKingsShield2:
if_species AI_USER, SPECIES_AEGISLASH_BLADE AI_KingsShieldCheckSpeeds
score -3
end

@ Don't shield if you can outspeed and KO foe
AI_KingsShieldCheckSpeeds:
if_target_faster Score_Plus10
if_target_can_go_down Score_Minus5
score +10
end

AI_CheckViability:
if_target_is_ally AI_Ret
call_if_always_hit AI_CV_AlwaysHit
Expand All @@ -1210,6 +1241,7 @@ AI_CheckViability:
call AI_ChoiceLocked
call AI_DiscourageMagicGuard
call AI_FaintWithPriority
call AI_ShouldKingsShield
if_effect EFFECT_HIT, AI_CV_Hit
if_effect EFFECT_SLEEP, AI_CV_Sleep
if_effect EFFECT_ABSORB, AI_CV_Absorb
Expand Down Expand Up @@ -1352,6 +1384,8 @@ AI_CheckViability:
if_effect EFFECT_QUIVER_DANCE, AI_CV_BoostSpeedOffense
if_effect EFFECT_GEOMANCY, AI_CV_BoostSpeedOffense
if_effect EFFECT_COIL, AI_CV_DefenseUp
if_effect EFFECT_DEFOG, AI_CV_Defog
if_effect EFFECT_WILL_O_WISP AI_CV_Burn
end

AI_CV_PerishSong:
Expand Down Expand Up @@ -2128,6 +2162,14 @@ AI_CV_Heal6:
AI_CV_Heal_End:
end

AI_EncourageStatusHex:
if_doesnt_have_move_with_effect AI_USER, EFFECT_HEX, AI_EncourageStatusHexEnd
score +2
if_random_less_than 128, AI_EncourageStatusHexEnd
score +1
AI_EncourageStatusHexEnd:
end

EncouragePsnVenoshock:
if_doesnt_have_move_with_effect AI_USER, EFFECT_VENOSHOCK, EncouragePsnVenoshockEnd
score +2
Expand All @@ -2142,6 +2184,7 @@ AI_ToxicTrappedTarget:

AI_CV_Toxic:
call EncouragePsnVenoshock
call AI_EncourageStatusHex
call AI_ToxicTrappedTarget
AI_CV_LeechSeed:
if_user_has_no_attacking_moves AI_CV_Toxic3
Expand Down Expand Up @@ -2336,18 +2379,33 @@ AI_CV_Poison_End:
end

AI_CV_Paralyze:
call AI_EncourageStatusHex
call AI_ParalyzeSweeper
if_target_faster AI_CV_Paralyze2
if_hp_more_than AI_USER, 70, AI_CV_Paralyze_End
score -1
goto AI_CV_Paralyze_End

AI_CV_Paralyze2:
if_random_less_than 20, AI_CV_Paralyze_End
score +3

AI_CV_Paralyze_End:
end

AI_ParalyzeSweeper:
if_stat_level_more_than AI_TARGET, STAT_SPEED, DEFAULT_STAT_STAGE, Score_Plus5
end

AI_CV_Burn:
call AI_EncourageStatusHex
call AI_BurnSweeper
if_random_less_than 20, AI_CV_Burn_End
score +3
AI_CV_Burn_End:
end

AI_BurnSweeper:
if_stat_level_more_than AI_TARGET, STAT_ATK, DEFAULT_STAT_STAGE, Score_Plus5
end

AI_CV_VitalThrow:
if_target_faster AI_CV_VitalThrow_End
if_hp_more_than AI_USER, 60, AI_CV_VitalThrow_End
Expand Down Expand Up @@ -3663,6 +3721,10 @@ AI_CV_BoostSpeedOffense2:
AI_CV_BoostSpeedOffense_End:
end

AI_CV_Defog:
if_side_affecting AI_USER, SIDE_STATUS_SPIKES | SIDE_STATUS_STEALTH_ROCK | SIDE_STATUS_TOXIC_SPIKES | SIDE_STATUS_STICKY_WEB, Score_Plus10
end

AI_TryToFaint:
if_target_is_ally AI_Ret
if_can_faint AI_TryToFaint_Can
Expand Down
13 changes: 13 additions & 0 deletions data/maps/DewfordTown/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,19 @@
"trainer_sight_or_berry_tree_id": "0",
"script": "DewfordTown_EventScript_TrendyPhraseBoy",
"flag": "0"
},
{
"graphics_id": "OBJ_EVENT_GFX_MAN_2",
"x": 8,
"y": 18,
"elevation": 3,
"movement_type": "MOVEMENT_TYPE_NONE",
"movement_range_x": 0,
"movement_range_y": 0,
"trainer_type": "TRAINER_TYPE_NONE",
"trainer_sight_or_berry_tree_id": "0",
"script": "DewfordTown_EventScript_GymGuide",
"flag": "FLAG_HIDE_SLATEPORT_CITY_BRAWLY"
}
],
"warp_events": [
Expand Down
11 changes: 11 additions & 0 deletions data/maps/DewfordTown/scripts.inc
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,10 @@ DewfordTown_EventScript_LandedSlateport:: @ 81E9799
msgbox DewfordTown_Text_BrineyLandedInSlateport, MSGBOX_DEFAULT
return

DewfordTown_EventScript_GymGuide::
msgbox DewfordTown_Text_BrawlyInSlateport, MSGBOX_NPC
end

DewfordTown_Movement_SailToPetalburg: @ 81E97A2
walk_up
walk_up
Expand Down Expand Up @@ -750,3 +754,10 @@ DewfordTown_Text_ReceivedEviolite:
.string "Maybe it'll be more useful in the hands\n"
.string "of a Pokémon Trainer?\p"
.string "It's no good as bait, that's for sure!$"

DewfordTown_Text_BrawlyInSlateport:
.string "Hey, Champ-to-be!\p"
.string "Brawly, the Gym Leader here, went\n"
.string "to Slateport City and hasn't returned.\p"
.string "If you're after a battle, you'll have\n"
.string "to go find him.$"
1 change: 1 addition & 0 deletions data/maps/DewfordTown_Gym/scripts.inc
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ DewfordTown_Gym_EventScript_BrawlyDefeated:: @ 81FC7F7
msgbox DewfordTown_Gym_Text_KnuckleBadgeInfoTakeThis, MSGBOX_DEFAULT
setflag FLAG_DEFEATED_DEWFORD_GYM
setflag FLAG_BADGE02_GET
setflag FLAG_HIDE_SLATEPORT_CITY_TEAM_AQUA
addvar VAR_PETALBURG_GYM_STATE, 1
compare VAR_PETALBURG_GYM_STATE, 6
call_if_eq Common_EventScript_ReadyPetalburgGymForBattle
Expand Down
2 changes: 1 addition & 1 deletion data/maps/GraniteCave_1F/scripts.inc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ GraniteCave_1F_EventScript_ReceivedFlash:: @ 822DA8A

GraniteCave_1F_Text_GetsDarkAheadHereYouGo: @ 822DA94
.string "Hey, you.\n"
.string "It gets awfully dark ahead.\l"
.string "It gets a little dark ahead.\l"
.string "It'll be tough trying to explore.\p"
.string "That guy who came by earlier…\n"
.string "Steven, I think it was.\p"
Expand Down
1 change: 1 addition & 0 deletions data/maps/GraniteCave_B1F/scripts.inc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ GraniteCave_B1F_MapScripts:: @ 822DC5E
.byte 0

GraniteCave_B1F_SetHoleWarp: @ 822DC6E
setflashradius 4
setstepcallback STEP_CB_CRACKED_FLOOR
setholewarp MAP_GRANITE_CAVE_B2F, 255, 0, 0
end
Expand Down
6 changes: 5 additions & 1 deletion data/maps/GraniteCave_B2F/scripts.inc
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
GraniteCave_B2F_MapScripts:: @ 822DC79
GraniteCave_B2F_MapScripts::
map_script MAP_SCRIPT_ON_RESUME, GraniteCave_B2F_SetFlashRadius
.byte 0

GraniteCave_B2F_SetFlashRadius:
setflashradius 4
end
4 changes: 2 additions & 2 deletions data/maps/PetalburgWoods/scripts.inc
Original file line number Diff line number Diff line change
Expand Up @@ -376,10 +376,10 @@ PetalburgWoods_Text_ThatWasAwfullyClose: @ 822E63D

PetalburgWoods_Text_TeamAquaAfterSomethingInRustboro:
.string "A Pokémon holding that Exp. Share\n"
.string "will get half of the Exp. points from\l"
.string "will get 100% of the Exp. points from\l"
.string "battle, even if it didn't participate.\p"
.string "Normally they'd only get a quarter of\n"
.string "the Exp. points, so It's quite useful\l"
.string "the Exp. points, so it's quite useful\l"
.string "for raising weak Pokémon!\p"
.string "Didn't that Team Aqua thug say\n"
.string "they were after something in\l"
Expand Down
13 changes: 13 additions & 0 deletions data/maps/SlateportCity/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,19 @@
"trainer_sight_or_berry_tree_id": "0",
"script": "SlateportCity_EventScript_Greta",
"flag": "FLAG_SYS_ARENA_SILVER"
},
{
"graphics_id": "OBJ_EVENT_GFX_BRAWLY",
"x": 19,
"y": 26,
"elevation": 3,
"movement_type": "MOVEMENT_TYPE_FACE_RIGHT",
"movement_range_x": 0,
"movement_range_y": 0,
"trainer_type": "TRAINER_TYPE_NONE",
"trainer_sight_or_berry_tree_id": "0",
"script": "SlateportCity_EventScript_Brawly",
"flag": "FLAG_HIDE_SLATEPORT_CITY_BRAWLY"
}
],
"warp_events": [
Expand Down
36 changes: 34 additions & 2 deletions data/maps/SlateportCity/scripts.inc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
.set LOCALID_GRUNT_9, 31
.set LOCALID_GRUNT_11, 33
.set LOCALID_SCOTT, 35
.set LOCALID_BRAWLY, 40

SlateportCity_MapScripts:: @ 81DCC61
map_script MAP_SCRIPT_ON_TRANSITION, SlateportCity_OnTransition
Expand Down Expand Up @@ -325,7 +326,7 @@ SlateportCity_EventScript_Man1SternInterview:: @ 81DCF0D
SlateportCity_EventScript_Woman1:: @ 81DCF17
lock
faceplayer
goto_if_set FLAG_DOCK_REJECTED_DEVON_GOODS, SlateportCity_EventScript_Woman1AquaGone
goto_if_set FLAG_HIDE_SLATEPORT_CITY_TEAM_AQUA, SlateportCity_EventScript_Woman1AquaGone
msgbox SlateportCity_Text_WhatsLongLineOverThere, MSGBOX_DEFAULT
release
end
Expand Down Expand Up @@ -1013,6 +1014,24 @@ SlateportCity_EventScript_ScottBattleTentScene:: @ 81DD5DC
releaseall
end

SlateportCity_EventScript_Brawly::
lockall
msgbox SlateportCity_Text_WhoahLineSoLong, MSGBOX_DEFAULT
waitse
playse SE_PIN
applymovement LOCALID_BRAWLY, Common_Movement_ExclamationMark
waitmovement 0
applymovement LOCALID_BRAWLY, Common_Movement_Delay48
waitmovement 0
faceplayer
msgbox SlateportCity_Text_LookingForBrawly, MSGBOX_DEFAULT
fadescreen FADE_TO_BLACK
closemessage
removeobject LOCALID_BRAWLY
fadescreen FADE_FROM_BLACK
releaseall
end

SlateportCity_Movement_PushPlayerDown: @ 81DD630
lock_facing_direction
walk_down
Expand Down Expand Up @@ -1047,7 +1066,20 @@ SlateportCity_EventScript_BerryCrushRankingsSign:: @ 81DD643
releaseall
end

SlateportCity_Text_EnergyGuruSellWhatYouNeed: @ 81DD64A
SlateportCity_Text_WhoahLineSoLong:
.string "Whoah! This line's way too long,\n"
.string "dude! What's the deal?$"

SlateportCity_Text_LookingForBrawly:
.string "Oh, hey there!\p"
.string "Hmm? You're looking for the\n"
.string "Dewford Gym Leader?\p"
.string "That'd be me, Brawly!\n"
.string "I guess you want a battle, yeah?\p"
.string "Gnarly! I'll head back to the Gym.\n"
.string "You better be ready to make a splash!$"

SlateportCity_Text_EnergyGuruSellWhatYouNeed:
.string "I'm the Energy Guru! I'll go for it and\n"
.string "sell you what you need!$"

Expand Down
1 change: 0 additions & 1 deletion data/maps/SlateportCity_SternsShipyard_1F/scripts.inc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ SlateportCity_SternsShipyard_1F_EventScript_Dock:: @ 8207F40
applymovement LOCALID_DOCK, Common_Movement_FaceOriginalDirection
waitmovement 0
setflag FLAG_DOCK_REJECTED_DEVON_GOODS
setflag FLAG_HIDE_SLATEPORT_CITY_TEAM_AQUA
releaseall
end

Expand Down
6 changes: 3 additions & 3 deletions data/maps/VerdanturfMeadow/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
"id": "MAP_VERDANTURF_MEADOW",
"name": "VerdanturfMeadow",
"layout": "LAYOUT_VERDANTURF_MEADOW",
"music": "MUS_ABANDONED_SHIP",
"music": "MUS_RG_SEVII_45",
"region_map_section": "MAPSEC_VERDANTURF_MEADOW",
"requires_flash": false,
"weather": "WEATHER_NONE",
"map_type": "MAP_TYPE_NONE",
"map_type": "MAP_TYPE_ROUTE",
"allow_cycling": true,
"allow_escaping": true,
"allow_escaping": false,
"allow_running": true,
"show_map_name": true,
"battle_scene": "MAP_BATTLE_SCENE_NORMAL",
Expand Down
Loading

0 comments on commit 46069b8

Please sign in to comment.