mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 19:47:35 +01:00
Natural Gift
This commit is contained in:
parent
269f573297
commit
e1ea4b62e9
@ -627,6 +627,12 @@
|
||||
.4byte \ptr
|
||||
.endm
|
||||
|
||||
.macro if_no_move_used battler:req, ptr:req
|
||||
.byte 0x6E
|
||||
.byte \battler
|
||||
.4byte \ptr
|
||||
.endm
|
||||
|
||||
@ useful script macros
|
||||
.macro if_has_physical_move battler:req, ptr:req
|
||||
if_has_move_with_split \battler, SPLIT_PHYSICAL, \ptr
|
||||
|
@ -1640,6 +1640,11 @@
|
||||
.4byte \ptr
|
||||
.endm
|
||||
|
||||
.macro jumpifnotberry battler:req, ptr:req
|
||||
various \battler, VARIOUS_JUMP_IF_NOT_BERRY
|
||||
.4byte \ptr
|
||||
.endm
|
||||
|
||||
.macro jumpifroarfails ptr:req
|
||||
various BS_ATTACKER, VARIOUS_JUMP_IF_ROAR_FAILS
|
||||
.4byte \ptr
|
||||
|
@ -251,6 +251,18 @@ AI_CheckBadMove_CheckEffect: @ 82DC045
|
||||
if_effect EFFECT_BELCH, AI_CBM_Belch
|
||||
if_effect EFFECT_DO_NOTHING, Score_Minus8
|
||||
if_effect EFFECT_POWDER, AI_CBM_Powder
|
||||
if_effect EFFECT_PROTECT, AI_CBM_Protect
|
||||
if_effect EFFECT_TAUNT, AI_CBM_Taunt
|
||||
end
|
||||
|
||||
AI_CBM_Taunt:
|
||||
if_target_taunted Score_Minus10
|
||||
end
|
||||
|
||||
AI_CBM_Protect:
|
||||
get_protect_count AI_USER
|
||||
if_more_than 2, Score_Minus10
|
||||
if_status AI_TARGET, STATUS1_SLEEP | STATUS1_FREEZE, Score_Minus8
|
||||
end
|
||||
|
||||
AI_CBM_Powder:
|
||||
@ -664,10 +676,12 @@ AI_CBM_LeechSeed: @ 82DC57A
|
||||
|
||||
AI_CBM_Disable: @ 82DC595
|
||||
if_any_move_disabled AI_TARGET, Score_Minus8
|
||||
if_no_move_used AI_TARGET, Score_Minus8
|
||||
end
|
||||
|
||||
AI_CBM_Encore: @ 82DC59D
|
||||
if_any_move_encored AI_TARGET, Score_Minus8
|
||||
if_no_move_used AI_TARGET, Score_Minus8
|
||||
end
|
||||
|
||||
AI_CBM_DamageDuringSleep: @ 82DC5A5
|
||||
@ -1008,7 +1022,8 @@ AI_CheckViability:
|
||||
if_effect EFFECT_FAKE_OUT, AI_CV_FakeOut
|
||||
if_effect EFFECT_SPIT_UP, AI_CV_SpitUp
|
||||
if_effect EFFECT_SWALLOW, AI_CV_Heal
|
||||
if_effect EFFECT_HAIL, AI_CV_Hail
|
||||
if_effect EFFECT_HAIL, AI_CV_Sandstorm
|
||||
if_effect EFFECT_SANDSTORM, AI_CV_Sandstorm
|
||||
if_effect EFFECT_FLATTER, AI_CV_Flatter
|
||||
if_effect EFFECT_MEMENTO, AI_CV_SelfKO
|
||||
if_effect EFFECT_FACADE, AI_CV_Facade
|
||||
@ -1037,6 +1052,31 @@ AI_CheckViability:
|
||||
if_effect EFFECT_CALM_MIND, AI_CV_SpDefUp
|
||||
if_effect EFFECT_DRAGON_DANCE, AI_CV_DragonDance
|
||||
if_effect EFFECT_POWDER, AI_CV_Powder
|
||||
if_effect EFFECT_MISTY_TERRAIN, AI_CV_MistyTerrain
|
||||
if_effect EFFECT_GRASSY_TERRAIN, AI_CV_GrassyTerrain
|
||||
if_effect EFFECT_ELECTRIC_TERRAIN, AI_CV_ElectricTerrain
|
||||
if_effect EFFECT_PSYCHIC_TERRAIN, AI_CV_PsychicTerrain
|
||||
end
|
||||
|
||||
AI_CV_MistyTerrain:
|
||||
call AI_CV_TerrainExpander
|
||||
end
|
||||
|
||||
AI_CV_GrassyTerrain:
|
||||
call AI_CV_TerrainExpander
|
||||
end
|
||||
|
||||
AI_CV_ElectricTerrain:
|
||||
call AI_CV_TerrainExpander
|
||||
end
|
||||
|
||||
AI_CV_PsychicTerrain:
|
||||
call AI_CV_TerrainExpander
|
||||
end
|
||||
|
||||
AI_CV_TerrainExpander:
|
||||
get_hold_effect AI_USER
|
||||
if_equal HOLD_EFFECT_TERRAIN_EXTENDER, Score_Plus2
|
||||
end
|
||||
|
||||
AI_CV_Powder:
|
||||
@ -2349,36 +2389,42 @@ AI_CV_Protect_End:
|
||||
end
|
||||
|
||||
AI_CV_Foresight:
|
||||
get_user_type1
|
||||
if_equal TYPE_GHOST, AI_CV_Foresight2
|
||||
get_user_type2
|
||||
if_equal TYPE_GHOST, AI_CV_Foresight2
|
||||
if_has_move_with_type AI_USER, TYPE_NORMAL, AI_CV_ForesightGhost
|
||||
if_has_move_with_type AI_USER, TYPE_FIGHTING, AI_CV_ForesightGhost
|
||||
goto AI_CV_ForesightEvs
|
||||
AI_CV_ForesightGhost:
|
||||
if_type AI_USER, TYPE_GHOST, AI_CV_Foresight2
|
||||
AI_CV_ForesightEvs:
|
||||
if_stat_level_more_than AI_USER, STAT_EVASION, 8, AI_CV_Foresight3
|
||||
score -2
|
||||
score -3
|
||||
goto AI_CV_Foresight_End
|
||||
|
||||
AI_CV_Foresight2:
|
||||
if_random_less_than 80, AI_CV_Foresight_End
|
||||
|
||||
AI_CV_Foresight3:
|
||||
if_random_less_than 80, AI_CV_Foresight_End
|
||||
score +2
|
||||
|
||||
AI_CV_Foresight_End:
|
||||
end
|
||||
|
||||
AI_CV_Endure:
|
||||
if_hp_less_than AI_USER, 4, AI_CV_Endure2
|
||||
get_protect_count AI_USER
|
||||
if_more_than 1, AI_CV_Endure2
|
||||
if_hp_less_than AI_USER, 8, AI_CV_Endure2
|
||||
if_hp_less_than AI_USER, 14, AI_CV_Endure4
|
||||
if_hp_less_than AI_USER, 35, AI_CV_Endure3
|
||||
|
||||
if_doesnt_have_move_with_effect AI_USER, EFFECT_FLAIL, AI_CV_Endure2
|
||||
score +1
|
||||
goto AI_CV_Endure_End
|
||||
AI_CV_Endure2:
|
||||
score -3
|
||||
goto AI_CV_Endure_End
|
||||
AI_CV_Endure4:
|
||||
score -1
|
||||
goto AI_CV_Endure_End
|
||||
|
||||
AI_CV_Endure3:
|
||||
if_has_move_with_effect AI_USER, EFFECT_FLAIL, Score_Plus2
|
||||
if_random_less_than 70, AI_CV_Endure_End
|
||||
score +1
|
||||
|
||||
AI_CV_Endure_End:
|
||||
end
|
||||
|
||||
@ -2449,24 +2495,31 @@ AI_CV_RainDance:
|
||||
if_user_faster AI_CV_RainDance2
|
||||
get_ability AI_USER
|
||||
if_equal ABILITY_SWIFT_SWIM, AI_CV_RainDance3
|
||||
|
||||
get_ability AI_USER_PARTNER
|
||||
if_equal ABILITY_SWIFT_SWIM, AI_CV_RainDance3
|
||||
AI_CV_RainDance2:
|
||||
if_hp_less_than AI_USER, 40, AI_CV_RainDance_ScoreDown1
|
||||
get_weather
|
||||
if_equal AI_WEATHER_HAIL, AI_CV_RainDance3
|
||||
if_equal AI_WEATHER_SUN, AI_CV_RainDance3
|
||||
if_equal AI_WEATHER_SANDSTORM, AI_CV_RainDance3
|
||||
get_ability AI_USER
|
||||
if_equal ABILITY_RAIN_DISH, AI_CV_RainDance3
|
||||
goto AI_CV_RainDance_End
|
||||
|
||||
if_ability AI_USER, ABILITY_RAIN_DISH, AI_CV_RainDance3
|
||||
if_ability AI_USER_PARTNER, ABILITY_RAIN_DISH, AI_CV_RainDance3
|
||||
if_ability AI_USER, ABILITY_HYDRATION, AI_CV_Hydration
|
||||
if_no_ability AI_USER_PARTNER, ABILITY_HYDRATION, AI_CV_RainDance_Rock
|
||||
AI_CV_Hydration:
|
||||
if_status AI_USER, STATUS1_ANY, AI_CV_RainDance3
|
||||
if_status AI_USER_PARTNER, STATUS1_ANY, AI_CV_RainDance3
|
||||
goto AI_CV_RainDance_Rock
|
||||
AI_CV_RainDance3:
|
||||
score +1
|
||||
goto AI_CV_RainDance_End
|
||||
|
||||
goto AI_CV_RainDance_Rock
|
||||
AI_CV_RainDance_ScoreDown1:
|
||||
score -1
|
||||
|
||||
AI_CV_RainDance_Rock:
|
||||
get_hold_effect AI_USER
|
||||
if_not_equal HOLD_EFFECT_DAMP_ROCK, AI_CV_RainDance_End
|
||||
score +2
|
||||
AI_CV_RainDance_End:
|
||||
end
|
||||
|
||||
@ -2477,15 +2530,15 @@ AI_CV_SunnyDay:
|
||||
if_equal AI_WEATHER_RAIN, AI_CV_SunnyDay2
|
||||
if_equal AI_WEATHER_SANDSTORM, AI_CV_SunnyDay2
|
||||
goto AI_CV_SunnyDay_End
|
||||
|
||||
AI_CV_SunnyDay2:
|
||||
score +1
|
||||
goto AI_CV_SunnyDay_End
|
||||
|
||||
AI_CV_SunnyDay_ScoreDown1:
|
||||
score -1
|
||||
|
||||
AI_CV_SunnyDay_End:
|
||||
get_hold_effect AI_USER
|
||||
if_not_equal HOLD_EFFECT_HEAT_ROCK, AI_Ret
|
||||
score +2
|
||||
end
|
||||
|
||||
AI_CV_BellyDrum:
|
||||
@ -2674,17 +2727,52 @@ AI_CV_Hail:
|
||||
if_equal AI_WEATHER_SUN, AI_CV_Hail2
|
||||
if_equal AI_WEATHER_RAIN, AI_CV_Hail2
|
||||
if_equal AI_WEATHER_SANDSTORM, AI_CV_Hail2
|
||||
goto AI_CV_Hail_End
|
||||
|
||||
goto AI_CV_Hail_Rock
|
||||
AI_CV_Hail2:
|
||||
score +1
|
||||
goto AI_CV_Hail_End
|
||||
|
||||
goto AI_CV_Hail_Rock
|
||||
AI_CV_Hail_ScoreDown1:
|
||||
score -1
|
||||
|
||||
AI_CV_Hail_Rock:
|
||||
get_hold_effect AI_USER
|
||||
if_not_equal HOLD_EFFECT_ICY_ROCK, AI_Ret
|
||||
score +2
|
||||
AI_CV_Hail_Ability:
|
||||
get_ability AI_USER
|
||||
if_equal ABILITY_ICE_BODY, AI_CV_Hail_AbilityPlus
|
||||
if_equal ABILITY_SNOW_CLOAK, AI_CV_Hail_AbilityPlus
|
||||
if_equal ABILITY_SLUSH_RUSH, AI_CV_Hail_AbilityPlus
|
||||
if_not_equal ABILITY_FORECAST, AI_CV_Hail_End
|
||||
AI_CV_Hail_AbilityPlus:
|
||||
score +1,
|
||||
AI_CV_Hail_End:
|
||||
end
|
||||
|
||||
AI_CV_Sandstorm:
|
||||
if_hp_less_than AI_USER, 40, AI_CV_Sandstorm_ScoreDown1
|
||||
get_weather
|
||||
if_equal AI_WEATHER_SUN, AI_CV_Sandstorm2
|
||||
if_equal AI_WEATHER_RAIN, AI_CV_Sandstorm2
|
||||
if_equal AI_WEATHER_HAIL, AI_CV_Sandstorm2
|
||||
goto AI_CV_Sandstorm_End
|
||||
AI_CV_Sandstorm2:
|
||||
score +1
|
||||
goto AI_CV_Sandstorm_End
|
||||
AI_CV_Sandstorm_ScoreDown1:
|
||||
score -1
|
||||
AI_CV_Sandstorm_Rock:
|
||||
get_hold_effect AI_USER
|
||||
if_not_equal HOLD_EFFECT_SMOOTH_ROCK, AI_CV_Sandstorm_Ability
|
||||
score +2
|
||||
AI_CV_Sandstorm_Ability:
|
||||
get_ability AI_USER
|
||||
if_equal ABILITY_SAND_VEIL, AI_CV_Sandstorm_AbilityPlus
|
||||
if_equal ABILITY_SAND_RUSH, AI_CV_Sandstorm_AbilityPlus
|
||||
if_not_equal ABILITY_SAND_VEIL, AI_CV_Sandstorm_End
|
||||
AI_CV_Sandstorm_AbilityPlus:
|
||||
score +1,
|
||||
AI_CV_Sandstorm_End:
|
||||
end
|
||||
|
||||
AI_CV_Facade:
|
||||
if_not_status AI_TARGET, STATUS1_POISON | STATUS1_BURN | STATUS1_PARALYSIS | STATUS1_TOXIC_POISON, AI_CV_Facade_End
|
||||
|
@ -1875,7 +1875,6 @@ BattleScript_EffectFrustration:
|
||||
BattleScript_EffectEruption:
|
||||
BattleScript_EffectPledge:
|
||||
BattleScript_EffectFling:
|
||||
BattleScript_EffectNaturalGift:
|
||||
BattleScript_EffectWringOut:
|
||||
BattleScript_EffectHex:
|
||||
BattleScript_EffectAssurance:
|
||||
@ -1933,6 +1932,36 @@ BattleScript_HitFromAtkAnimation::
|
||||
BattleScript_MoveEnd::
|
||||
moveendall
|
||||
end
|
||||
|
||||
BattleScript_EffectNaturalGift:
|
||||
attackcanceler
|
||||
attackstring
|
||||
ppreduce
|
||||
jumpifnotberry BS_ATTACKER, BattleScript_ButItFailed
|
||||
jumpifword CMP_COMMON_BITS, gFieldStatuses, STATUS_FIELD_MAGIC_ROOM, BattleScript_ButItFailed
|
||||
jumpifability BS_ATTACKER, ABILITY_KLUTZ, BattleScript_ButItFailed
|
||||
jumpifstatus3 BS_ATTACKER, STATUS3_EMBARGO, BattleScript_ButItFailed
|
||||
accuracycheck BattleScript_MoveMissedPause, ACC_CURR_MOVE
|
||||
critcalc
|
||||
damagecalc
|
||||
adjustdamage
|
||||
attackanimation
|
||||
waitanimation
|
||||
effectivenesssound
|
||||
hitanimation BS_TARGET
|
||||
waitstate
|
||||
healthbarupdate BS_TARGET
|
||||
datahpupdate BS_TARGET
|
||||
critmessage
|
||||
waitmessage 0x40
|
||||
resultmessage
|
||||
waitmessage 0x40
|
||||
seteffectwithchance
|
||||
jumpifmovehadnoeffect BattleScript_EffectNaturalGiftEnd
|
||||
removeitem BS_ATTACKER
|
||||
BattleScript_EffectNaturalGiftEnd:
|
||||
tryfaintmon BS_TARGET, FALSE, NULL
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_MakeMoveMissed::
|
||||
orhalfword gMoveResultFlags, MOVE_RESULT_MISSED
|
||||
|
@ -32,6 +32,16 @@
|
||||
|
||||
#define IS_WHOLE_SIDE_ALIVE(battler)((IsBattlerAlive(battler) && IsBattlerAlive(BATTLE_PARTNER(battler))))
|
||||
|
||||
// for Natural Gift and Fling
|
||||
struct TypePower
|
||||
{
|
||||
u8 type;
|
||||
u8 power;
|
||||
u16 effect;
|
||||
};
|
||||
|
||||
extern const struct TypePower gNaturalGiftTable[];
|
||||
|
||||
u8 GetBattlerForBattleScript(u8 caseId);
|
||||
void PressurePPLose(u8 target, u8 attacker, u16 move);
|
||||
void PressurePPLoseOnUsingPerishSong(u8 attacker);
|
||||
|
@ -23,10 +23,11 @@
|
||||
#define AI_EFFECTIVENESS_x0 0
|
||||
|
||||
// ai weather
|
||||
#define AI_WEATHER_SUN 0
|
||||
#define AI_WEATHER_RAIN 1
|
||||
#define AI_WEATHER_SANDSTORM 2
|
||||
#define AI_WEATHER_HAIL 3
|
||||
#define AI_WEATHER_NONE 0
|
||||
#define AI_WEATHER_SUN 1
|
||||
#define AI_WEATHER_RAIN 2
|
||||
#define AI_WEATHER_SANDSTORM 3
|
||||
#define AI_WEATHER_HAIL 4
|
||||
|
||||
// get_how_powerful_move_is
|
||||
#define MOVE_POWER_DISCOURAGED 0
|
||||
|
@ -12,6 +12,30 @@
|
||||
|
||||
// Items with peculiar battle effects. Remove them if they're properly placed in constant/items.h
|
||||
#define ITEM_GRISEOUS_ORB 0
|
||||
#define ITEM_OCCA_BERRY 204
|
||||
#define ITEM_PASSHO_BERRY 205
|
||||
#define ITEM_WACAN_BERRY 206
|
||||
#define ITEM_RINDO_BERRY 207
|
||||
#define ITEM_YACHE_BERRY 208
|
||||
#define ITEM_CHOPLE_BERRY 177
|
||||
#define ITEM_KEBIA_BERRY 178
|
||||
#define ITEM_SHUCA_BERRY 179
|
||||
#define ITEM_COBA_BERRY 180
|
||||
#define ITEM_PAYAPA_BERRY 181
|
||||
#define ITEM_TANGA_BERRY 182
|
||||
#define ITEM_CHARTI_BERRY 183
|
||||
#define ITEM_KASIB_BERRY 184
|
||||
#define ITEM_HABAN_BERRY 185
|
||||
#define ITEM_COLBUR_BERRY 186
|
||||
#define ITEM_BABIRI_BERRY 187
|
||||
#define ITEM_CHILAN_BERRY 188
|
||||
#define ITEM_ROSELI_BERRY 189
|
||||
#define ITEM_MICLE_BERRY 197
|
||||
#define ITEM_CUSTAP_BERRY 199
|
||||
#define ITEM_JABOCA_BERRY 200
|
||||
#define ITEM_ROWAP_BERRY 201
|
||||
#define ITEM_KEE_BERRY 202
|
||||
#define ITEM_MARANGA_BERRY 203
|
||||
|
||||
#define GEN_3 0
|
||||
#define GEN_4 1
|
||||
|
@ -140,6 +140,7 @@
|
||||
#define VARIOUS_CHECK_IF_GRASSY_TERRAIN_HEALS 77
|
||||
#define VARIOUS_JUMP_IF_ROAR_FAILS 78
|
||||
#define VARIOUS_TRY_INSTRUCT 79
|
||||
#define VARIOUS_JUMP_IF_NOT_BERRY 80
|
||||
|
||||
// atk80, dmg manipulation
|
||||
#define ATK80_DMG_CHANGE_SIGN 0
|
||||
|
@ -165,6 +165,7 @@ static void BattleAICmd_if_has_no_move_with_split(void);
|
||||
static void BattleAICmd_if_physical_moves_unusable(void);
|
||||
static void BattleAICmd_if_ai_can_go_down(void);
|
||||
static void BattleAICmd_if_has_move_with_type(void);
|
||||
static void BattleAICmd_if_no_move_used(void);
|
||||
|
||||
// ewram
|
||||
EWRAM_DATA const u8 *gAIScriptPtr = NULL;
|
||||
@ -285,6 +286,7 @@ static const BattleAICmdFunc sBattleAICmdTable[] =
|
||||
BattleAICmd_if_physical_moves_unusable, // 0x6B
|
||||
BattleAICmd_if_ai_can_go_down, // 0x6C
|
||||
BattleAICmd_if_has_move_with_type, // 0x6D
|
||||
BattleAICmd_if_no_move_used, // 0x6E
|
||||
};
|
||||
|
||||
static const u16 sDiscouragedPowerfulMoveEffects[] =
|
||||
@ -1554,14 +1556,9 @@ static void BattleAICmd_get_considered_move_effect(void)
|
||||
|
||||
static void BattleAICmd_get_ability(void)
|
||||
{
|
||||
u8 battlerId;
|
||||
u8 battlerId = BattleAI_GetWantedBattler(gAIScriptPtr[1]);
|
||||
|
||||
if (gAIScriptPtr[1] == AI_USER)
|
||||
battlerId = sBattler_AI;
|
||||
else
|
||||
battlerId = gBattlerTarget;
|
||||
|
||||
if (gActiveBattler != battlerId)
|
||||
if (!IsBattlerAIControlled(battlerId))
|
||||
{
|
||||
if (BATTLE_HISTORY->abilities[battlerId] != 0)
|
||||
{
|
||||
@ -1614,7 +1611,7 @@ static void BattleAICmd_check_ability(void)
|
||||
u32 battlerId = BattleAI_GetWantedBattler(gAIScriptPtr[1]);
|
||||
u32 ability = gAIScriptPtr[2];
|
||||
|
||||
if (gAIScriptPtr[1] == AI_TARGET || gAIScriptPtr[1] == AI_TARGET_PARTNER)
|
||||
if (!IsBattlerAIControlled(battlerId))
|
||||
{
|
||||
if (BATTLE_HISTORY->abilities[battlerId] != ABILITY_NONE)
|
||||
{
|
||||
@ -1841,12 +1838,14 @@ static void BattleAICmd_get_weather(void)
|
||||
{
|
||||
if (gBattleWeather & WEATHER_RAIN_ANY)
|
||||
AI_THINKING_STRUCT->funcResult = AI_WEATHER_RAIN;
|
||||
if (gBattleWeather & WEATHER_SANDSTORM_ANY)
|
||||
else if (gBattleWeather & WEATHER_SANDSTORM_ANY)
|
||||
AI_THINKING_STRUCT->funcResult = AI_WEATHER_SANDSTORM;
|
||||
if (gBattleWeather & WEATHER_SUN_ANY)
|
||||
else if (gBattleWeather & WEATHER_SUN_ANY)
|
||||
AI_THINKING_STRUCT->funcResult = AI_WEATHER_SUN;
|
||||
if (gBattleWeather & WEATHER_HAIL_ANY)
|
||||
else if (gBattleWeather & WEATHER_HAIL_ANY)
|
||||
AI_THINKING_STRUCT->funcResult = AI_WEATHER_HAIL;
|
||||
else
|
||||
AI_THINKING_STRUCT->funcResult = AI_WEATHER_NONE;
|
||||
|
||||
gAIScriptPtr += 1;
|
||||
}
|
||||
@ -2202,17 +2201,12 @@ static void BattleAICmd_watch(void)
|
||||
|
||||
static void BattleAICmd_get_hold_effect(void)
|
||||
{
|
||||
u8 battlerId;
|
||||
u32 battlerId = BattleAI_GetWantedBattler(gAIScriptPtr[1]);
|
||||
|
||||
if (gAIScriptPtr[1] == AI_USER)
|
||||
battlerId = sBattler_AI;
|
||||
if (!IsBattlerAIControlled(battlerId))
|
||||
AI_THINKING_STRUCT->funcResult = BATTLE_HISTORY->itemEffects[battlerId];
|
||||
else
|
||||
battlerId = gBattlerTarget;
|
||||
|
||||
if (gActiveBattler != battlerId)
|
||||
AI_THINKING_STRUCT->funcResult = ItemId_GetHoldEffect(BATTLE_HISTORY->itemEffects[battlerId]);
|
||||
else
|
||||
AI_THINKING_STRUCT->funcResult = ItemId_GetHoldEffect(gBattleMons[battlerId].item);
|
||||
AI_THINKING_STRUCT->funcResult = GetBattlerHoldEffect(battlerId, FALSE);
|
||||
|
||||
gAIScriptPtr += 2;
|
||||
}
|
||||
@ -2715,3 +2709,25 @@ static void BattleAICmd_if_has_move_with_type(void)
|
||||
else
|
||||
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 3);
|
||||
}
|
||||
|
||||
static void BattleAICmd_if_no_move_used(void)
|
||||
{
|
||||
u32 i, battler = BattleAI_GetWantedBattler(gAIScriptPtr[1]);
|
||||
|
||||
if (!IsBattlerAIControlled(battler))
|
||||
{
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (BATTLE_HISTORY->usedMoves[battler].moves[i] != 0 && BATTLE_HISTORY->usedMoves[battler].moves[i] != 0xFFFF)
|
||||
{
|
||||
gAIScriptPtr += 6;
|
||||
return;
|
||||
}
|
||||
}
|
||||
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
gAIScriptPtr += 6;
|
||||
}
|
||||
}
|
||||
|
@ -5051,6 +5051,11 @@ void SetTypeBeforeUsingMove(u16 move, u8 battlerAtk)
|
||||
else if (gBattleMons[battlerAtk].type3 != TYPE_MYSTERY)
|
||||
gBattleStruct->dynamicMoveType = gBattleMons[battlerAtk].type3 | 0x80;
|
||||
}
|
||||
else if (gBattleMoves[move].effect == EFFECT_NATURAL_GIFT)
|
||||
{
|
||||
if (ItemId_GetPocket(gBattleMons[battlerAtk].item) == POCKET_BERRIES)
|
||||
gBattleStruct->dynamicMoveType = gNaturalGiftTable[ITEM_TO_BERRY(gBattleMons[battlerAtk].item)].type;
|
||||
}
|
||||
|
||||
attackerAbility = GetBattlerAbility(battlerAtk);
|
||||
GET_MOVE_TYPE(move, moveType);
|
||||
@ -5063,6 +5068,7 @@ void SetTypeBeforeUsingMove(u16 move, u8 battlerAtk)
|
||||
&& gBattleMoves[move].effect != EFFECT_HIDDEN_POWER
|
||||
&& gBattleMoves[move].effect != EFFECT_WEATHER_BALL
|
||||
&& gBattleMoves[move].effect != EFFECT_JUDGMENT
|
||||
&& gBattleMoves[move].effect != EFFECT_NATURAL_GIFT
|
||||
&& ((attackerAbility == ABILITY_PIXILATE && (ateType = TYPE_FAIRY))
|
||||
|| (attackerAbility == ABILITY_REFRIGERATE && (ateType = TYPE_ICE))
|
||||
|| (attackerAbility == ABILITY_AERILATE && (ateType = TYPE_FLYING))
|
||||
|
@ -6569,6 +6569,12 @@ static void atk76_various(void)
|
||||
else
|
||||
gBattlescriptCurrInstr += 7;
|
||||
return;
|
||||
case VARIOUS_JUMP_IF_NOT_BERRY:
|
||||
if (ItemId_GetPocket(gBattleMons[gActiveBattler].item) == POCKET_BERRIES)
|
||||
gBattlescriptCurrInstr += 7;
|
||||
else
|
||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
|
||||
return;
|
||||
case VARIOUS_CHECK_IF_GRASSY_TERRAIN_HEALS:
|
||||
if ((gStatuses3[gActiveBattler] & (STATUS3_SEMI_INVULNERABLE))
|
||||
|| BATTLER_MAX_HP(gActiveBattler)
|
||||
|
@ -4945,6 +4945,77 @@ static const u8 sSpeedDiffPowerTable[] = {40, 60, 80, 120, 150};
|
||||
static const u8 sHeatCrushPowerTable[] = {40, 40, 60, 80, 100, 120};
|
||||
static const u8 sTrumpCardPowerTable[] = {200, 80, 60, 50, 40};
|
||||
|
||||
const struct TypePower gNaturalGiftTable[] =
|
||||
{
|
||||
[ITEM_TO_BERRY(ITEM_CHERI_BERRY)] = {TYPE_FIRE, 80},
|
||||
[ITEM_TO_BERRY(ITEM_CHESTO_BERRY)] = {TYPE_WATER, 80},
|
||||
[ITEM_TO_BERRY(ITEM_PECHA_BERRY)] = {TYPE_ELECTRIC, 80},
|
||||
[ITEM_TO_BERRY(ITEM_RAWST_BERRY)] = {TYPE_GRASS, 80},
|
||||
[ITEM_TO_BERRY(ITEM_ASPEAR_BERRY)] = {TYPE_ICE, 80},
|
||||
[ITEM_TO_BERRY(ITEM_LEPPA_BERRY)] = {TYPE_FIGHTING, 80},
|
||||
[ITEM_TO_BERRY(ITEM_ORAN_BERRY)] = {TYPE_POISON, 80},
|
||||
[ITEM_TO_BERRY(ITEM_PERSIM_BERRY)] = {TYPE_GROUND, 80},
|
||||
[ITEM_TO_BERRY(ITEM_LUM_BERRY)] = {TYPE_FLYING, 80},
|
||||
[ITEM_TO_BERRY(ITEM_SITRUS_BERRY)] = {TYPE_PSYCHIC, 80},
|
||||
[ITEM_TO_BERRY(ITEM_FIGY_BERRY)] = {TYPE_BUG, 80},
|
||||
[ITEM_TO_BERRY(ITEM_WIKI_BERRY)] = {TYPE_ROCK, 80},
|
||||
[ITEM_TO_BERRY(ITEM_MAGO_BERRY)] = {TYPE_GHOST, 80},
|
||||
[ITEM_TO_BERRY(ITEM_AGUAV_BERRY)] = {TYPE_DRAGON, 80},
|
||||
[ITEM_TO_BERRY(ITEM_IAPAPA_BERRY)] = {TYPE_DARK, 80},
|
||||
[ITEM_TO_BERRY(ITEM_RAZZ_BERRY)] = {TYPE_STEEL, 80},
|
||||
[ITEM_TO_BERRY(ITEM_OCCA_BERRY)] = {TYPE_FIRE, 80},
|
||||
[ITEM_TO_BERRY(ITEM_PASSHO_BERRY)] = {TYPE_WATER, 80},
|
||||
[ITEM_TO_BERRY(ITEM_WACAN_BERRY)] = {TYPE_ELECTRIC, 80},
|
||||
[ITEM_TO_BERRY(ITEM_RINDO_BERRY)] = {TYPE_GRASS, 80},
|
||||
[ITEM_TO_BERRY(ITEM_YACHE_BERRY)] = {TYPE_ICE, 80},
|
||||
[ITEM_TO_BERRY(ITEM_CHOPLE_BERRY)] = {TYPE_FIGHTING, 80},
|
||||
[ITEM_TO_BERRY(ITEM_KEBIA_BERRY)] = {TYPE_POISON, 80},
|
||||
[ITEM_TO_BERRY(ITEM_SHUCA_BERRY)] = {TYPE_GROUND, 80},
|
||||
[ITEM_TO_BERRY(ITEM_COBA_BERRY)] = {TYPE_FLYING, 80},
|
||||
[ITEM_TO_BERRY(ITEM_PAYAPA_BERRY)] = {TYPE_PSYCHIC, 80},
|
||||
[ITEM_TO_BERRY(ITEM_TANGA_BERRY)] = {TYPE_BUG, 80},
|
||||
[ITEM_TO_BERRY(ITEM_CHARTI_BERRY)] = {TYPE_ROCK, 80},
|
||||
[ITEM_TO_BERRY(ITEM_KASIB_BERRY)] = {TYPE_GHOST, 80},
|
||||
[ITEM_TO_BERRY(ITEM_HABAN_BERRY)] = {TYPE_DRAGON, 80},
|
||||
[ITEM_TO_BERRY(ITEM_COLBUR_BERRY)] = {TYPE_DARK, 80},
|
||||
[ITEM_TO_BERRY(ITEM_BABIRI_BERRY)] = {TYPE_STEEL, 80},
|
||||
[ITEM_TO_BERRY(ITEM_CHILAN_BERRY)] = {TYPE_NORMAL, 80},
|
||||
[ITEM_TO_BERRY(ITEM_ROSELI_BERRY)] = {TYPE_FAIRY, 80},
|
||||
[ITEM_TO_BERRY(ITEM_BLUK_BERRY)] = {TYPE_FIRE, 90},
|
||||
[ITEM_TO_BERRY(ITEM_NANAB_BERRY)] = {TYPE_WATER, 90},
|
||||
[ITEM_TO_BERRY(ITEM_WEPEAR_BERRY)] = {TYPE_ELECTRIC, 90},
|
||||
[ITEM_TO_BERRY(ITEM_PINAP_BERRY)] = {TYPE_GRASS, 90},
|
||||
[ITEM_TO_BERRY(ITEM_POMEG_BERRY)] = {TYPE_ICE, 90},
|
||||
[ITEM_TO_BERRY(ITEM_KELPSY_BERRY)] = {TYPE_FIGHTING, 90},
|
||||
[ITEM_TO_BERRY(ITEM_QUALOT_BERRY)] = {TYPE_POISON, 90},
|
||||
[ITEM_TO_BERRY(ITEM_HONDEW_BERRY)] = {TYPE_GROUND, 90},
|
||||
[ITEM_TO_BERRY(ITEM_GREPA_BERRY)] = {TYPE_FLYING, 90},
|
||||
[ITEM_TO_BERRY(ITEM_TAMATO_BERRY)] = {TYPE_PSYCHIC, 90},
|
||||
[ITEM_TO_BERRY(ITEM_CORNN_BERRY)] = {TYPE_BUG, 90},
|
||||
[ITEM_TO_BERRY(ITEM_MAGOST_BERRY)] = {TYPE_ROCK, 90},
|
||||
[ITEM_TO_BERRY(ITEM_RABUTA_BERRY)] = {TYPE_GHOST, 90},
|
||||
[ITEM_TO_BERRY(ITEM_NOMEL_BERRY)] = {TYPE_DRAGON, 90},
|
||||
[ITEM_TO_BERRY(ITEM_SPELON_BERRY)] = {TYPE_DARK, 90},
|
||||
[ITEM_TO_BERRY(ITEM_PAMTRE_BERRY)] = {TYPE_STEEL, 90},
|
||||
[ITEM_TO_BERRY(ITEM_WATMEL_BERRY)] = {TYPE_FIRE, 100},
|
||||
[ITEM_TO_BERRY(ITEM_DURIN_BERRY)] = {TYPE_WATER, 100},
|
||||
[ITEM_TO_BERRY(ITEM_BELUE_BERRY)] = {TYPE_ELECTRIC, 100},
|
||||
[ITEM_TO_BERRY(ITEM_LIECHI_BERRY)] = {TYPE_GRASS, 100},
|
||||
[ITEM_TO_BERRY(ITEM_GANLON_BERRY)] = {TYPE_ICE, 100},
|
||||
[ITEM_TO_BERRY(ITEM_SALAC_BERRY)] = {TYPE_FIGHTING, 100},
|
||||
[ITEM_TO_BERRY(ITEM_PETAYA_BERRY)] = {TYPE_POISON, 100},
|
||||
[ITEM_TO_BERRY(ITEM_APICOT_BERRY)] = {TYPE_GROUND, 100},
|
||||
[ITEM_TO_BERRY(ITEM_LANSAT_BERRY)] = {TYPE_FLYING, 100},
|
||||
[ITEM_TO_BERRY(ITEM_STARF_BERRY)] = {TYPE_PSYCHIC, 100},
|
||||
[ITEM_TO_BERRY(ITEM_ENIGMA_BERRY)] = {TYPE_BUG, 100},
|
||||
[ITEM_TO_BERRY(ITEM_MICLE_BERRY)] = {TYPE_ROCK, 100},
|
||||
[ITEM_TO_BERRY(ITEM_CUSTAP_BERRY)] = {TYPE_GHOST, 100},
|
||||
[ITEM_TO_BERRY(ITEM_JABOCA_BERRY)] = {TYPE_DRAGON, 100},
|
||||
[ITEM_TO_BERRY(ITEM_ROWAP_BERRY)] = {TYPE_DARK, 100},
|
||||
[ITEM_TO_BERRY(ITEM_KEE_BERRY)] = {TYPE_FAIRY, 100},
|
||||
[ITEM_TO_BERRY(ITEM_MARANGA_BERRY)] = {TYPE_DARK, 100},
|
||||
};
|
||||
|
||||
static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef)
|
||||
{
|
||||
u32 i;
|
||||
@ -5015,7 +5086,7 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef)
|
||||
basePower *= 2;
|
||||
break;
|
||||
case EFFECT_NATURAL_GIFT:
|
||||
// todo
|
||||
basePower = gNaturalGiftTable[ITEM_TO_BERRY(gBattleMons[battlerAtk].item)].power;
|
||||
break;
|
||||
case EFFECT_WAKE_UP_SLAP:
|
||||
if (gBattleMons[battlerDef].status1 & STATUS1_SLEEP)
|
||||
|
Loading…
Reference in New Issue
Block a user