mob names

This commit is contained in:
ntr 2019-06-01 14:04:24 +10:00
parent c921e790c9
commit 5a36540615

View File

@ -1,35 +1,17 @@
use uuid::Uuid; use uuid::Uuid;
use rand::prelude::*;
use rand::distributions::Alphanumeric;
use std::iter; use std::iter;
use construct::{Construct}; use construct::{Construct};
use skill::{Skill}; use names::{name};
pub fn generate_mob() -> Construct { pub fn generate_mob() -> Construct {
let mut rng = thread_rng();
let name: String = iter::repeat(())
.map(|()| rng.sample(Alphanumeric))
.take(8)
.collect();
let mob = Construct::new() let mob = Construct::new()
.named(&name); .named(&name());
return mob; return mob;
} }
// fn quick_game(player_size: usize) -> Vec<Construct> {
// iter::repeat_with(||
// generate_mob()
// .set_account(Uuid::nil())
// .learn(Skill::Attack))
// .take(player_size)
// .collect::<Vec<Construct>>()
// }
pub fn instance_mobs(player_id: Uuid) -> Vec<Construct> { pub fn instance_mobs(player_id: Uuid) -> Vec<Construct> {
iter::repeat_with(|| iter::repeat_with(||
generate_mob() generate_mob()
@ -38,89 +20,3 @@ pub fn instance_mobs(player_id: Uuid) -> Vec<Construct> {
.take(3) .take(3)
.collect::<Vec<Construct>>() .collect::<Vec<Construct>>()
} }
// fn zone_3v2_attack(player_lvl: u8) -> Vec<Construct> {
// let x = Construct::new()
// .named(&"hench".to_string())
// .learn(Skill::Attack);
// let y = Construct::new()
// .named(&"bench".to_string())
// .learn(Skill::Attack);
// return vec![x, y];
// }
// fn zone_2v2_caster(player_lvl: u8) -> Vec<Construct> {
// let x = Construct::new()
// .named(&"robe".to_string())
// .learn(Skill::Blast);
// let y = Construct::new()
// .named(&"wizard hat".to_string())
// .learn(Skill::Blast);
// return vec![x, y];
// }
// fn zone_3v3_melee_miniboss(player_lvl: u8) -> Vec<Construct> {
// let x = Construct::new()
// .named(&"jungle juice".to_string())
// .learn(Skill::Attack);
// let y = Construct::new()
// .named(&"bamboo basher".to_string())
// .learn(Skill::Attack)
// .learn(Skill::Stun);
// let z = Construct::new()
// .named(&"lemongrass tea".to_string())
// .learn(Skill::Attack);
// return vec![x, y, z];
// }
// fn zone_3v3_healer_boss(player_lvl: u8) -> Vec<Construct> {
// let x = Construct::new()
// .named(&"coinage".to_string())
// .learn(Skill::Attack)
// .learn(Skill::Parry)
// .learn(Skill::Block);
// let y = Construct::new()
// .named(&"wololo".to_string())
// // big strong
// // .learn(Skill::Blast)
// .learn(Skill::Heal)
// .learn(Skill::Triage);
// let z = Construct::new()
// .named(&"quarry".to_string())
// .learn(Skill::Attack)
// .learn(Skill::Parry)
// .learn(Skill::Stun);
// return vec![x, y, z];
// }
// pub fn generate_mob_player(mode: GameMode, constructs: &Vec<Construct>) -> Player {
// let mut mob_player = Player::new(Uuid::nil());
// let construct_lvl = constructs.iter().max_by_key(|c| c.lvl).unwrap().lvl;
// let player_size = constructs.len();
// let mobs = match mode {
// GameMode::Normal => quick_game(construct_lvl, player_size),
// GameMode::Zone3v2Attack => zone_3v2_attack(construct_lvl),
// GameMode::Zone2v2Caster => zone_2v2_caster(construct_lvl),
// GameMode::Zone3v3MeleeMiniboss => zone_3v3_melee_miniboss(construct_lvl),
// GameMode::Zone3v3HealerBoss => zone_3v3_healer_boss(construct_lvl),
// _ => panic!("{:?} not handled for pve mobs", mode),
// };
// mob_player.set_constructs(mobs);
// return mob_player;
// }