Compare commits
2 Commits
5a83daed48
...
7c3ff1bea1
Author | SHA1 | Date | |
---|---|---|---|
7c3ff1bea1 | |||
f6cc869cdc |
@ -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()))
|
||||
}
|
||||
}
|
||||
}
|
@ -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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user