Compare commits

..

6 Commits

Author SHA1 Message Date
dd80302805 Revert "nonsense"
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
This reverts commit e9b2a1340cf5280780b45c2175fe04a482dc27b4.
2024-02-26 18:07:34 -04:00
e9b2a1340c nonsense
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2024-02-25 15:11:40 -04:00
818c31a6d8 Merge remote-tracking branch 'origin/master' into andy/clamp-mag-feed 2024-02-19 19:30:51 -04:00
7104ccb990 cool empty test bro 2023-09-10 11:15:53 -03:00
226577f91a car go fast? no, cargo clippy vroom vroom 2023-09-01 13:10:49 -03:00
23a3d1212e match mag feed decrease behaviour with the client and fix test 2023-09-01 12:56:41 -03:00

View File

@ -1029,10 +1029,30 @@ impl Mag {
MAG_STATS.get(&self.mag).map(|stats| {
MAG_FEEDING_TABLES.get(stats.feed_table).map(|feeding_table| {
feeding_table.get(&tool).map(|feed_stats| {
self.def = std::cmp::max(std::cmp::max((self.def as i16) + feed_stats.def, 0) as u16, self.def()*100);
self.pow = std::cmp::max(std::cmp::max((self.pow as i16) + feed_stats.pow, 0) as u16, self.pow()*100);
self.dex = std::cmp::max(std::cmp::max((self.dex as i16) + feed_stats.dex, 0) as u16, self.dex()*100);
self.mnd = std::cmp::max(std::cmp::max((self.mnd as i16) + feed_stats.mnd, 0) as u16, self.mind()*100);
self.def = {
if (self.def as i16 + feed_stats.def) < ((self.def()*100) as i16) {
self.def
} else {
std::cmp::max(std::cmp::max((self.def as i16) + feed_stats.def, 0) as u16, self.def()*100)
}};
self.pow = {
if (self.pow as i16 + feed_stats.pow) < ((self.pow()*100) as i16) {
self.pow
} else {
std::cmp::max(std::cmp::max((self.pow as i16) + feed_stats.pow, 0) as u16, self.pow()*100)
}};
self.dex = {
if (self.dex as i16 + feed_stats.dex) < ((self.dex()*100) as i16) {
self.dex
} else {
std::cmp::max(std::cmp::max((self.dex as i16) + feed_stats.dex, 0) as u16, self.dex()*100)
}};
self.mnd = {
if (self.mnd as i16 + feed_stats.mnd) < ((self.mind()*100) as i16) {
self.mnd
} else {
std::cmp::max(std::cmp::max((self.mnd as i16) + feed_stats.mnd, 0) as u16, self.mind()*100)
}};
self.iq = std::cmp::min(((self.iq as i16) + feed_stats.iq as i16) as u8, 200);
self.synchro = std::cmp::min(((self.synchro as i8) + feed_stats.syn) as u8, 120);
})
@ -1188,7 +1208,7 @@ mod test {
f.read_to_string(&mut s).unwrap();
let mut feed: HashMap<String, Vec<HashMap<String, MagFeedTable>>> = toml::from_str(&s).unwrap();
let feed = feed.remove("feedtable".into()).unwrap();
let feed = feed.remove("feedtable").unwrap();
let _feed = feed.into_iter()
.map(|table| {
table.into_iter()
@ -1219,7 +1239,7 @@ mod test {
}
assert!(mag == Mag {
mag: MagType::Sato,
def: 507,
def: 509,
pow: 5019,
dex: 4505,
mnd: 0,
@ -1231,9 +1251,5 @@ mod test {
id: SectionID::Whitill,
});
}
#[test]
fn test_mag_does_not_level_down() {
}
}