Change Anomaly Core break hook

This commit is contained in:
GreenComfyTea
2023-06-07 19:44:01 +03:00
parent 6862331ca9
commit e51185892a
3 changed files with 40 additions and 27 deletions

View File

@@ -70,6 +70,7 @@ function this.new(id, name)
part.break_count = 0;
part.break_max_count = 0;
part.anomaly_ref = nil;
part.anomaly_health = -9;
part.anomaly_max_health = -10;
part.anomaly_health_percentage = 0;
@@ -160,7 +161,7 @@ function this.update_loss(part, part_loss_current, part_loss_max, is_severed)
end
function this.update_anomaly(part, part_anomaly_current, part_anomaly_max, part_is_active)
function this.update_anomaly(part, part_anomaly_ref, part_anomaly_current, part_anomaly_max, part_is_active)
if part.anomaly_health ~= part_anomaly_current then
part.last_change_time = time.total_elapsed_script_seconds;
end
@@ -173,10 +174,11 @@ function this.update_anomaly(part, part_anomaly_current, part_anomaly_max, part_
part.last_change_time = time.total_elapsed_script_seconds;
end
part.anomaly_core_ref = part_anomaly_ref;
part.anomaly_health = part_anomaly_current;
part.anomaly_max_health = part_anomaly_max;
part.anomaly_is_active = part_is_active;
if part.anomaly_max_health ~= 0 then
part.anomaly_health_percentage = part.anomaly_health / part.anomaly_max_health;
end

View File

@@ -114,6 +114,7 @@ function this.new(enemy)
monster.king_border = 10;
monster.crown = "";
monster.is_anomaly = false;
monster.parts = {};
monster.ailments = ailments.init_ailments();
@@ -253,6 +254,7 @@ local enemy_mystery_core_parts_type_def = sdk.find_type_definition("snow.enemy.E
local core_parts_get_vital_method = enemy_mystery_core_parts_type_def:get_method("get_Vital");
local core_parts_get_is_active_method = enemy_mystery_core_parts_type_def:get_method("get_IsActive");
local core_parts_get_dying_vital_threashold_method = enemy_mystery_core_parts_type_def:get_method("get_DyingVitalThreashold");
local on_break_method = enemy_mystery_core_parts_type_def:get_method("onBreak");
function this.init(monster, enemy)
local enemy_type = enemy_type_field:get_data(enemy);
@@ -331,6 +333,7 @@ function this.init(monster, enemy)
local mystery_param = get_mystery_param_method:call(enemy);
local is_anomaly = mystery_param ~= nil;
monster.is_anomaly = is_anomaly;
monster.is_capturable = is_capture_enable and not is_anomaly;
end
@@ -921,7 +924,7 @@ function this.update_anomaly_parts(enemy, monster, mystery_param)
goto continue;
end
body_part.update_anomaly(part, part_current, part_max, part_is_active);
body_part.update_anomaly(part, core_part, part_current, part_max, part_is_active);
end