Merge branch 'rtsim-like-enemy-killer' into 'master'

rtsim: positive sentiment gain for killing enemies

See merge request veloren/veloren!3882
This commit is contained in:
Isse 2023-04-16 17:16:51 +00:00
commit 510d72048e
2 changed files with 18 additions and 4 deletions

View File

@ -258,6 +258,10 @@ npc-speech-witness_murder =
.a0 = Murderer! .a0 = Murderer!
.a1 = How could you do this? .a1 = How could you do this?
.a2 = Aaargh! .a2 = Aaargh!
npc-speech-witness_enemy_murder =
.a0 = My Hero!
.a1 = Finally someone did it!
.a2 = Yeaah!
npc-speech-witness_death = npc-speech-witness_death =
.a0 = No! .a0 = No!
.a1 = This is terrible! .a1 = This is terrible!

View File

@ -958,8 +958,7 @@ fn check_inbox(ctx: &mut NpcCtx) -> Option<impl Action> {
Some(report_id) if !ctx.known_reports.contains(&report_id) => { Some(report_id) if !ctx.known_reports.contains(&report_id) => {
#[allow(clippy::single_match)] #[allow(clippy::single_match)]
match ctx.state.data().reports.get(report_id).map(|r| r.kind) { match ctx.state.data().reports.get(report_id).map(|r| r.kind) {
Some(ReportKind::Death { killer, .. }) => { Some(ReportKind::Death { killer, actor, .. }) => {
// TODO: Sentiment should be positive if we didn't like actor that died
// TODO: Don't report self // TODO: Don't report self
let phrase = if let Some(killer) = killer { let phrase = if let Some(killer) = killer {
// TODO: For now, we don't make sentiment changes if the killer was an // TODO: For now, we don't make sentiment changes if the killer was an
@ -967,9 +966,20 @@ fn check_inbox(ctx: &mut NpcCtx) -> Option<impl Action> {
// This should be changed in the future. // This should be changed in the future.
if !matches!(killer, Actor::Npc(_)) { if !matches!(killer, Actor::Npc(_)) {
// TODO: Don't hard-code sentiment change // TODO: Don't hard-code sentiment change
ctx.sentiments.change_by(killer, -0.7, Sentiment::VILLAIN); let mut change = -0.7;
if ctx.sentiments.toward(actor).is(Sentiment::ENEMY) {
// Like the killer if we have negative sentiment towards the
// killed.
change *= -1.0;
}
ctx.sentiments.change_by(killer, change, Sentiment::VILLAIN);
}
if ctx.sentiments.toward(actor).is(Sentiment::ENEMY) {
"npc-speech-witness_enemy_murder"
} else {
"npc-speech-witness_murder"
} }
"npc-speech-witness_murder"
} else { } else {
"npc-speech-witness_death" "npc-speech-witness_death"
}; };