Initial Sunbreak update.

- Added Monster Rank.
- Fixed Poison and Blast Damage.
This commit is contained in:
GreenComfyTea
2022-07-02 14:16:58 +03:00
parent c506a3073b
commit 9a5e05d229
9 changed files with 206 additions and 91 deletions

View File

@@ -8,6 +8,9 @@ local table_helpers;
local enemy_poison_damage_param_type_def = sdk.find_type_definition("snow.enemy.EnemyPoisonDamageParam");
local on_poison_activate_proc_method = enemy_poison_damage_param_type_def:get_method("onActivateProc");
local enemy_poison_damage_param_type_def = sdk.find_type_definition("snow.enemy.EnemyBlastDamageParam");
local on_blast_activate_proc_method = enemy_poison_damage_param_type_def:get_method("onActivateProc");
local enemy_condition_damage_param_base_type_def = sdk.find_type_definition("snow.enemy.EnemyConditionDamageParamBase");
local get_enemy_method = enemy_condition_damage_param_base_type_def:get_method("get_Em");
@@ -17,9 +20,14 @@ local is_boss_enemy_method = enemy_character_base_type_def:get_method("get_isBos
local enemy_damage_param_type_def = sdk.find_type_definition("snow.enemy.EnemyDamageParam");
local stock_damage_method = enemy_damage_param_type_def:get_method("stockDamage");
local poison_param_field = enemy_damage_param_type_def:get_field("_PoisonParam");
local blast_param_field = enemy_damage_param_type_def:get_field("_BlastParam");
local blast_param_type = blast_param_field:get_type();
local blast_damage_method = blast_param_type:get_method("get_BlastDamage");
local blast_adjust_rate_method = blast_param_type:get_method("get_BlastDamageAdjustRateByEnemyLv");
function ailment_hook.poison_proc(poison_param)
if poison_param == nil then
return;
@@ -46,6 +54,37 @@ function ailment_hook.poison_proc(poison_param)
ailments.clear_ailment_contribution(monster, ailments.poison_id);
end
function ailment_hook.blast_proc(blast_param)
if blast_param == nil then
return;
end
local enemy = get_enemy_method:call(blast_param);
if enemy == nil then
return;
end
local is_large = is_boss_enemy_method:call(enemy);
if is_large == nil then
return;
end
local monster;
if is_large then
monster = large_monster.get_monster(enemy);
else
monster = small_monster.get_monster(enemy);
end
local blast_damage = blast_damage_method:call(blast_param);
local blast_adjust_rate = blast_adjust_rate_method:call(blast_param);
ailments.apply_ailment_damage(monster, ailments.blast_id, blast_damage * blast_adjust_rate);
ailments.clear_ailment_contribution(monster, ailments.blast_id);
end
function ailment_hook.stock_damage()
for enemy, monster in pairs(large_monster.list) do
local damage_param = damage_param_field:get_data(enemy);
@@ -54,9 +93,8 @@ function ailment_hook.stock_damage()
end
local poison_param = poison_param_field:get_data(damage_param);
local blast_param = blast_param_field:get_data(damage_param);
ailments.update_poison_blast(monster, poison_param, blast_param);
ailments.update_poison(monster, poison_param);
::continue::
end
@@ -67,9 +105,8 @@ function ailment_hook.stock_damage()
end
local poison_param = poison_param_field:get_data(damage_param);
local blast_param = blast_param_field:get_data(damage_param);
ailments.update_poison_blast(monster, poison_param, blast_param);
ailments.update_poison(monster, poison_param);
::continue::
end
end
@@ -82,7 +119,7 @@ function ailment_hook.init_module()
table_helpers = require("MHR_Overlay.Misc.table_helpers");
sdk.hook(stock_damage_method, function(args)
pcall(ailment_hook.stock_damage);
pcall(ailment_hook.stock_damage, sdk.to_managed_object(args[2]));
end, function(retval)
return retval;
end);
@@ -92,6 +129,12 @@ function ailment_hook.init_module()
end, function(retval)
return retval;
end);
sdk.hook(on_blast_activate_proc_method, function(args)
pcall(ailment_hook.blast_proc, sdk.to_managed_object(args[2]));
end, function(retval)
return retval;
end);
end
return ailment_hook;