Skip to content

Commit

Permalink
Added Custom Kolmi HP Bar
Browse files Browse the repository at this point in the history
Small patch to give Kolmi a custom HP bar as well as a nice QOL change to Blood Vacuum.
  • Loading branch information
Priskip committed Jul 4, 2024
1 parent db8cdde commit c678d6e
Show file tree
Hide file tree
Showing 64 changed files with 593 additions and 128 deletions.
5 changes: 5 additions & 0 deletions change_log.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
Change Log

Beta Build 04 July 2024
- Tweaked Sauvojen's HP art
- Custom boss bar for Kolmi (This took a lot of artwork because the bar needs to get bigger with the amount of hp he gets from orbs.)
- Blood Vacuum now spills excess blood back into the world.

Beta Build 20 Apr 2024
I'm posting the purgatory developer branch to the main branch now that Nolla has pushed their beta branch to the main branch.
This isn't a full update, as I am still working on Mestarien Mestari and the Sauvan Ydin. These are still a work in progress in this patch.
Expand Down
38 changes: 36 additions & 2 deletions data/entities/animals/boss_centipede/boss_centipede.xml
Original file line number Diff line number Diff line change
Expand Up @@ -268,11 +268,45 @@

<!-- Health Bar Component-->
<!-- Note Priskip 24/2/24: Olli changed the health bars around in the beta branch, hence the need for this.-->
<HealthBarComponent
<!-- Note Priskip 8/6/24: Updated this to a BossHealthBarComponent-->
<!-- Note Priskip 8/6/24: Removed BossHealthBarComponent in favor of custom purgatory hp bar.-->
<!-- <BossHealthBarComponent
_enabled="0"
_tags="disabled_at_start"
gui_special_final_boss="1"
gui_max_distance_visible="1500"
></HealthBarComponent>
></BossHealthBarComponent> -->

<!-- Custom Boss HP Bar -->
<LuaComponent
script_source_file="mods/purgatory/files/scripts/boss_bars/boss_bar_kolmi.lua"
execute_every_n_frame="1"
_enabled="0"
></LuaComponent>

<VariableStorageComponent
name="boss_bar_outline"
value_string="mods/purgatory/files/ui_gfx/boss_bars/boss_centipede/outline_6.png"
>
</VariableStorageComponent>

<VariableStorageComponent
name="boss_bar_fill"
value_string="mods/purgatory/files/ui_gfx/boss_bars/boss_centipede/fill_6.png"
>
</VariableStorageComponent>

<VariableStorageComponent
name="boss_bar_position"
value_string="CENTER"
>
</VariableStorageComponent>

<VariableStorageComponent
name="boss_name"
value_string="$animal_boss_centipede"
>
</VariableStorageComponent>
<!-- /Custom Boss HP Bar -->

</Entity>
34 changes: 29 additions & 5 deletions data/entities/animals/boss_centipede/boss_centipede_update.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
dofile_once( "data/scripts/lib/coroutines.lua" )
dofile_once( "data/scripts/lib/utilities.lua" )
dofile_once( "mods/purgatory/files/scripts/lib/utilities.lua" )

-- Description of overall boss behavior:
-- Boss waits for player to pick up item.
Expand Down Expand Up @@ -46,13 +47,22 @@ function init_boss()
orbcount = GameGetOrbCountThisRun()
orbcount = orbcount + newgame_n

--Purgatory Mode
--Kolmi HP gets buffed by 11 orbs
--His abilities remain the same per orb count
local purgatory_orb_count = orbcount + 11
--Purgatory: Kolmi HP gets buffed by 11 orbs - His abilities remain the same per orb count
local purgatory_orb_count = orbcount + 11 --2,325,566,045,260,890,000,000,000 hp at 75

ComponentSetValue2(orbcount_comp, "value_int", orbcount) -- store orbcount for savegames


