mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-13 15:13:42 +01:00
Fix powder and resist berry string
This commit is contained in:
parent
e9829c16c4
commit
269f573297
@ -227,15 +227,15 @@
|
||||
.byte \battler
|
||||
.endm
|
||||
|
||||
.macro if_equal_ param0:req, param1:req
|
||||
.macro if_equal_u32 param0:req, param1:req
|
||||
.byte 0x26
|
||||
.byte \param0
|
||||
.4byte \param0
|
||||
.4byte \param1
|
||||
.endm
|
||||
|
||||
.macro if_not_equal_ param0:req, param1:req
|
||||
.macro if_not_equal_u32 param0:req, param1:req
|
||||
.byte 0x27
|
||||
.byte \param0
|
||||
.4byte \param0
|
||||
.4byte \param1
|
||||
.endm
|
||||
|
||||
@ -620,6 +620,13 @@
|
||||
.4byte \ptr
|
||||
.endm
|
||||
|
||||
.macro if_has_move_with_type battler:req, type:req, ptr:req
|
||||
.byte 0x6D
|
||||
.byte \battler
|
||||
.byte \type
|
||||
.4byte \ptr
|
||||
.endm
|
||||
|
||||
@ useful script macros
|
||||
.macro if_has_physical_move battler:req, ptr:req
|
||||
if_has_move_with_split \battler, SPLIT_PHYSICAL, \ptr
|
||||
|
@ -76,17 +76,17 @@ CheckIfSoundproofCancelsMove:
|
||||
|
||||
CheckIfVoltAbsorbCancelsElectric: @ 82DBFBD
|
||||
get_curr_move_type
|
||||
if_equal_ TYPE_ELECTRIC, AI_CheckBadMove_CheckEffect
|
||||
if_equal TYPE_ELECTRIC, AI_CheckBadMove_CheckEffect
|
||||
goto AI_CheckBadMove_CheckEffect
|
||||
|
||||
CheckIfWaterAbsorbCancelsWater: @ 82DBFCA
|
||||
get_curr_move_type
|
||||
if_equal_ TYPE_WATER, Score_Minus12
|
||||
if_equal TYPE_WATER, Score_Minus12
|
||||
goto AI_CheckBadMove_CheckEffect
|
||||
|
||||
CheckIfFlashFireCancelsFire: @ 82DBFD7
|
||||
get_curr_move_type
|
||||
if_equal_ TYPE_FIRE, Score_Minus12
|
||||
if_equal TYPE_FIRE, Score_Minus12
|
||||
goto AI_CheckBadMove_CheckEffect
|
||||
|
||||
CheckIfWonderGuardCancelsMove: @ 82DBFE4
|
||||
@ -95,7 +95,7 @@ CheckIfWonderGuardCancelsMove: @ 82DBFE4
|
||||
|
||||
CheckIfLevitateCancelsGroundMove: @ 82DBFEF
|
||||
get_curr_move_type
|
||||
if_equal_ TYPE_GROUND, Score_Minus10
|
||||
if_equal TYPE_GROUND, Score_Minus10
|
||||
|
||||
AI_CheckBadMove_CheckEffect: @ 82DC045
|
||||
if_effect EFFECT_SLEEP, AI_CBM_Sleep
|
||||
@ -250,6 +250,13 @@ AI_CheckBadMove_CheckEffect: @ 82DC045
|
||||
if_effect EFFECT_LAST_RESORT, AI_CBM_LastResort
|
||||
if_effect EFFECT_BELCH, AI_CBM_Belch
|
||||
if_effect EFFECT_DO_NOTHING, Score_Minus8
|
||||
if_effect EFFECT_POWDER, AI_CBM_Powder
|
||||
end
|
||||
|
||||
AI_CBM_Powder:
|
||||
if_type AI_TARGET, TYPE_FIRE, AI_Ret
|
||||
if_has_move_with_type AI_TARGET, TYPE_FIRE, AI_Ret
|
||||
score -5
|
||||
end
|
||||
|
||||
AI_CBM_Belch:
|
||||
@ -1029,6 +1036,35 @@ AI_CheckViability:
|
||||
if_effect EFFECT_WATER_SPORT, AI_CV_WaterSport
|
||||
if_effect EFFECT_CALM_MIND, AI_CV_SpDefUp
|
||||
if_effect EFFECT_DRAGON_DANCE, AI_CV_DragonDance
|
||||
if_effect EFFECT_POWDER, AI_CV_Powder
|
||||
end
|
||||
|
||||
AI_CV_Powder:
|
||||
if_type AI_TARGET, TYPE_FIRE, AI_CV_Powder2
|
||||
if_has_move_with_type AI_TARGET, TYPE_FIRE, AI_CV_Powder2
|
||||
score -2
|
||||
end
|
||||
AI_CV_Powder2:
|
||||
is_first_turn_for AI_TARGET
|
||||
if_equal 0, AI_CV_Powder3
|
||||
if_random_less_than 100, AI_CV_Powder3
|
||||
score +1
|
||||
AI_CV_Powder3:
|
||||
if_type AI_USER, TYPE_BUG, AI_CV_Powder4
|
||||
if_type AI_USER, TYPE_GRASS, AI_CV_Powder4
|
||||
if_no_type AI_USER, TYPE_STEEL, AI_CV_Powder5
|
||||
AI_CV_Powder4:
|
||||
score +1
|
||||
AI_CV_Powder5:
|
||||
get_last_used_bank_move AI_USER
|
||||
if_equal_u32 MOVE_POWDER, AI_CV_Powder6
|
||||
if_random_less_than 150, Score_Minus1
|
||||
if_random_less_than 200, AI_Ret
|
||||
score +2
|
||||
end
|
||||
AI_CV_Powder6:
|
||||
if_random_less_than 136, Score_Minus2
|
||||
score +1
|
||||
end
|
||||
|
||||
AI_CV_Hit:
|
||||
|
@ -93,8 +93,8 @@ static void BattleAICmd_get_type(void);
|
||||
static void BattleAICmd_get_considered_move_power(void);
|
||||
static void BattleAICmd_get_how_powerful_move_is(void);
|
||||
static void BattleAICmd_get_last_used_battler_move(void);
|
||||
static void BattleAICmd_if_equal_(void);
|
||||
static void BattleAICmd_if_not_equal_(void);
|
||||
static void BattleAICmd_if_equal_u32(void);
|
||||
static void BattleAICmd_if_not_equal_u32(void);
|
||||
static void BattleAICmd_if_user_goes(void);
|
||||
static void BattleAICmd_if_cant_use_belch(void);
|
||||
static void BattleAICmd_nullsub_2A(void);
|
||||
@ -164,6 +164,7 @@ static void BattleAICmd_if_has_move_with_split(void);
|
||||
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);
|
||||
|
||||
// ewram
|
||||
EWRAM_DATA const u8 *gAIScriptPtr = NULL;
|
||||
@ -212,8 +213,8 @@ static const BattleAICmdFunc sBattleAICmdTable[] =
|
||||
BattleAICmd_get_considered_move_power, // 0x23
|
||||
BattleAICmd_get_how_powerful_move_is, // 0x24
|
||||
BattleAICmd_get_last_used_battler_move, // 0x25
|
||||
BattleAICmd_if_equal_, // 0x26
|
||||
BattleAICmd_if_not_equal_, // 0x27
|
||||
BattleAICmd_if_equal_u32, // 0x26
|
||||
BattleAICmd_if_not_equal_u32, // 0x27
|
||||
BattleAICmd_if_user_goes, // 0x28
|
||||
BattleAICmd_if_cant_use_belch, // 0x29
|
||||
BattleAICmd_nullsub_2A, // 0x2A
|
||||
@ -283,6 +284,7 @@ static const BattleAICmdFunc sBattleAICmdTable[] =
|
||||
BattleAICmd_if_has_no_move_with_split, // 0x6A
|
||||
BattleAICmd_if_physical_moves_unusable, // 0x6B
|
||||
BattleAICmd_if_ai_can_go_down, // 0x6C
|
||||
BattleAICmd_if_has_move_with_type, // 0x6D
|
||||
};
|
||||
|
||||
static const u16 sDiscouragedPowerfulMoveEffects[] =
|
||||
@ -1422,20 +1424,20 @@ static void BattleAICmd_get_last_used_battler_move(void)
|
||||
gAIScriptPtr += 2;
|
||||
}
|
||||
|
||||
static void BattleAICmd_if_equal_(void) // Same as if_equal.
|
||||
static void BattleAICmd_if_equal_u32(void)
|
||||
{
|
||||
if (gAIScriptPtr[1] == AI_THINKING_STRUCT->funcResult)
|
||||
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 2);
|
||||
if (T1_READ_32(&gAIScriptPtr[1]) == AI_THINKING_STRUCT->funcResult)
|
||||
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 5);
|
||||
else
|
||||
gAIScriptPtr += 6;
|
||||
gAIScriptPtr += 9;
|
||||
}
|
||||
|
||||
static void BattleAICmd_if_not_equal_(void) // Same as if_not_equal.
|
||||
static void BattleAICmd_if_not_equal_u32(void)
|
||||
{
|
||||
if (gAIScriptPtr[1] != AI_THINKING_STRUCT->funcResult)
|
||||
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 2);
|
||||
if (T1_READ_32(&gAIScriptPtr[1]) != AI_THINKING_STRUCT->funcResult)
|
||||
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 5);
|
||||
else
|
||||
gAIScriptPtr += 6;
|
||||
gAIScriptPtr += 9;
|
||||
}
|
||||
|
||||
static void BattleAICmd_if_user_goes(void)
|
||||
@ -2686,3 +2688,30 @@ static void BattleAICmd_if_cant_use_belch(void)
|
||||
else
|
||||
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 2);
|
||||
}
|
||||
|
||||
static void BattleAICmd_if_has_move_with_type(void)
|
||||
{
|
||||
u32 i, moveType, battler = BattleAI_GetWantedBattler(gAIScriptPtr[1]);
|
||||
u16 *moves;
|
||||
|
||||
if (IsBattlerAIControlled(battler))
|
||||
moves = gBattleMons[battler].moves;
|
||||
else
|
||||
moves = BATTLE_HISTORY->usedMoves[battler].moves;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (moves[i] == MOVE_NONE)
|
||||
continue;
|
||||
|
||||
SetTypeBeforeUsingMove(moves[i], battler);
|
||||
GET_MOVE_TYPE(moves[i], moveType);
|
||||
if (moveType == gAIScriptPtr[2])
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == 4)
|
||||
gAIScriptPtr += 7;
|
||||
else
|
||||
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 3);
|
||||
}
|
||||
|
@ -1527,6 +1527,7 @@ END:
|
||||
{
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_BerryReduceDmg;
|
||||
gLastUsedItem = gBattleMons[gBattlerTarget].item;
|
||||
}
|
||||
if (gSpecialStatuses[gBattlerAttacker].gemBoost
|
||||
&& !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
||||
@ -1534,6 +1535,7 @@ END:
|
||||
{
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_GemActivates;
|
||||
gLastUsedItem = gBattleMons[gBattlerAttacker].item;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2367,6 +2367,7 @@ u8 AtkCanceller_UnableToUseMove(void)
|
||||
gProtectStructs[gBattlerAttacker].powderSelfDmg = 1;
|
||||
gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 4;
|
||||
gBattlescriptCurrInstr = BattleScript_MoveUsedPowder;
|
||||
effect = 1;
|
||||
}
|
||||
}
|
||||
gBattleStruct->atkCancellerTracker++;
|
||||
|
Loading…
x
Reference in New Issue
Block a user