[Help] Battle Power

02/11/2014 19:16 littlechris95#1
What would be the best way to reduce an attack by the Battle Power difference between two players, for example:

Player 1 has 370 bp;
Player 2 has 367 bp;

If the attacking player 1 player 2 x attack will be increased.
If the attacking player 2 player 1 x attack will be decreased.

I did like this:

Player 2 attacking Player 1
Quote:
if(attacker.BattlePower < attacked.BattlePower) {
int dif = (attacked.BattlePower - attacker.BattlePower);
float reducePercent = (dif / 100f);
Damage -= (Damage * reducePercent);
}
Player 1 attacking Player2
Quote:
if(attacker.BattlePower > attacked.BattlePower) {
int dif = (attacker.BattlePower - attacked.BattlePower);
float reducePercent = (dif / 100f);
Damage += (Damage * reducePercent);
}
Anyone?

Problem solved!
#Closed