basic core building
This commit is contained in:
parent
f5d022d1d0
commit
af45237701
11 changed files with 146 additions and 11 deletions
|
|
@ -2,7 +2,7 @@
|
|||
#![allow(clippy::type_complexity)]
|
||||
#![allow(clippy::too_many_arguments)]
|
||||
|
||||
use bevy::{audio::Sample, prelude::*};
|
||||
use bevy::prelude::*;
|
||||
|
||||
pub struct CombatPlugin;
|
||||
|
||||
|
|
@ -55,7 +55,11 @@ pub struct Defense {
|
|||
|
||||
impl Defense {
|
||||
pub fn calc_damage(&self, incoming_damage: f32) -> f32 {
|
||||
(incoming_damage - self.amount * 0.5).max(0.0)
|
||||
let min_damage = 0.1;
|
||||
if incoming_damage < min_damage {
|
||||
return 0.;
|
||||
}
|
||||
(incoming_damage - self.amount * 0.5).max(min_damage)
|
||||
}
|
||||
|
||||
pub fn new(amount: f32) -> Self {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue