mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-18 01:14:19 +01:00
risky ai script -> c
This commit is contained in:
parent
cd119ed6c3
commit
b2e5760479
@ -3356,36 +3356,8 @@ AI_PreferStrongestMove_End:
|
|||||||
end
|
end
|
||||||
|
|
||||||
AI_Risky:
|
AI_Risky:
|
||||||
if_target_is_ally AI_Ret
|
|
||||||
get_considered_move_effect
|
|
||||||
if_move_flag FLAG_HIGH_CRIT, AI_Risky_RandChance
|
|
||||||
if_not_in_bytes AI_Risky_EffectsToEncourage, AI_Risky_End
|
|
||||||
AI_Risky_RandChance:
|
|
||||||
if_random_less_than 128, AI_Risky_End
|
|
||||||
score +2
|
|
||||||
AI_Risky_End:
|
|
||||||
end
|
end
|
||||||
|
|
||||||
AI_Risky_EffectsToEncourage:
|
|
||||||
.byte EFFECT_SLEEP
|
|
||||||
.byte EFFECT_EXPLOSION
|
|
||||||
.byte EFFECT_MIRROR_MOVE
|
|
||||||
.byte EFFECT_OHKO
|
|
||||||
.byte EFFECT_CONFUSE
|
|
||||||
.byte EFFECT_METRONOME
|
|
||||||
.byte EFFECT_PSYWAVE
|
|
||||||
.byte EFFECT_COUNTER
|
|
||||||
.byte EFFECT_DESTINY_BOND
|
|
||||||
.byte EFFECT_SWAGGER
|
|
||||||
.byte EFFECT_ATTRACT
|
|
||||||
.byte EFFECT_PRESENT
|
|
||||||
.byte EFFECT_ALL_STATS_UP_HIT
|
|
||||||
.byte EFFECT_BELLY_DRUM
|
|
||||||
.byte EFFECT_MIRROR_COAT
|
|
||||||
.byte EFFECT_FOCUS_PUNCH
|
|
||||||
.byte EFFECT_REVENGE
|
|
||||||
.byte EFFECT_TEETER_DANCE
|
|
||||||
.byte -1
|
|
||||||
|
|
||||||
.align 1
|
.align 1
|
||||||
sMovesTable_ProtectMoves:
|
sMovesTable_ProtectMoves:
|
||||||
|
@ -5918,7 +5918,7 @@ static s16 AI_SetupFirstTurn(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
|
|||||||
if (IsTargetingPartner(battlerAtk, battlerDef)
|
if (IsTargetingPartner(battlerAtk, battlerDef)
|
||||||
|| gBattleResults.battleTurnCounter != 0)
|
|| gBattleResults.battleTurnCounter != 0)
|
||||||
return score;
|
return score;
|
||||||
switch (gBattleMoves[AI_THINKING_STRUCT->moveConsidered].effect)
|
switch (gBattleMoves[move].effect)
|
||||||
{
|
{
|
||||||
case EFFECT_ATTACK_UP:
|
case EFFECT_ATTACK_UP:
|
||||||
case EFFECT_DEFENSE_UP:
|
case EFFECT_DEFENSE_UP:
|
||||||
@ -6009,6 +6009,40 @@ static s16 AI_SetupFirstTurn(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
|
|||||||
|
|
||||||
static s16 AI_Risky(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
|
static s16 AI_Risky(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
|
||||||
{
|
{
|
||||||
|
if (IsTargetingPartner(battlerAtk, battlerDef))
|
||||||
|
return score;
|
||||||
|
|
||||||
|
if (TestMoveFlags(move, FLAG_HIGH_CRIT))
|
||||||
|
score += 2;
|
||||||
|
|
||||||
|
switch (gBattleMoves[move].effect)
|
||||||
|
{
|
||||||
|
case EFFECT_SLEEP:
|
||||||
|
case EFFECT_EXPLOSION:
|
||||||
|
case EFFECT_MIRROR_MOVE:
|
||||||
|
case EFFECT_OHKO:
|
||||||
|
case EFFECT_CONFUSE:
|
||||||
|
case EFFECT_METRONOME:
|
||||||
|
case EFFECT_PSYWAVE:
|
||||||
|
case EFFECT_COUNTER:
|
||||||
|
case EFFECT_DESTINY_BOND:
|
||||||
|
case EFFECT_SWAGGER:
|
||||||
|
case EFFECT_ATTRACT:
|
||||||
|
case EFFECT_PRESENT:
|
||||||
|
case EFFECT_ALL_STATS_UP_HIT:
|
||||||
|
case EFFECT_BELLY_DRUM:
|
||||||
|
case EFFECT_MIRROR_COAT:
|
||||||
|
case EFFECT_FOCUS_PUNCH:
|
||||||
|
case EFFECT_REVENGE:
|
||||||
|
case EFFECT_TEETER_DANCE:
|
||||||
|
if (Random() & 1)
|
||||||
|
score += 2;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return score;
|
||||||
}
|
}
|
||||||
|
|
||||||
static s16 AI_PreferStrongestMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
|
static s16 AI_PreferStrongestMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user