void Attributs::applyAttackRelativeBonnus(Damage &damage) const { for(unsigned i=0; i<damage.getValues().size() ; i++) { for(unsigned a=0 ; a<relativeFightBonus.size() ; a++) { if(damage.getValues().at(i).getType() == relativeFightBonus.at(a).getType() ) { int newDamage = damage.getValues().at(i).getValue(); newDamage += (newDamage * relativeFightBonus.at(a).getValue()) / 100; //one value point -> add 1% damage damage.getValues().at(i).setValue(newDamage); } } } }
void Attributs::applyAttackFixBonnus(Damage &damage) const { for(unsigned i=0; i<damage.getValues().size() ; i++) { int newDamage = damage.getValues().at(i).getValue(); newDamage += fixDamageBonnus; for(unsigned a=0 ; a<fixFightBonus.size() ; a++) { if(damage.getValues().at(i).getType() == fixFightBonus.at(a).getType() ) { newDamage += fixFightBonus.at(a).getValue(); //add fix attack bonnus //exit for loop: (there are only one couple) a = values.size(); } } damage.getValues().at(i).setValue(newDamage); } }
void Attributs::applyDefenseRelativeResistances(Damage &damage) const { for(unsigned i=0; i<damage.getValues().size() ; i++) { for(unsigned a=0 ; a<relativeResistances.size() ; a++) { if(damage.getValues().at(i).getType() == relativeResistances.at(a).getType() ) { int newDamage = damage.getValues().at(i).getValue(); newDamage -= (newDamage * relativeResistances.at(a).getValue()) / 100; //one value point -> add 1% resistances if(newDamage<0) { newDamage = 0; } damage.getValues().at(i).setValue(newDamage); } } } }
void Attributs::applyDefenseFixResistances(Damage &damage) const { for(unsigned i=0; i<damage.getValues().size() ; i++) { for(unsigned a=0 ; a<fixResistances.size() ; a++) { if(damage.getValues().at(i).getType() == fixResistances.at(a).getType() ) { int newDamage = damage.getValues().at(i).getValue(); newDamage -= fixResistances.at(a).getValue(); //add fix attack bonnus if(newDamage<0) { newDamage = 0; } damage.getValues().at(i).setValue(newDamage); } } } }
void Attributs::applyAttackValues(Damage &damage) const { for(unsigned i=0; i<damage.getValues().size() ; i++) { int newDamage = damage.getValues().at(i).getValue(); int damageBonnus = powerBonnus; for(unsigned a=0 ; a<values.size() ; a++) { if(damage.getValues().at(i).getType() == values.at(a).getType() ) { damageBonnus += values.at(a).getValue(); //one value point -> add 1% damage //exit for loop: (there are only one couple) a = values.size(); } } newDamage += newDamage*damageBonnus/100; damage.getValues().at(i).setValue(newDamage); } }