--Purgatory: Enable custom boss hp bar.
local lua_components = EntityGetComponentIncludingDisabled(entity, "LuaComponent")
if lua_components ~= nil then
for i, comp in ipairs(lua_components) do
if ComponentGetValue2(comp, "script_source_file") == "mods/purgatory/files/scripts/boss_bars/boss_bar_kolmi.lua" then
EntitySetComponentIsEnabled(entity, comp, true)
break
end
end
end

-- Set boss HP based on orbs
local boss_hp = 46.0 + ( 2.0 ^ (purgatory_orb_count + 1.3) ) + (purgatory_orb_count*15.5)
local comp = EntityGetFirstComponent( entity, "DamageModelComponent" )
Expand All @@ -61,6 +71,20 @@ function init_boss()
ComponentSetValue( comp, "hp", tostring(boss_hp) )
end

--Purgatory: Set custom HP bar size based on length of health bar.
local hp_string = string.format("%.0f", tostring(25 * boss_hp))
local str_length = string.len(hp_string)
local outline_file = "mods/purgatory/files/ui_gfx/boss_bars/boss_centipede/outline_" .. tostring(str_length) .. ".png"
if ModDoesFileExist(outline_file) then
variableStorageSetValue(entity, "STRING", "boss_bar_outline", outline_file)
GamePrint(outline_file)
end
local fill_file = "mods/purgatory/files/ui_gfx/boss_bars/boss_centipede/fill_" .. tostring(str_length) .. ".png"
if ModDoesFileExist(outline_file) then
variableStorageSetValue(entity, "STRING", "boss_bar_fill", fill_file)
GamePrint(fill_file)
end

-- no orbs = weaker shield
if orbcount == 0 then
EntityAddChild( entity, EntityLoad("data/entities/animals/boss_centipede/boss_centipede_shield_weak.xml", pos_x, pos_y) )
Expand Down
Binary file modified files/biome_impl/debug/biome_map_debug.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions files/debug_magic_numbers.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<MagicNumbers
DESIGN_PLAYER_START_POS_X="-2468"
DESIGN_PLAYER_START_POS_Y="8500"
DESIGN_PLAYER_START_POS_X="3400"
DESIGN_PLAYER_START_POS_Y="13000"
BIOME_MAP="mods/purgatory/files/scripts/biomes/biome_map_debug.lua"
DAMAGE_BLOOD_AMOUNT_MIN="5"
DAMAGE_BLOOD_AMOUNT_MAX="10"
Expand All @@ -9,8 +9,8 @@ DESIGN_PLAYER_START_POS_Y="8500"

<!--
<MagicNumbers
DESIGN_PLAYER_START_POS_X="742" -900 for holy mountain
DESIGN_PLAYER_START_POS_Y="-670" 1890 for holy mountain
DESIGN_PLAYER_START_POS_X="742" -900 for holy mountain 3400 for kolmi
DESIGN_PLAYER_START_POS_Y="-670" 1890 for holy mountain 13000 for kolmi
BIOME_MAP="mods/purgatory/files/scripts/biomes/biome_map_debug.lua"
DAMAGE_BLOOD_AMOUNT_MIN="5"
DAMAGE_BLOOD_AMOUNT_MAX="10"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

<PhysicsBody2Component
kill_entity_after_initialized="0"
destroy_body_if_entity_destroyed="1"
>
</PhysicsBody2Component>
</Base>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

<PhysicsBody2Component
kill_entity_after_initialized="0"
destroy_body_if_entity_destroyed="1"
>
</PhysicsBody2Component>
</Base>
Expand Down
1 change: 1 addition & 0 deletions files/entities/buildings/skully_game/skully.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

<PhysicsBody2Component
kill_entity_after_initialized="0"
destroy_body_if_entity_destroyed="1"
>
</PhysicsBody2Component>
</Base>
Expand Down
37 changes: 37 additions & 0 deletions files/entities/misc/kolmi_hp_bar_test.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<Entity>

