# Rocalc
Rocalc(Roco calculator),一个用于计算洛克王国:世界精灵对决的Rust库。
## 使用
在你的rust项目运行 `cargo add rocalc` 即可添加该crate。
## 快速示例
```rust
use rocalc::*;
fn main() {
// 获取精灵种族值
let wolf = rocalc::get_race_value("恶魔狼王", "your_path.csv").unwrap();
let blue = rocalc::get_race_value("水灵", "your_path.csv").unwrap();
// 设置精灵个体值
let wolf_ind = [
(Panel::Hp, 10.0),
(Panel::Spd, 10.0),
(Panel::Atk, 10.0),
];
let blue_ind = [
(Panel::Hp, 10.0),
(Panel::Spd, 10.0),
(Panel::MAtk, 10.0),
];
// 计算精灵面板数值
let wolf_panel = Tri::new(Car::Timid, &wolf, &wolf_ind).cor();
let blue_panel = Tri::new(Car::Clever, &blue, &blue_ind).cor();
// 伤害计算 水灵对恶魔狼王使用天洪
let my_sfor = rocalc::Sfor{
atk: blue_panel.m_atk.round(),
dfe: wolf_panel.m_dfe.round(),
pow: 150.0,
};
my_sfor.cal(); // 最终造成伤害
}
```
## 精灵种族值数据获取
`get_race_value`函数需要指定格式的csv文件,您可前往[此仓库](https://codeberg.org/dddight/roco-kingdom-sprites-csv/releases)下载。
您也可以使用自己的数据和逻辑提取精灵种族值。
## LICENSE
Rocalc is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Rocalc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with Rocalc. If not, see <https://www.gnu.org/licenses/>.