mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 07:03:16 +00:00
more boss fixes
This commit is contained in:
parent
585d12b4d2
commit
2da5701fe2
5 changed files with 312 additions and 0 deletions
|
@ -0,0 +1,40 @@
|
||||||
|
dofile_once("data/scripts/lib/utilities.lua")
|
||||||
|
|
||||||
|
local entity_id = GetUpdatedEntityID()
|
||||||
|
local x, y = EntityGetTransform( GetUpdatedEntityID() )
|
||||||
|
local radius = 260
|
||||||
|
|
||||||
|
local proj = ""
|
||||||
|
|
||||||
|
local s = EntityGetComponent( entity_id, "VariableStorageComponent" )
|
||||||
|
if ( s ~= nil ) then
|
||||||
|
for i,v in ipairs( s ) do
|
||||||
|
local name = ComponentGetValue2( v, "name" )
|
||||||
|
|
||||||
|
if ( name == "type" ) then
|
||||||
|
proj = ComponentGetValue2( v, "value_string" )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local targets = EntityGetInRadiusWithTag( x, y, radius, "ew_peer" )
|
||||||
|
local closest
|
||||||
|
local v
|
||||||
|
for _, player in ipairs(targets) do
|
||||||
|
local px, py = EntityGetTransform(player)
|
||||||
|
local r = px * px + py * py
|
||||||
|
if closest == nil or r < closest then
|
||||||
|
closest = r
|
||||||
|
v = player
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if ( string.len( proj ) > 0 ) and ( v ~= nil ) then
|
||||||
|
local px, py = EntityGetTransform( v )
|
||||||
|
local vel_x = math.cos( 0 - math.atan2( py - y, px - x ) ) * 2.0
|
||||||
|
local vel_y = 0 - math.sin( 0 - math.atan2( py - y, px - x ) ) * 2.0
|
||||||
|
|
||||||
|
local eid = shoot_projectile_from_projectile( entity_id, proj, x, y, vel_x, vel_y )
|
||||||
|
|
||||||
|
EntityAddTag( eid, "boss_alchemist" )
|
||||||
|
end
|
12
quant.ew/data/entities/animals/boss_ghost/spawn_ghost.lua
Normal file
12
quant.ew/data/entities/animals/boss_ghost/spawn_ghost.lua
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
dofile_once( "data/scripts/lib/utilities.lua" )
|
||||||
|
|
||||||
|
local entity_id = GetUpdatedEntityID()
|
||||||
|
local root_id = EntityGetRootEntity( entity_id )
|
||||||
|
local x,y = EntityGetTransform( root_id )
|
||||||
|
|
||||||
|
local players = EntityGetInRadiusWithTag( x, y, 300, "ew_peer" )
|
||||||
|
|
||||||
|
if ( #players > 0 ) then
|
||||||
|
EntityLoad( "data/entities/animals/boss_ghost/boss_ghost.xml", x, y )
|
||||||
|
EntityKill( root_id )
|
||||||
|
end
|
131
quant.ew/data/entities/animals/boss_pit/boss_pit_logic.lua
Normal file
131
quant.ew/data/entities/animals/boss_pit/boss_pit_logic.lua
Normal file
|
@ -0,0 +1,131 @@
|
||||||
|
dofile_once("data/scripts/lib/utilities.lua")
|
||||||
|
|
||||||
|
local entity_id = GetUpdatedEntityID()
|
||||||
|
local x, y = EntityGetTransform( GetUpdatedEntityID() )
|
||||||
|
|
||||||
|
local dm = 1.0
|
||||||
|
|
||||||
|
edit_component( entity_id, "HitboxComponent", function(comp,vars)
|
||||||
|
dm = ComponentGetValue2( comp, "damage_multiplier" )
|
||||||
|
|
||||||
|
if ( dm < 1.0 ) then
|
||||||
|
dm = math.min( 1.0, dm + 0.35 )
|
||||||
|
end
|
||||||
|
|
||||||
|
ComponentSetValue2( comp, "damage_multiplier", dm )
|
||||||
|
end)
|
||||||
|
|
||||||
|
EntitySetComponentsWithTagEnabled( entity_id, "invincible", false )
|
||||||
|
|
||||||
|
local state = 0
|
||||||
|
local p = ""
|
||||||
|
local pathfinding_frames_stuck = 0
|
||||||
|
local comps = EntityGetComponent( entity_id, "VariableStorageComponent" )
|
||||||
|
if ( comps ~= nil ) then
|
||||||
|
for i,v in ipairs( comps ) do
|
||||||
|
local n = ComponentGetValue2( v, "name" )
|
||||||
|
if ( n == "state" ) then
|
||||||
|
state = ComponentGetValue2( v, "value_int" )
|
||||||
|
|
||||||
|
state = (state + 1) % 10
|
||||||
|
|
||||||
|
ComponentSetValue2( v, "value_int", state )
|
||||||
|
elseif ( n == "memory" ) then
|
||||||
|
--print( ComponentGetValue2( v, "value_string" ) )
|
||||||
|
p = ComponentGetValue2( v, "value_string" )
|
||||||
|
|
||||||
|
if ( #p == 0 ) then
|
||||||
|
p = "data/entities/projectiles/enlightened_laser_darkbeam.xml"
|
||||||
|
ComponentSetValue2( v, "value_string", p )
|
||||||
|
end
|
||||||
|
elseif ( n == "pathfinding_frames_stuck" ) then
|
||||||
|
pathfinding_frames_stuck = ComponentGetValue2( v, "value_int" )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
SetRandomSeed( x, y * GameGetFrameNum() )
|
||||||
|
|
||||||
|
local players = EntityGetWithTag( "ew_peer" )
|
||||||
|
local player = players[1]
|
||||||
|
|
||||||
|
if ( state == 1 ) then
|
||||||
|
if ( #p > 0 ) then
|
||||||
|
local angle = Random( 1, 200 ) * math.pi
|
||||||
|
local vel_x = math.cos( angle ) * 100
|
||||||
|
local vel_y = 0 - math.cos( angle ) * 100
|
||||||
|
|
||||||
|
--[[
|
||||||
|
"data/entities/projectiles/deck/rocket.xml"
|
||||||
|
"data/entities/projectiles/deck/rocket_tier_2.xml"
|
||||||
|
"data/entities/projectiles/deck/rocket_tier_3.xml"
|
||||||
|
"data/entities/projectiles/deck/grenade.xml"
|
||||||
|
"data/entities/projectiles/deck/grenade_tier_2.xml"
|
||||||
|
"data/entities/projectiles/deck/grenade_tier_3.xml"
|
||||||
|
"data/entities/projectiles/deck/rubber_ball.xml"
|
||||||
|
]]--
|
||||||
|
local spells = { "rocket", "rocket_tier_2", "rocket_tier_3", "grenade", "grenade_tier_2", "grenade_tier_3", "rubber_ball" }
|
||||||
|
local rnd = Random( 1, #spells )
|
||||||
|
local path = "data/entities/projectiles/deck/" .. spells[rnd] .. ".xml"
|
||||||
|
|
||||||
|
local wid = shoot_projectile( entity_id, "data/entities/animals/boss_pit/wand.xml", x, y, vel_x, vel_y )
|
||||||
|
edit_component( wid, "VariableStorageComponent", function(comp,vars)
|
||||||
|
ComponentSetValue2( comp, "value_string", path )
|
||||||
|
end)
|
||||||
|
|
||||||
|
EntityAddComponent( wid, "HomingComponent",
|
||||||
|
{
|
||||||
|
homing_targeting_coeff = "30.0",
|
||||||
|
homing_velocity_multiplier = "0.16",
|
||||||
|
target_tag = "ew_peer",
|
||||||
|
} )
|
||||||
|
|
||||||
|
if ( string.find( path, "rocket" ) ~= nil ) then
|
||||||
|
EntityAddComponent( wid, "VariableStorageComponent",
|
||||||
|
{
|
||||||
|
name = "mult",
|
||||||
|
value_float = 0.5,
|
||||||
|
} )
|
||||||
|
else
|
||||||
|
EntityAddComponent( wid, "VariableStorageComponent",
|
||||||
|
{
|
||||||
|
name = "mult",
|
||||||
|
value_float = 1.2,
|
||||||
|
} )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
elseif ( state == 7 ) then
|
||||||
|
if ( Random( 1, 10 ) == 5 ) or ( 1 == 1 ) then
|
||||||
|
|
||||||
|
--[[
|
||||||
|
"data/entities/projectiles/orb_poly.xml"
|
||||||
|
"data/entities/projectiles/orb_neutral.xml"
|
||||||
|
"data/entities/projectiles/orb_tele.xml"
|
||||||
|
"data/entities/projectiles/orb_dark.xml"
|
||||||
|
]]--
|
||||||
|
|
||||||
|
-- if we're stuck shoot blackholes towards player
|
||||||
|
if( pathfinding_frames_stuck > 160 ) then
|
||||||
|
|
||||||
|
-- we're stuck, lets hunt for that connoisseur of cheese
|
||||||
|
local path = "data/entities/projectiles/remove_ground.xml"
|
||||||
|
local wid = shoot_projectile( entity_id, path, x, y, 0, 0 )
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
-- standard logic
|
||||||
|
local spells = { "orb_poly", "orb_neutral", "orb_tele", "orb_dark" }
|
||||||
|
local rnd = Random( 1, #spells )
|
||||||
|
local path = "data/entities/projectiles/" .. spells[rnd] .. ".xml"
|
||||||
|
|
||||||
|
local arc = math.pi * 0.25
|
||||||
|
local offset = math.pi * ( Random( 1, 10 ) * 0.1 )
|
||||||
|
|
||||||
|
for i=0,7 do
|
||||||
|
local vel_x = math.cos( arc * i + offset ) * 300
|
||||||
|
local vel_y = 0 - math.sin( arc * i + offset ) * 300
|
||||||
|
shoot_projectile( entity_id, path, x, y, vel_x, vel_y )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
50
quant.ew/data/entities/animals/boss_pit/wand.lua
Normal file
50
quant.ew/data/entities/animals/boss_pit/wand.lua
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
dofile_once("data/scripts/lib/utilities.lua")
|
||||||
|
|
||||||
|
local entity_id = GetUpdatedEntityID()
|
||||||
|
local x, y, a = EntityGetTransform( entity_id )
|
||||||
|
|
||||||
|
local p = EntityGetWithTag( "ew_peer" )
|
||||||
|
local closest
|
||||||
|
local v
|
||||||
|
for _, player in ipairs(p) do
|
||||||
|
local px, py = EntityGetTransform(player)
|
||||||
|
local r = px * px + py * py
|
||||||
|
if closest == nil or r < closest then
|
||||||
|
closest = r
|
||||||
|
v = player
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local comps = EntityGetComponent( entity_id, "VariableStorageComponent" )
|
||||||
|
local proj = ""
|
||||||
|
local mult = 1.0
|
||||||
|
if ( comps ~= nil ) then
|
||||||
|
for i,v in ipairs( comps ) do
|
||||||
|
local n = ComponentGetValue2( v, "name" )
|
||||||
|
if ( n == "memory" ) then
|
||||||
|
proj = ComponentGetValue2( v, "value_string" )
|
||||||
|
elseif ( n == "mult" ) then
|
||||||
|
mult = ComponentGetValue2( v, "value_float" )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local length = 300
|
||||||
|
local homing = EntityGetComponent( entity_id, "HomingComponent" )
|
||||||
|
if ( homing == nil ) then
|
||||||
|
length = 500
|
||||||
|
end
|
||||||
|
|
||||||
|
if ( v ~= nil ) and ( #proj > 0 ) then
|
||||||
|
local px,py = EntityGetTransform( v )
|
||||||
|
local dir = 0 - math.atan2( py - y, px - x )
|
||||||
|
|
||||||
|
local vel_x = math.cos( dir ) * length * mult
|
||||||
|
local vel_y = 0 - math.sin( dir ) * length * mult
|
||||||
|
local pid = shoot_projectile_from_projectile( entity_id, proj, x, y, vel_x, vel_y )
|
||||||
|
|
||||||
|
edit_component( pid, "ProjectileComponent", function(comp,vars)
|
||||||
|
local d = ComponentGetValue2( comp, "damage" )
|
||||||
|
d = d + 0.2
|
||||||
|
ComponentSetValue2( comp, "damage", d )
|
||||||
|
end)
|
||||||
|
end
|
79
quant.ew/data/entities/animals/boss_robot/spell_eater.lua
Normal file
79
quant.ew/data/entities/animals/boss_robot/spell_eater.lua
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
dofile_once("data/scripts/lib/utilities.lua")
|
||||||
|
|
||||||
|
local entity_id = GetUpdatedEntityID()
|
||||||
|
local boss_id = EntityGetRootEntity( entity_id )
|
||||||
|
local x, y = EntityGetTransform( boss_id )
|
||||||
|
local distance_full = 36
|
||||||
|
local ax,ay = 0
|
||||||
|
|
||||||
|
local projectiles = EntityGetInRadiusWithTag( x, y, distance_full, "projectile" )
|
||||||
|
|
||||||
|
local varcomps = EntityGetComponent( boss_id, "VariableStorageComponent" )
|
||||||
|
local players = EntityGetWithTag("ew_peer")
|
||||||
|
local closest
|
||||||
|
local player_id
|
||||||
|
for _, player in ipairs(players) do
|
||||||
|
local px, py = EntityGetTransform(player)
|
||||||
|
local r = px * px + py * py
|
||||||
|
if closest == nil or r < closest then
|
||||||
|
closest = r
|
||||||
|
player_id = player
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local state = 0
|
||||||
|
|
||||||
|
if ( varcomps ~= nil ) then
|
||||||
|
for i,v in ipairs( varcomps ) do
|
||||||
|
local n = ComponentGetValue2( v, "name" )
|
||||||
|
if ( n == "spell_eater" ) then
|
||||||
|
state = ComponentGetValue2( v, "value_int" )
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if ( state == 0 ) then
|
||||||
|
EntitySetComponentsWithTagEnabled( entity_id, "boss_robot_spell_eater", false )
|
||||||
|
else
|
||||||
|
EntitySetComponentsWithTagEnabled( entity_id, "boss_robot_spell_eater", true )
|
||||||
|
if ( player_id ~= nil ) then
|
||||||
|
local plx,ply = EntityGetTransform( player_id )
|
||||||
|
ax,ay = x - plx, y - ply
|
||||||
|
local a = math.pi - math.atan2( ay, ax )
|
||||||
|
|
||||||
|
EntitySetTransform( entity_id, x, y, 0 - a )
|
||||||
|
|
||||||
|
if ( #projectiles > 0 ) then
|
||||||
|
for i,projectile_id in ipairs(projectiles) do
|
||||||
|
local px, py = EntityGetTransform( projectile_id )
|
||||||
|
|
||||||
|
local distance = get_distance( px, py, x, y )
|
||||||
|
local direction = get_direction( px, py, x, y )
|
||||||
|
|
||||||
|
local dirdelta = get_direction_difference( direction, a )
|
||||||
|
local dirdelta_deg = math.abs( math.deg( dirdelta ) )
|
||||||
|
|
||||||
|
if ( distance < distance_full ) and ( dirdelta_deg < 82.0 ) then
|
||||||
|
local pcomp = EntityGetFirstComponent( projectile_id, "ProjectileComponent" )
|
||||||
|
local valid = true
|
||||||
|
|
||||||
|
if ( pcomp ~= nil ) then
|
||||||
|
local whoshot = ComponentGetValue2( pcomp, "mWhoShot" )
|
||||||
|
|
||||||
|
if ( whoshot == boss_id ) then
|
||||||
|
valid = false
|
||||||
|
else
|
||||||
|
ComponentSetValue2( pcomp, "on_death_explode", false )
|
||||||
|
ComponentSetValue2( pcomp, "on_lifetime_out_explode", false )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if valid then
|
||||||
|
EntityKill( projectile_id )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Add table
Add a link
Reference in a new issue