<LuaComponent
script_source_file="mods/purgatory/files/scripts/boss_bars/boss_bar_kolmi.lua"
execute_every_n_frame="1"
_enabled="1"
></LuaComponent>

<VariableStorageComponent
name="boss_bar_outline"
value_string="mods/purgatory/files/ui_gfx/boss_bars/boss_centipede/outline_6.png"
>
</VariableStorageComponent>

<VariableStorageComponent
name="boss_bar_fill"
value_string="mods/purgatory/files/ui_gfx/boss_bars/boss_centipede/fill_6.png"
>
</VariableStorageComponent>

<VariableStorageComponent
name="boss_bar_position"
value_string="CENTER"
>
</VariableStorageComponent>

<VariableStorageComponent
name="boss_name"
value_string="$animal_boss_centipede"
>
</VariableStorageComponent>

<DamageModelComponent
hp="48.462288826689836"
></DamageModelComponent>

</Entity>
11 changes: 5 additions & 6 deletions files/entities/misc/test.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<Entity>

<SpriteComponent
image_file="mods/purgatory/files/entities/misc/test_sprite.xml"
offset_x="0"
offset_y="0"
>
</SpriteComponent>
<LuaComponent
script_source_file="mods/purgatory/files/scripts/misc/test.lua"
execute_every_n_frame="1"
_enabled="1"
></LuaComponent>

</Entity>
43 changes: 31 additions & 12 deletions files/entities/projectiles/deck/vacuum_blood.xml
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,6 @@
</AudioLoopComponent>

<!-- Material Inventory and Sucker -->
<MaterialInventoryComponent
drop_as_item="0"
on_death_spill="0"
>
</MaterialInventoryComponent>

<MaterialSuckerComponent
num_cells_sucked_per_frame="100"
randomized_position.min_x="-42"
Expand All @@ -171,14 +165,39 @@
>
</MaterialSuckerComponent>

<MaterialInventoryComponent
drop_as_item="0"
on_death_spill="1"
>
</MaterialInventoryComponent>

<DamageModelComponent
hp="0.5"
materials_create_messages="1"
ragdoll_material="meat"
ragdoll_filenames_file=""
blood_sprite_directional=""
blood_sprite_large=""
air_needed="0"
wait_for_kill_flag_on_death="1"
ui_report_damage="0"
>
</DamageModelComponent>

<!-- Lua Logic -->
<LuaComponent
execute_on_removed="1"
execute_every_n_frame="-1"
script_source_file="mods/purgatory/files/scripts/projectiles/vacuum_blood.lua"
remove_after_executed="0"
>
</LuaComponent>
_tags="vacuum_powder_helper"
script_source_file="mods/purgatory/files/scripts/projectiles/vacuum_blood.lua"
execute_every_n_frame="280"
>
</LuaComponent>

<LuaComponent
script_source_file="data/scripts/projectiles/vacuum_powder_init.lua"
execute_every_n_frame="2"
remove_after_executed="1"
>
</LuaComponent>

<!-- For larpa -->
<VariableStorageComponent
Expand Down
Binary file added files/menu_banners/dev_branch.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions files/scripts/boss_bars/boss_bar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ if player_in_radius then
local damage_model_comp = EntityGetFirstComponentIncludingDisabled(entity_id, "DamageModelComponent")
local max_hp = 25 * ComponentGetValue2(damage_model_comp, "max_hp")
local current_hp = 25 * ComponentGetValue2(damage_model_comp, "hp") --Note Priskip: multiply hp numbers by 25 here because Nolla stores hp numbers at 1/25 size internally for some reason
if current_hp < 0 then current_hp = 0 end --Don't display negative numbers

local boss_bar_position = variableStorageGetValue(entity_id, "STRING", "boss_bar_position")
local boss_name = variableStorageGetValue(entity_id, "STRING", "boss_name")
Expand Down
Loading

0 comments on commit c678d6e

Please sign in to comment.