evasion
This commit is contained in:
parent
5b98ce151a
commit
6fa3fc043f
@ -24,10 +24,8 @@ strangle
|
||||
|
||||
|
||||
## NOW
|
||||
* armour and SS
|
||||
* rolls as a drop item
|
||||
* armour and SS the same
|
||||
* evasion is a % function of the value
|
||||
* rolls as a drop item
|
||||
* evasion is a % function of the hp value
|
||||
|
||||
## SOON
|
||||
* clean up categories
|
||||
@ -66,6 +64,11 @@ strangle
|
||||
* Pixel
|
||||
* Industrial
|
||||
|
||||
# notables
|
||||
* prince of peace
|
||||
* bonus healing / no damage
|
||||
* fuck magic
|
||||
|
||||
# Mechanic Ideas
|
||||
teams
|
||||
1v1 2v2 3v3
|
||||
|
||||
@ -526,12 +526,20 @@ impl Cryp {
|
||||
|
||||
pub fn evade(&self, skill: Skill) -> Option<ResolutionResult> {
|
||||
let mut rng = thread_rng();
|
||||
let rating = 100 - self.evasion.base;
|
||||
let roll = rng.gen_range(0, 100);
|
||||
let hp_pct = self.hp.base as f64 / self.stamina.base as f64;
|
||||
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 {
|
||||
skill,
|
||||
evasion_rating: evasion_rating.round(),
|
||||
}),
|
||||
false => None,
|
||||
}
|
||||
|
||||
@ -379,9 +379,9 @@ impl Game {
|
||||
cast.resolution.speed, source.name, target.name, effect)),
|
||||
}
|
||||
},
|
||||
ResolutionResult::Evasion { skill: _ } => {
|
||||
self.log.push(format!("[{:}] {:} {:?} {:} evaded",
|
||||
cast.resolution.speed, source.name, cast.skill, target.name));
|
||||
ResolutionResult::Evasion { skill: _, evasion_rating } => {
|
||||
self.log.push(format!("[{:}] {:} {:?} {:} evaded ({:}%)",
|
||||
cast.resolution.speed, source.name, cast.skill, target.name, evasion_rating));
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,10 +32,12 @@ fn generate_mob(lvl: u8) -> Cryp {
|
||||
// _ => rng.gen_range(lvl.saturating_sub(2), lvl)
|
||||
// };
|
||||
|
||||
return Cryp::new()
|
||||
let mob = Cryp::new()
|
||||
.named(&name)
|
||||
.level(lvl)
|
||||
.create();
|
||||
|
||||
return mob;
|
||||
}
|
||||
|
||||
fn quick_game(mob_lvl: u8, team_size: usize) -> Vec<Cryp> {
|
||||
|
||||
@ -70,7 +70,7 @@ pub enum ResolutionResult {
|
||||
Healing { amount: u64, overhealing: u64, category: Category , immunity: Immunity },
|
||||
Effect { effect: Effect, duration: u8, immunity: Immunity },
|
||||
Removal { effect: Effect, immunity: Immunity },
|
||||
Evasion { skill: Skill },
|
||||
Evasion { skill: Skill, evasion_rating: f64 },
|
||||
}
|
||||
|
||||
#[derive(Debug,Clone,PartialEq,Serialize,Deserialize)]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user