Skip to content

Commit 421367b

Browse files
authored
Merge pull request #207 from Surrealaser/EmperorMercy
Player Killing Friendly Units Gives Them The Emperor's Mercy
2 parents ee23e15 + 7b0ad64 commit 421367b

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

Ruleset/scripts/scripts_infection_mechanics.rul

+17-6
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ extended:
275275
var int infectionFaction;
276276
var int remainingHealth;
277277
var int temp;
278+
var int temp2;
278279
var int INFECTION_LOW_THRESHOLD;
279280
var int INFECTION_MID_THRESHOLD;
280281
var int INFECTION_HIGH_THRESHOLD;
@@ -286,12 +287,6 @@ extended:
286287
return;
287288
end;
288289

289-
#set infection thresholds
290-
unit.getTag infectionType Tag.CURRENT_INFECTION_TYPE;
291-
set INFECTION_LOW_THRESHOLD 20;
292-
set INFECTION_MID_THRESHOLD 40;
293-
set INFECTION_HIGH_THRESHOLD 80;
294-
295290
unit.getHealth remainingHealth;
296291
sub remainingHealth to_health;
297292

@@ -300,6 +295,16 @@ extended:
300295
return;
301296
end;
302297

298+
attacker.getFaction temp;
299+
unit.getFaction temp2;
300+
if and eq temp FACTION_PLAYER eq temp2 FACTION_PLAYER; #both attacker and target belong to the player faction; administer the Emperor's Peace
301+
#debug_log "Infection Scripts; damageUnit, offset 23: Aborting. Friendly fire." remainingHealth;
302+
unit.setTag Tag.CURRENT_INFECTION_FACTION 0; #untag
303+
unit.setTag Tag.CURRENT_INFECTION_DAMAGE 0; #untag
304+
unit.setTag Tag.CURRENT_INFECTION_TYPE 0; #untag
305+
return;
306+
end;
307+
303308
unit.getTag infectionFaction Tag.CURRENT_INFECTION_FACTION; #set the faction
304309
#debug_log "Infection Scripts; damageUnit, offset 23: Infection faction:" infectionFaction;
305310
if eq infectionFaction FACTION_PLAYER; #player infections don't spawn units for balance reasons
@@ -314,6 +319,12 @@ extended:
314319
unit.getHealthMax temp;
315320
limit_upper infectionDamage temp; #infection damage cannot exceed the victim's maximum health
316321

322+
#set infection thresholds
323+
unit.getTag infectionType Tag.CURRENT_INFECTION_TYPE;
324+
set INFECTION_LOW_THRESHOLD 20;
325+
set INFECTION_MID_THRESHOLD 40;
326+
set INFECTION_HIGH_THRESHOLD 80;
327+
317328
#debug_log "Infection Scripts; damageUnit, offset 23: Fatal Damage Incurred; Remaining Health:" remainingHealth;
318329
if eq infectionType 1; #if Nurgle
319330
if le infectionDamage INFECTION_LOW_THRESHOLD; #low level infection

0 commit comments

Comments
 (0)