Compare commits
No commits in common. "7c3ff1bea1c36fd454dde5ca45234ecc9e1c75b0" and "5a83daed48056afc5f0b2797f7732ab60a76cecb" have entirely different histories.
7c3ff1bea1
...
5a83daed48
@ -406,7 +406,6 @@ 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,
|
||||
@ -434,7 +433,9 @@ 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 {
|
||||
if remaining_exp <= 0 {
|
||||
Ok(Box::new(None.into_iter()))
|
||||
} else {
|
||||
let char_special_modifier: f32 = if client.character.char_class.is_android() {
|
||||
if room.mode.difficulty() == crate::ship::room::Difficulty::Ultimate {
|
||||
0.3
|
||||
@ -485,6 +486,7 @@ 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);
|
||||
@ -512,8 +514,6 @@ where
|
||||
entity_gateway.save_character(&client.character).await?;
|
||||
|
||||
Ok(exp_pkts)
|
||||
} else {
|
||||
Ok(Box::new(None.into_iter()))
|
||||
}
|
||||
}
|
||||
}
|
@ -441,6 +441,7 @@ 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);
|
||||
}
|
||||
@ -555,6 +556,7 @@ 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);
|
||||
}
|
||||
@ -907,6 +909,7 @@ 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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user