From 106a89eace1cb4de5f7b45683d14c484c4cfdd90 Mon Sep 17 00:00:00 2001 From: hjk321 <37224753+hjk321@users.noreply.github.com> Date: Sat, 27 Apr 2019 16:41:37 -0600 Subject: Document magic number from atk04_critcalc --- src/battle_script_commands.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/battle_script_commands.c') diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 7e783bef5..f7eed0760 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1276,8 +1276,8 @@ static void atk04_critcalc(void) + 2 * (holdEffect == HOLD_EFFECT_LUCKY_PUNCH && gBattleMons[gBattlerAttacker].species == SPECIES_CHANSEY) + 2 * (holdEffect == HOLD_EFFECT_STICK && gBattleMons[gBattlerAttacker].species == SPECIES_FARFETCHD); - if (critChance > 4) - critChance = 4; + if (critChance > ARRAY_COUNT(sCriticalHitChance) - 1 ) + critChance = ARRAY_COUNT(sCriticalHitChance) - 1; if ((gBattleMons[gBattlerTarget].ability != ABILITY_BATTLE_ARMOR && gBattleMons[gBattlerTarget].ability != ABILITY_SHELL_ARMOR) && !(gStatuses3[gBattlerAttacker] & STATUS3_CANT_SCORE_A_CRIT) -- cgit v1.2.3 From ee4049d93edfeb24a315c40e3d6849278cdb33e5 Mon Sep 17 00:00:00 2001 From: hjk321 <37224753+hjk321@users.noreply.github.com> Date: Thu, 2 May 2019 22:26:11 -0500 Subject: Fix indentation Error --- src/battle_script_commands.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/battle_script_commands.c') diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index f7eed0760..d2496881e 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1277,7 +1277,7 @@ static void atk04_critcalc(void) + 2 * (holdEffect == HOLD_EFFECT_STICK && gBattleMons[gBattlerAttacker].species == SPECIES_FARFETCHD); if (critChance > ARRAY_COUNT(sCriticalHitChance) - 1 ) - critChance = ARRAY_COUNT(sCriticalHitChance) - 1; + critChance = ARRAY_COUNT(sCriticalHitChance) - 1; if ((gBattleMons[gBattlerTarget].ability != ABILITY_BATTLE_ARMOR && gBattleMons[gBattlerTarget].ability != ABILITY_SHELL_ARMOR) && !(gStatuses3[gBattlerAttacker] & STATUS3_CANT_SCORE_A_CRIT) -- cgit v1.2.3 From 26114d45793c14602e7c9f565461bddac1d3fc40 Mon Sep 17 00:00:00 2001 From: hjk321 <37224753+hjk321@users.noreply.github.com> Date: Fri, 3 May 2019 07:56:44 -0500 Subject: Update comparison --- src/battle_script_commands.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/battle_script_commands.c') diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index d2496881e..51b658250 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1276,7 +1276,7 @@ static void atk04_critcalc(void) + 2 * (holdEffect == HOLD_EFFECT_LUCKY_PUNCH && gBattleMons[gBattlerAttacker].species == SPECIES_CHANSEY) + 2 * (holdEffect == HOLD_EFFECT_STICK && gBattleMons[gBattlerAttacker].species == SPECIES_FARFETCHD); - if (critChance > ARRAY_COUNT(sCriticalHitChance) - 1 ) + if (critChance >= ARRAY_COUNT(sCriticalHitChance)) critChance = ARRAY_COUNT(sCriticalHitChance) - 1; if ((gBattleMons[gBattlerTarget].ability != ABILITY_BATTLE_ARMOR && gBattleMons[gBattlerTarget].ability != ABILITY_SHELL_ARMOR) -- cgit v1.2.3 From fe59902b8a0608eafb746222e8e6800cad2fca8b Mon Sep 17 00:00:00 2001 From: huderlem Date: Fri, 3 May 2019 18:17:45 -0500 Subject: Fix indentation --- src/battle_script_commands.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/battle_script_commands.c') diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 51b658250..837fb5bac 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1277,7 +1277,7 @@ static void atk04_critcalc(void) + 2 * (holdEffect == HOLD_EFFECT_STICK && gBattleMons[gBattlerAttacker].species == SPECIES_FARFETCHD); if (critChance >= ARRAY_COUNT(sCriticalHitChance)) - critChance = ARRAY_COUNT(sCriticalHitChance) - 1; + critChance = ARRAY_COUNT(sCriticalHitChance) - 1; if ((gBattleMons[gBattlerTarget].ability != ABILITY_BATTLE_ARMOR && gBattleMons[gBattlerTarget].ability != ABILITY_SHELL_ARMOR) && !(gStatuses3[gBattlerAttacker] & STATUS3_CANT_SCORE_A_CRIT) -- cgit v1.2.3 From 33979f0fa69001b41668726828603e22326694c1 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Tue, 14 May 2019 15:22:16 +0200 Subject: use ability num instead of alt ability --- src/battle_script_commands.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/battle_script_commands.c') diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 837fb5bac..d79bfb0db 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -4906,7 +4906,7 @@ static void atk4D_switchindataupdate(void) gBattleMons[gActiveBattler].type1 = gBaseStats[gBattleMons[gActiveBattler].species].type1; gBattleMons[gActiveBattler].type2 = gBaseStats[gBattleMons[gActiveBattler].species].type2; - gBattleMons[gActiveBattler].ability = GetAbilityBySpecies(gBattleMons[gActiveBattler].species, gBattleMons[gActiveBattler].altAbility); + gBattleMons[gActiveBattler].ability = GetAbilityBySpecies(gBattleMons[gActiveBattler].species, gBattleMons[gActiveBattler].abilityNum); // check knocked off item i = GetBattlerSide(gActiveBattler); @@ -8622,7 +8622,7 @@ static void atkAE_healpartystatus(void) for (i = 0; i < PARTY_SIZE; i++) { u16 species = GetMonData(&party[i], MON_DATA_SPECIES2); - u8 abilityBit = GetMonData(&party[i], MON_DATA_ALT_ABILITY); + u8 abilityNum = GetMonData(&party[i], MON_DATA_ABILITY_NUM); if (species != SPECIES_NONE && species != SPECIES_EGG) { @@ -8635,7 +8635,7 @@ static void atkAE_healpartystatus(void) && !(gAbsentBattlerFlags & gBitTable[gActiveBattler])) ability = gBattleMons[gActiveBattler].ability; else - ability = GetAbilityBySpecies(species, abilityBit); + ability = GetAbilityBySpecies(species, abilityNum); if (ability != ABILITY_SOUNDPROOF) toHeal |= (1 << i); @@ -9844,7 +9844,7 @@ static void atkE5_pickup(void) species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2); heldItem = GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM); - if (GetMonData(&gPlayerParty[i], MON_DATA_ALT_ABILITY)) + if (GetMonData(&gPlayerParty[i], MON_DATA_ABILITY_NUM)) ability = gBaseStats[species].ability2; else ability = gBaseStats[species].ability1; @@ -9867,7 +9867,7 @@ static void atkE5_pickup(void) species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2); heldItem = GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM); - if (GetMonData(&gPlayerParty[i], MON_DATA_ALT_ABILITY)) + if (GetMonData(&gPlayerParty[i], MON_DATA_ABILITY_NUM)) ability = gBaseStats[species].ability2; else ability = gBaseStats[species].ability1; -- cgit v1.2.3 From 4ae1e014bc799795c770564fb97f36c76913e5c8 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Tue, 14 May 2019 15:42:55 +0200 Subject: Change abilities in base stats to array --- src/battle_script_commands.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/battle_script_commands.c') diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index d79bfb0db..5016a3a58 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -9845,9 +9845,9 @@ static void atkE5_pickup(void) heldItem = GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM); if (GetMonData(&gPlayerParty[i], MON_DATA_ABILITY_NUM)) - ability = gBaseStats[species].ability2; + ability = gBaseStats[species].abilities[1]; else - ability = gBaseStats[species].ability1; + ability = gBaseStats[species].abilities[0]; if (ability == ABILITY_PICKUP && species != 0 @@ -9868,9 +9868,9 @@ static void atkE5_pickup(void) heldItem = GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM); if (GetMonData(&gPlayerParty[i], MON_DATA_ABILITY_NUM)) - ability = gBaseStats[species].ability2; + ability = gBaseStats[species].abilities[1]; else - ability = gBaseStats[species].ability1; + ability = gBaseStats[species].abilities[0]; if (ability == ABILITY_PICKUP && species != 0 -- cgit v1.2.3