Fixups for attack after attacker leaves.

This commit is contained in:
Condorra 2023-02-20 15:23:36 +11:00
parent b28ea26d8a
commit 9046218155
2 changed files with 10 additions and 4 deletions

View File

@ -117,7 +117,9 @@ async fn list_item_contents<'l>(ctx: &'l VerbContext<'_>, item: &'l Item) -> URe
Subattack::Wrestling => buf.push_str(", wrestling "),
_ => buf.push_str(", attacking ")
}
match &head.presence_target {
match &head.active_combat.as_ref()
.and_then(|ac| ac.attacking.clone())
.or_else(|| head.presence_target.clone()) {
None => buf.push_str("someone"),
Some(who) => match who.split_once("/") {
None => buf.push_str("someone"),

View File

@ -21,7 +21,7 @@ use crate::{
services::{
broadcast_to_room,
skills::skill_check_and_grind,
combat::stop_attacking,
combat::stop_attacking_mut,
combat::handle_resurrect,
}
};
@ -97,7 +97,9 @@ pub async fn attempt_move_immediate(
Some(old_victim) => {
if let Some((vcode, vtype)) = old_victim.split_once("/") {
if let Some(vitem) = trans.find_item_by_type_code(vcode, vtype).await? {
stop_attacking(trans, &mover, &vitem).await?;
let mut vitem_mut = (*vitem).clone();
stop_attacking_mut(trans, &mut mover, &mut vitem_mut, false).await?;
trans.save_item_model(&vitem_mut).await?
}
}
}
@ -126,7 +128,9 @@ pub async fn attempt_move_immediate(
&attacker_names_str))).await?;
}
for item in &attacker_items[..] {
stop_attacking(trans, &item, &mover).await?;
let mut item_mut = (**item).clone();
stop_attacking_mut(trans, &mut item_mut, &mut mover, true).await?;
trans.save_item_model(&item_mut).await?;
}
} else {
if let Some(ctx) = player_ctx.as_ref() {