Compare commits

...

2 Commits

Author SHA1 Message Date
7c3ff1bea1 printing is for turbo nerds
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is failing
2022-05-17 21:09:54 +00:00
f6cc869cdc flip4clip 2022-05-17 21:08:41 +00:00
2 changed files with 78 additions and 81 deletions

View File

@ -406,6 +406,7 @@ where
// TODO: convenience function for giving exp and checking levelups (un-duplicate code here and `request_exp`)
// TODO: use real errors (Idunnoman)
// TODO: create InventoryError::CannotGetItemHandle or something
#[allow(clippy::too_many_arguments)]
pub async fn player_steals_exp<EG> (id: ClientId,
expsteal: &ExperienceSteal,
entity_gateway: &mut EG,
@ -433,9 +434,7 @@ where
let monster_stats = room.monster_stats.get(&monster.monster).ok_or(ShipError::UnknownMonster(monster.monster))?;
let remaining_exp = monster_stats.exp - monster.stolen_exp[area_client.local_client.id() as usize];
if remaining_exp <= 0 {
Ok(Box::new(None.into_iter()))
} else {
if remaining_exp > 0 {
let char_special_modifier: f32 = if client.character.char_class.is_android() {
if room.mode.difficulty() == crate::ship::room::Difficulty::Ultimate {
0.3
@ -486,7 +485,6 @@ where
remaining_exp);
monster.steal_exp(exp_earned, area_client.local_client.id() as usize);
println!("monster info: {:?}", monster);
let clients_in_area = client_location.get_clients_in_room(room_id).map_err(|err| -> ClientLocationError { err.into() })?;
let gain_exp_pkt = builder::message::character_gained_exp(area_client, exp_earned);
@ -514,6 +512,8 @@ where
entity_gateway.save_character(&client.character).await?;
Ok(exp_pkts)
} else {
Ok(Box::new(None.into_iter()))
}
}
}

View File

@ -441,7 +441,6 @@ async fn test_exp_steal_android_boost_in_ultimate() {
let c1 = ship.clients.get(&ClientId(1)).unwrap();
let c2 = ship.clients.get(&ClientId(2)).unwrap();
println!("c1 exp: {:?}, c2 exp: {:?}", c1.character.exp, c2.character.exp);
assert!(c1.character.exp == 80000080);
assert!(c2.character.exp == 80000032);
}
@ -556,7 +555,6 @@ async fn test_exp_steal_no_android_boost_in_vhard() {
let c1 = ship.clients.get(&ClientId(1)).unwrap();
let c2 = ship.clients.get(&ClientId(2)).unwrap();
println!("c1 exp: {:?}, c2 exp: {:?}", c1.character.exp, c2.character.exp);
assert!(c1.character.exp == 80000010);
assert!(c2.character.exp == 80000010);
}
@ -909,7 +907,6 @@ async fn test_each_client_can_steal_full_exp_from_same_enemy() {
let c1 = ship.clients.get(&ClientId(1)).unwrap();
let c2 = ship.clients.get(&ClientId(2)).unwrap();
println!("c1 exp: {:?}, c2 exp: {:?}", c1.character.exp, c2.character.exp);
assert!(c1.character.exp == 5);
assert!(c2.character.exp == 5);