This commit is contained in:
ntr 2019-01-13 15:12:24 +11:00
parent 5b98ce151a
commit 6fa3fc043f
5 changed files with 25 additions and 12 deletions

View File

@ -24,10 +24,8 @@ strangle
## NOW ## NOW
* armour and SS * rolls as a drop item
* rolls as a drop item * evasion is a % function of the hp value
* armour and SS the same
* evasion is a % function of the value
## SOON ## SOON
* clean up categories * clean up categories
@ -66,6 +64,11 @@ strangle
* Pixel * Pixel
* Industrial * Industrial
# notables
* prince of peace
* bonus healing / no damage
* fuck magic
# Mechanic Ideas # Mechanic Ideas
teams teams
1v1 2v2 3v3 1v1 2v2 3v3

View File

@ -526,12 +526,20 @@ impl Cryp {
pub fn evade(&self, skill: Skill) -> Option<ResolutionResult> { pub fn evade(&self, skill: Skill) -> Option<ResolutionResult> {
let mut rng = thread_rng(); let mut rng = thread_rng();
let rating = 100 - self.evasion.base; let hp_pct = self.hp.base as f64 / self.stamina.base as f64;
let roll = rng.gen_range(0, 100); let evasion_rating = self.evasion.base as f64 * hp_pct;
match roll > rating { // println!("{:?}", evasion_rating);
if evasion_rating == 0.0 {
return None;
}
let roll = rng.gen_bool(evasion_rating / 100.0);
match roll {
true => Some(ResolutionResult::Evasion { true => Some(ResolutionResult::Evasion {
skill, skill,
evasion_rating: evasion_rating.round(),
}), }),
false => None, false => None,
} }

View File

@ -379,9 +379,9 @@ impl Game {
cast.resolution.speed, source.name, target.name, effect)), cast.resolution.speed, source.name, target.name, effect)),
} }
}, },
ResolutionResult::Evasion { skill: _ } => { ResolutionResult::Evasion { skill: _, evasion_rating } => {
self.log.push(format!("[{:}] {:} {:?} {:} evaded", self.log.push(format!("[{:}] {:} {:?} {:} evaded ({:}%)",
cast.resolution.speed, source.name, cast.skill, target.name)); cast.resolution.speed, source.name, cast.skill, target.name, evasion_rating));
}, },
} }
} }

View File

@ -32,10 +32,12 @@ fn generate_mob(lvl: u8) -> Cryp {
// _ => rng.gen_range(lvl.saturating_sub(2), lvl) // _ => rng.gen_range(lvl.saturating_sub(2), lvl)
// }; // };
return Cryp::new() let mob = Cryp::new()
.named(&name) .named(&name)
.level(lvl) .level(lvl)
.create(); .create();
return mob;
} }
fn quick_game(mob_lvl: u8, team_size: usize) -> Vec<Cryp> { fn quick_game(mob_lvl: u8, team_size: usize) -> Vec<Cryp> {

View File

@ -70,7 +70,7 @@ pub enum ResolutionResult {
Healing { amount: u64, overhealing: u64, category: Category , immunity: Immunity }, Healing { amount: u64, overhealing: u64, category: Category , immunity: Immunity },
Effect { effect: Effect, duration: u8, immunity: Immunity }, Effect { effect: Effect, duration: u8, immunity: Immunity },
Removal { effect: Effect, immunity: Immunity }, Removal { effect: Effect, immunity: Immunity },
Evasion { skill: Skill }, Evasion { skill: Skill, evasion_rating: f64 },
} }
#[derive(Debug,Clone,PartialEq,Serialize,Deserialize)] #[derive(Debug,Clone,PartialEq,Serialize,Deserialize)]