Crates.io docs.rs MIT/Apache 2.0 Crates.io

game_stat

game_stat is a small Rust library for handling stats that can change with modifiers. Equipped an epic sword? Then your attack stats could increase by 40. Received a debuff? Your movement speed could decrease by 50%.

Example code

rs let mut armor_stat: Stat<2> = Stat::new(10f32); { let _modifier_handle = armor_stat.add_modifier(StatModifier::Flat(5f32)); println!("armor_stat is: {} it should be 15!", armor_stat.value()); } println!("armor_stat is: {}, It should be 10!", armor_stat.value());

Features

Is it battle ready?

No major project has been completed with this yet. I'm not sure of it's stability/performance, considering I'm internally using mutex with sync feature enabled, and interior mutability. I'm currently testing this library for a tower defence game. Time will tell :)

License

gamestat is free and open source! All code in this repository is dual-licensed under either:

at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.