Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ActionUtils.scale_powerlevels = function (power_level, power_type, attacker_unit)
- --- BLOCK #0 1-4, warpins: 1 ---
- local cap_to_difficulty = true
- local actual_power_level = power_level
- --- END OF BLOCK #0 ---
- slot3 = if cap_to_difficulty then
- JUMP TO BLOCK #1
- else
- JUMP TO BLOCK #5
- end
- --- BLOCK #1 5-14, warpins: 1 ---
- local difficulty_settings = Managers.state.difficulty:get_difficulty_settings()
- local difficulty_power_level_cap = difficulty_settings.power_level_cap
- local difficulty_power_level_max_target = difficulty_settings.power_level_max_target
- --- END OF BLOCK #1 ---
- if difficulty_power_level_cap < actual_power_level then
- JUMP TO BLOCK #2
- else
- JUMP TO BLOCK #4
- end
- --- BLOCK #2 15-16, warpins: 1 ---
- --- END OF BLOCK #2 ---
- slot7 = if difficulty_power_level_max_target then
- JUMP TO BLOCK #3
- else
- JUMP TO BLOCK #4
- end
- --- BLOCK #3 17-22, warpins: 1 ---
- local above_cap = actual_power_level - difficulty_power_level_cap
- local cap_to_max = difficulty_power_level_cap - 800
- actual_power_level = difficulty_power_level_cap + difficulty_power_level_max_target*above_cap/cap_to_max
- --- END OF BLOCK #3 ---
- UNCONDITIONAL JUMP; TARGET BLOCK #5
- --- BLOCK #4 23-28, warpins: 2 ---
- actual_power_level = math.min(power_level, difficulty_power_level_cap)
- --- END OF BLOCK #4 ---
- FLOW; TARGET BLOCK #5
- --- BLOCK #5 29-31, warpins: 3 ---
- local min_cap_powerlevel = 200
- --- END OF BLOCK #5 ---
- if actual_power_level < min_cap_powerlevel then
- JUMP TO BLOCK #6
- else
- JUMP TO BLOCK #7
- end
- --- BLOCK #6 32-32, warpins: 1 ---
- return actual_power_level
- --- END OF BLOCK #6 ---
- FLOW; TARGET BLOCK #7
- --- BLOCK #7 33-40, warpins: 2 ---
- local starting_powerlevel_bonus = 50
- local starting_bonus_range = 100
- local powerlevel_diff_ratio = {
- impact = 2,
- attack = 3.5,
- cleave = 3.5
- }
- local native_diff_ratio = 5
- local scaled_powerlevel_section = nil
- --- END OF BLOCK #7 ---
- if min_cap_powerlevel + starting_bonus_range <= actual_power_level then
- JUMP TO BLOCK #8
- else
- JUMP TO BLOCK #9
- end
- --- BLOCK #8 41-47, warpins: 1 ---
- scaled_powerlevel_section = (actual_power_level - min_cap_powerlevel)*(powerlevel_diff_ratio[power_type] - 1)/(native_diff_ratio - 1)
- --- END OF BLOCK #8 ---
- UNCONDITIONAL JUMP; TARGET BLOCK #10
- --- BLOCK #9 48-58, warpins: 1 ---
- local starting_bonus = starting_powerlevel_bonus*((actual_power_level - 200)/starting_bonus_range - 1)
- scaled_powerlevel_section = ((actual_power_level + starting_bonus) - min_cap_powerlevel)*(powerlevel_diff_ratio[power_type] - 1)/(native_diff_ratio - 1)
- --- END OF BLOCK #9 ---
- FLOW; TARGET BLOCK #10
- --- BLOCK #10 59-61, warpins: 2 ---
- local scaled_powerlevel = min_cap_powerlevel + scaled_powerlevel_section
- --- END OF BLOCK #10 ---
- slot2 = if attacker_unit then
- JUMP TO BLOCK #11
- else
- JUMP TO BLOCK #12
- end
- --- BLOCK #11 62-67, warpins: 1 ---
- scaled_powerlevel = ActionUtils.apply_buffs_to_power_level(attacker_unit, scaled_powerlevel)
- --- END OF BLOCK #11 ---
- FLOW; TARGET BLOCK #12
- --- BLOCK #12 68-68, warpins: 2 ---
- return scaled_powerlevel
- --- END OF BLOCK #12 ---
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement