fix "Npcs can't be healed anymore"

This commit is contained in:
timokoesters 2020-03-25 22:23:03 +01:00
parent 5f10cdf0c6
commit 74eacbe27c

View File

@ -72,12 +72,23 @@ impl<'a> System<'a> for Sys {
attack.applied = true; attack.applied = true;
// Go through all other entities // Go through all other entities
for (b, uid_b, pos_b, ori_b, scale_b_maybe, character_b, stats_b, body_b) in ( for (
b,
uid_b,
pos_b,
ori_b,
scale_b_maybe,
agent_b_maybe,
character_b,
stats_b,
body_b,
) in (
&entities, &entities,
&uids, &uids,
&positions, &positions,
&orientations, &orientations,
scales.maybe(), scales.maybe(),
agents.maybe(),
&character_states, &character_states,
&stats, &stats,
&bodies, &bodies,
@ -106,11 +117,12 @@ impl<'a> System<'a> for Sys {
// NPCs do less damage: // NPCs do less damage:
if agent_maybe.is_some() { if agent_maybe.is_some() {
if healthchange > 0 { healthchange = (healthchange / 2).min(-1);
healthchange = 0; }
} else if healthchange < 0 {
healthchange = (healthchange / 2).min(-1); // Don't heal npc's hp
} if agent_b_maybe.is_some() && healthchange > 0 {
healthchange = 0;
} }
if rand::random() { if rand::random() {