Crit changes accomodated to ai scripts

This commit is contained in:
DizzyEggg 2018-07-14 12:54:12 +02:00
parent 2293d1ddbc
commit 3a10ae9a94
6 changed files with 35 additions and 22 deletions

View file

@ -467,8 +467,10 @@
.byte \bank
.endm
.macro nullsub_52
.macro if_move_flag flag jumpptr
.byte 0x52
.hword \flag
.word \jumpptr
.endm
.macro nullsub_53

View file

@ -356,7 +356,7 @@
.4byte \param0
.endm
.macro jumpiftype2
.macro nop_42
.byte 0x42
.endm

View file

@ -656,6 +656,7 @@ Score_Plus10:
AI_TryToFaint:
if_target_is_ally AI_Ret
if_effect EFFECT_HIT, AI_CV_Hit
if_effect EFFECT_SLEEP, AI_CV_Sleep
if_effect EFFECT_ABSORB, AI_CV_Absorb
if_effect EFFECT_EXPLOSION, AI_CV_SelfKO
@ -688,7 +689,6 @@ AI_TryToFaint:
if_effect EFFECT_RAZOR_WIND, AI_CV_ChargeUpMove
if_effect EFFECT_SUPER_FANG, AI_CV_SuperFang
if_effect EFFECT_TRAP, AI_CV_Trap
if_effect EFFECT_HIGH_CRITICAL, AI_CV_HighCrit
if_effect EFFECT_CONFUSE, AI_CV_Confuse
if_effect EFFECT_ATTACK_UP_2, AI_CV_AttackUp
if_effect EFFECT_DEFENSE_UP_2, AI_CV_DefenseUp
@ -768,18 +768,20 @@ AI_TryToFaint:
if_effect EFFECT_IMPRISON, AI_CV_Imprison
if_effect EFFECT_REFRESH, AI_CV_Refresh
if_effect EFFECT_SNATCH, AI_CV_Snatch
if_effect EFFECT_BLAZE_KICK, AI_CV_HighCrit
if_effect EFFECT_MUD_SPORT, AI_CV_MudSport
if_effect EFFECT_OVERHEAT, AI_CV_Overheat
if_effect EFFECT_TICKLE, AI_CV_DefenseDown
if_effect EFFECT_COSMIC_POWER, AI_CV_SpDefUp
if_effect EFFECT_BULK_UP, AI_CV_DefenseUp
if_effect EFFECT_POISON_TAIL, AI_CV_HighCrit
if_effect EFFECT_WATER_SPORT, AI_CV_WaterSport
if_effect EFFECT_CALM_MIND, AI_CV_SpDefUp
if_effect EFFECT_DRAGON_DANCE, AI_CV_DragonDance
end
AI_CV_Hit:
if_move_flag FLAG_HIGH_CRIT AI_CV_HighCrit
end
AI_CV_Sleep: @ 82DCA92
if_has_move_with_effect AI_TARGET, EFFECT_DREAM_EATER, AI_CV_SleepEncourageSlpDamage
if_has_move_with_effect AI_TARGET, EFFECT_NIGHTMARE, AI_CV_SleepEncourageSlpDamage
@ -2771,7 +2773,7 @@ BattleAIScript_82DDE57:
AI_TryToFaint_TryToEncourageQuickAttack:
if_effect EFFECT_EXPLOSION, AI_TryToFaint_End
if_not_effect EFFECT_QUICK_ATTACK, AI_TryToFaint_ScoreUp4
if_move_flag FLAG_HIGH_CRIT AI_TryToFaint_ScoreUp4
score +2
AI_TryToFaint_ScoreUp4:
@ -2863,7 +2865,9 @@ AI_PreferStrongestMove_End:
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
@ -2875,7 +2879,6 @@ AI_Risky_EffectsToEncourage:
.byte EFFECT_EXPLOSION
.byte EFFECT_MIRROR_MOVE
.byte EFFECT_OHKO
.byte EFFECT_HIGH_CRITICAL
.byte EFFECT_CONFUSE
.byte EFFECT_METRONOME
.byte EFFECT_PSYWAVE

View file

@ -78,4 +78,18 @@
#define STAT_ACC 6 // only in battles
#define STAT_EVASION 7 // only in battles
// Move flags.
#define FLAG_MAKES_CONTACT 0x1
#define FLAG_PROTECT_AFFECTED 0x2
#define FLAG_MAGICCOAT_AFFECTED 0x4
#define FLAG_SNATCH_AFFECTED 0x8
#define FLAG_MIRROR_MOVE_AFFECTED 0x10
#define FLAG_KINGSROCK_AFFECTED 0x20
#define FLAG_HIGH_CRIT 0x40
// Split defines.
#define SPLIT_PHYSICAL 0x0
#define SPLIT_SPECIAL 0x1
#define SPLIT_STATUS 0x2
#endif // GUARD_CONSTANTS_POKEMON_H

View file

@ -367,18 +367,6 @@ struct BattleMove
u8 split;
};
#define FLAG_MAKES_CONTACT 0x1
#define FLAG_PROTECT_AFFECTED 0x2
#define FLAG_MAGICCOAT_AFFECTED 0x4
#define FLAG_SNATCH_AFFECTED 0x8
#define FLAG_MIRROR_MOVE_AFFECTED 0x10
#define FLAG_KINGSROCK_AFFECTED 0x20
#define FLAG_HIGH_CRIT 0x40
#define SPLIT_PHYSICAL 0x0
#define SPLIT_SPECIAL 0x1
#define SPLIT_STATUS 0x2
struct SpindaSpot
{
u8 x, y;

View file

@ -135,7 +135,7 @@ static void BattleAICmd_get_move_type_from_result(void);
static void BattleAICmd_get_move_power_from_result(void);
static void BattleAICmd_get_move_effect_from_result(void);
static void BattleAICmd_get_protect_count(void);
static void BattleAICmd_nullsub_52(void);
static void BattleAICmd_if_move_flag(void);
static void BattleAICmd_nullsub_53(void);
static void BattleAICmd_nullsub_54(void);
static void BattleAICmd_nullsub_55(void);
@ -244,7 +244,7 @@ static const BattleAICmdFunc sBattleAICmdTable[] =
BattleAICmd_get_move_power_from_result, // 0x4F
BattleAICmd_get_move_effect_from_result, // 0x50
BattleAICmd_get_protect_count, // 0x51
BattleAICmd_nullsub_52, // 0x52
BattleAICmd_if_move_flag, // 0x52
BattleAICmd_nullsub_53, // 0x53
BattleAICmd_nullsub_54, // 0x54
BattleAICmd_nullsub_55, // 0x55
@ -2123,8 +2123,14 @@ static void BattleAICmd_get_protect_count(void)
gAIScriptPtr += 2;
}
static void BattleAICmd_nullsub_52(void)
static void BattleAICmd_if_move_flag(void)
{
u16 flag = T1_READ_16(gAIScriptPtr + 1);
if (gBattleMoves[AI_THINKING_STRUCT->moveConsidered].flags & flag)
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 3);
else
gAIScriptPtr += 7;
}
static void BattleAICmd_nullsub_53(void)