I can’t figure out why at run-time this code isn’t working. I’m using the following code to calculate damage:
public int CalculateAttackDamage(BaseMove usedMove, int level, int attack, int defense, Types.TypesList attackersType01, Types.TypesList attackersType02,
Types.TypesList targetType01, Types.TypesList targetType02, int attackersBaseSPD){
baseDamage = usedMove.MovePower;
SetModifier(usedMove.MoveType, attackersType01, attackersType02, targetType01, targetType02, attackersBaseSPD);
return (int)((((2 * level + 10) / 250) * (attack / defense) * baseDamage + 2) * modifier);
}
And this is where I’m calling that method to set the damage to be applied:
if(playerUsedMove.MoveCategory == MoveCategories.MoveCategoriesList.PHYSICAL){
totalPlayerDamage = battleCalcScript.CalculateAttackDamage(playerUsedMove, playerLVL, playerCurATK, enemyCurDEF, playerType01, playerType02,
enemyType01, enemyType02, playerBaseSPD);
}
The problem I’m having is that at run-time it’s always returning 1. I’ve done several Debug.Log’s to see if it’s actually retrieving the correct values for the variables in the parameters and it is…it’s just always calculating to 1 no matter what.