Multiply level to statistics in ability damage
This commit is contained in:
parent
a629bc666b
commit
27fc2fc1ea
1 changed files with 3 additions and 3 deletions
|
@ -29,7 +29,7 @@ pub trait Ability: Send + Sync + Clone + Default {
|
||||||
fn mana_cost(&self) -> u32;
|
fn mana_cost(&self) -> u32;
|
||||||
fn mana_cost_per_level(&self) -> u32;
|
fn mana_cost_per_level(&self) -> u32;
|
||||||
fn damage_type(&self) -> DamageType;
|
fn damage_type(&self) -> DamageType;
|
||||||
fn base_damage(&self, level: u32) -> u32;
|
fn base_damage(&self) -> u32;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||||
|
@ -246,7 +246,7 @@ impl<A: Ability> AbilityBook<A> {
|
||||||
|
|
||||||
pub fn damage(&self, statistics: &Statistics) -> u32 {
|
pub fn damage(&self, statistics: &Statistics) -> u32 {
|
||||||
// calculate damage of base ability
|
// calculate damage of base ability
|
||||||
let ability_base_damage = self.ability.base_damage(self.level);
|
let ability_base_damage = self.ability.base_damage();
|
||||||
|
|
||||||
// get bonus damage from statistics
|
// get bonus damage from statistics
|
||||||
let stats_damage = match self.ability.damage_type() {
|
let stats_damage = match self.ability.damage_type() {
|
||||||
|
@ -260,7 +260,7 @@ impl<A: Ability> AbilityBook<A> {
|
||||||
let addon_damage = self.addons.damage() * self.level;
|
let addon_damage = self.addons.damage() * self.level;
|
||||||
|
|
||||||
// sum up
|
// sum up
|
||||||
ability_base_damage + stats_damage + addon_damage
|
ability_base_damage + (stats_damage * self.level) + addon_damage
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn into_persistent(&self) -> String {
|
pub fn into_persistent(&self) -> String {
|
||||||
|
|
Loading…
Reference in a new issue