Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 43 additions & 17 deletions Ruleset/HitFX-basic.rul
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ extended:
tags:
BattleUnit:
LAST_HIT_FRAME: int
# 1: only armor damaged, 2: hp damaged
# 1: only armor damaged, 2: hp damaged, 3: stun taken, 4: morale damaged, 5: wounded
LAST_HIT_TYPE: int
LAST_HIT_POWER: int

Expand Down Expand Up @@ -36,7 +36,9 @@ extended:
unit.setTag Tag.LAST_HIT_FRAME temp;

if eq to_health 0;
if gt to_armor 0;
if gt to_wound 0;
unit.setTag Tag.LAST_HIT_TYPE 5;
else gt to_armor 0;
unit.setTag Tag.LAST_HIT_TYPE 1;
else eq to_armor 0;
if gt to_stun 0;
Expand All @@ -48,7 +50,11 @@ extended:
end;
end;
else gt to_health 0;
unit.setTag Tag.LAST_HIT_TYPE 2;
if eq to_wound 0;
unit.setTag Tag.LAST_HIT_TYPE 2;
else;
unit.setTag Tag.LAST_HIT_TYPE 5;
end;
# hits_to_kill = uni health here
div hits_to_kill to_health;
# If it takes 3 or more hits_to_kill, use weaker hit effect
Expand Down Expand Up @@ -88,10 +94,12 @@ extended:
var int temp;
var int hittype;
var int hitpower;
var int wounds;

unit.getTag temp Tag.LAST_HIT_FRAME;
unit.getTag hittype Tag.LAST_HIT_TYPE;
unit.getTag hitpower Tag.LAST_HIT_POWER;
unit.getFatalwoundsTotal wounds;

if neq temp 0;
sub temp anim_frame;
Expand All @@ -106,33 +114,51 @@ extended:
set_color new_pixel 14;
set_shade new_pixel 0;
end;
# Hit type 2 = hitpoint damage
else eq hittype 2;
if eq hitpower 0;
if gt temp -3; # number of frames to blink
set_color new_pixel 2;
#set_shade new_pixel 0;
end;
else gt hitpower 0;
if gt temp -2; # number of frames to blink
set_color new_pixel 2;
set_shade new_pixel 5;
# Hit type 5 = wound
else eq hittype 5;
if eq wounds 0;
set hittype 2;
else;
if eq hitpower 0;
if gt temp -3; # number of frames to blink
set_color new_pixel 2;
set_shade new_pixel 0;
end;
else gt hitpower 0;
if gt temp -2;
set_color new_pixel 2;
set_shade new_pixel 0;
end;
end;
end;
# Hit type 3 = stun damage
# Hit type 3 = stun damage
else eq hittype 3;
if gt temp -3; # number of frames to blink
set_color new_pixel 175;
#set_color new_pixel 0;
#set_shade new_pixel 10;
end;
# Hit type 4 = morale damage
# Hit type 4 = morale damage
else eq hittype 4;
if gt temp -10; # number of frames to blink
set_color new_pixel 112;
#set_shade new_pixel 0;
end;
end;
# Hit type 2 = hitpoint damage; we need to test this separately due to wounding logic
if eq hittype 2;
if eq hitpower 0;
if gt temp -3; # number of frames to blink
set_color new_pixel 6;
#set_shade new_pixel 0;
end;
else gt hitpower 0;
if gt temp -2; # number of frames to blink
set_color new_pixel 6;
set_shade new_pixel 5;
end;
end;
end;
end;

return new_pixel;
return new_pixel;