summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDizzyEggg <jajkodizzy@wp.pl>2018-08-16 22:46:02 +0200
committerDizzyEggg <jajkodizzy@wp.pl>2018-08-16 22:46:02 +0200
commit7669a94f0d01c0a825d2ae48c12adef0be445d81 (patch)
treeb3e551803aa4b64041e9aa406df993deaaaaea33 /src
parente2f5e7344593c980b1fbce0a67ab4d57ff76fcd7 (diff)
this function is driving me insane
Diffstat (limited to 'src')
-rw-r--r--src/battle_frontier_1.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/src/battle_frontier_1.c b/src/battle_frontier_1.c
index 3c97215e3..04faad6cd 100644
--- a/src/battle_frontier_1.c
+++ b/src/battle_frontier_1.c
@@ -1466,10 +1466,9 @@ s32 sub_818FEB4(s32 *arr, bool8 arg1)
return bits;
}
-/*
s32 sub_818FFC0(s32 move, s32 species, s32 arg2)
{
- u8 type1, type2, ability, moveType;
+ s32 type1, type2, ability, moveType;
s32 i = 0;
s32 typePower = 20;
@@ -1488,22 +1487,25 @@ s32 sub_818FFC0(s32 move, s32 species, s32 arg2)
}
else
{
- while (TYPE_EFFECT_ATK_TYPE(i) != TYPE_ENDTABLE)
+ while (gTypeEffectiveness[i + 0] != TYPE_ENDTABLE)
{
- if (TYPE_EFFECT_ATK_TYPE(i) == TYPE_FORESIGHT)
+ if (gTypeEffectiveness[i + 0] == TYPE_FORESIGHT)
{
i += 3;
- continue;
}
- else if (TYPE_EFFECT_ATK_TYPE(i) == moveType)
+ else
{
- // BUG: * 2 is not necessary and makes the condition always false if the ability is wonder guard.
- if (TYPE_EFFECT_DEF_TYPE(i) == type1 && (ability != ABILITY_WONDER_GUARD || TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_SUPER_EFFECTIVE * 2))
- typePower = (TYPE_EFFECT_MULTIPLIER(i) * typePower) / 10;
- if (TYPE_EFFECT_DEF_TYPE(i) == type2 && type1 != type2 && (ability != ABILITY_WONDER_GUARD || TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_SUPER_EFFECTIVE * 2))
- typePower = (TYPE_EFFECT_MULTIPLIER(i) * typePower) / 10;
+ u8 val = gTypeEffectiveness[i + 0];
+ if (val == moveType)
+ {
+ // BUG: * 2 is not necessary and makes the condition always false if the ability is wonder guard.
+ if (gTypeEffectiveness[i + 1] == type1 && (ability != ABILITY_WONDER_GUARD || gTypeEffectiveness[i + 2] == TYPE_MUL_SUPER_EFFECTIVE * 2))
+ typePower = (gTypeEffectiveness[i + 2] * typePower) / 10;
+ if (gTypeEffectiveness[i + 1] == type2 && type1 != type2 && (ability != ABILITY_WONDER_GUARD || gTypeEffectiveness[i + 2] == TYPE_MUL_SUPER_EFFECTIVE * 2))
+ typePower = (gTypeEffectiveness[i + 2] * typePower) / 10;
+ }
+ i += 3;
}
- i += 3;
}
}
@@ -1580,4 +1582,4 @@ s32 sub_818FFC0(s32 move, s32 species, s32 arg2)
}
return typePower;
-}*/
+}