diff --git a/arena.lua b/arena.lua index 59780c6..f152396 100644 --- a/arena.lua +++ b/arena.lua @@ -449,6 +449,14 @@ function Arena:quit() trigger:tween(4, camera, {x = gw/2, y = gh/2, r = 0}, math.linear, function() camera.x, camera.y, camera.r = gw/2, gh/2, 0 end) self.win_text = Text2{group = self.ui, x = gw/2 + 40, y = gh/2 - 69, force_update = true, lines = {{text = '[wavy_mid, cbyc2]congratulations!', font = fat_font, alignment = 'center'}}} trigger:after(2.5, function() + local open_url = function(b, url) + ui_switch2:play{pitch = random:float(0.95, 1.05), volume = 0.5} + b.spring:pull(0.2, 200, 10) + b.selected = true + ui_switch1:play{pitch = random:float(0.95, 1.05), volume = 0.5} + system.open_url(url) + end + self.build_text = Text2{group = self.ui, x = 40, y = 20, force_update = true, lines = {{text = "[wavy_mid, fg]your build", font = pixul_font, alignment = 'center'}}} for i, unit in ipairs(self.units) do CharacterPart{group = self.ui, x = 20, y = 40 + (i-1)*19, character = unit.character, level = unit.level, force_update = true, cant_click = true, parent = self} @@ -482,13 +490,6 @@ function Arena:quit() self.try_loop_text = Text2{group = self.ui, x = gw - 144, y = gh - 20, force_update = true, lines = { {text = '[bg10]continue run (+difficulty):', font = pixul_font}, }} - local open_url = function(b, url) - ui_switch2:play{pitch = random:float(0.95, 1.05), volume = 0.5} - b.spring:pull(0.2, 200, 10) - b.selected = true - ui_switch1:play{pitch = random:float(0.95, 1.05), volume = 0.5} - system.open_url(url) - end Button{group = self.ui, x = gw/2 - 50 + 40, y = gh/2 + 12, force_update = true, button_text = 'nimble quest', fg_color = 'bluem5', bg_color = 'blue', action = function(b) open_url(b, 'https://store.steampowered.com/app/259780/Nimble_Quest/') end} Button{group = self.ui, x = gw/2 + 50 + 40, y = gh/2 + 12, force_update = true, button_text = 'dota underlords', fg_color = 'bluem5', bg_color = 'blue', action = function(b) open_url(b, 'https://store.steampowered.com/app/1046930/Dota_Underlords/') end} diff --git a/buy_screen.lua b/buy_screen.lua index 96b4525..c6eb805 100644 --- a/buy_screen.lua +++ b/buy_screen.lua @@ -1443,7 +1443,7 @@ function ItemCard:update(dt) end self.parent.shop_text:set_text{{text = '[wavy_mid, fg]shop [fg]- [fg, nudge_down]gold: [yellow, nudge_down]' .. gold, font = pixul_font, alignment = 'center'}} self.text = Text({{text = '[bg10]' .. tostring(self.parent.shop_level), font = pixul_font, alignment = 'center'}}, global_text_tags) - system.save_run(self.parent.level, gold, self.parent.units, self.parent.passives, self.parent.shop_level, self.parent.shop_xp, run_passive_pool, locked_state) + system.save_run(self.parent.level, self.parent.loop, gold, self.parent.units, self.parent.passives, self.parent.shop_level, self.parent.shop_xp, run_passive_pool, locked_state) end end @@ -1453,7 +1453,7 @@ function ItemCard:update(dt) table.remove(self.parent.passives, self.i) input.m2.pressed = false self.parent:set_items() - system.save_run(self.parent.level, gold, self.parent.units, self.parent.passives, self.parent.shop_level, self.parent.shop_xp, run_passive_pool, locked_state) + system.save_run(self.parent.level, self.parent.loop, gold, self.parent.units, self.parent.passives, self.parent.shop_level, self.parent.shop_xp, run_passive_pool, locked_state) end end diff --git a/enemies.lua b/enemies.lua index 08f7c6b..5eca980 100644 --- a/enemies.lua +++ b/enemies.lua @@ -549,6 +549,7 @@ function Seeker:hit(damage, projectile, dot, from_enemy) if main.current.mercenary_level > 0 then if random:bool((main.current.mercenary_level == 2 and 16) or (main.current.mercenary_level == 1 and 8) or 0) then trigger:after(0.01, function() + if not main.current.main.world then return end Gold{group = main.current.main, x = self.x, y = self.y} end) end @@ -652,6 +653,7 @@ function Seeker:hit(damage, projectile, dot, from_enemy) if main.current.player.ceremonial_dagger and not from_enemy then trigger:after(0.01, function() if tostring(self.x) == tostring(0/0) or tostring(self.y) == tostring(0/0) then return end + if not main.current.main.world then return end _G[random:table{'scout1', 'scout2'}]:play{pitch = random:float(0.95, 1.05), volume = 0.35} HitCircle{group = main.current.effects, x = self.x, y = self.y, rs = 6} local r = random:float(0, 2*math.pi) @@ -663,6 +665,7 @@ function Seeker:hit(damage, projectile, dot, from_enemy) if main.current.player.homing_barrage and not from_enemy then trigger:after(0.01, function() + if not main.current.player then return end if random:bool((main.current.player.homing_barrage == 1 and 8) or (main.current.player.homing_barrage == 2 and 16) or (main.current.player.homing_barrage == 3 and 24)) then local target = main.current.player:get_closest_object_in_shape(Circle(main.current.player.x, main.current.player.y, 128), main.current.enemies) main.current.player:barrage(target and main.current.player:angle_to_object(target) or main.current.player.r, 4, nil, nil, nil, true) @@ -672,6 +675,7 @@ function Seeker:hit(damage, projectile, dot, from_enemy) if main.current.player.infesting_strike and not from_enemy then trigger:after(0.01, function() + if not main.current.player then return end if random:bool((main.current.player.infesting_strike == 1 and 10) or (main.current.player.infesting_strike == 2 and 20) or (main.current.player.infesting_strike == 3 and 30)) then critter1:play{pitch = random:float(0.95, 1.05), volume = 0.5} for i = 1, 2 do @@ -683,6 +687,7 @@ function Seeker:hit(damage, projectile, dot, from_enemy) if main.current.player.lucky_strike and not from_enemy then if random:bool(8) then + if not main.current.main.world then return end trigger:after(0.01, function() Gold{group = main.current.main, x = self.x, y = self.y} end) @@ -691,6 +696,7 @@ function Seeker:hit(damage, projectile, dot, from_enemy) if main.current.player.healing_strike and not from_enemy then if random:bool(8) then + if not main.current.main.world then return end trigger:after(0.01, function() HealingOrb{group = main.current.main, x = self.x, y = self.y} end) @@ -817,8 +823,10 @@ function ExploderMine:init(args) for i = 1, 4 do HitParticle{group = main.current.effects, x = self.x, y = self.y, r = random:float(0, 2*math.pi), color = self.color} end HitCircle{group = main.current.effects, x = self.x, y = self.y} local n = math.floor(8 + current_new_game_plus*1.5) - for i = 1, n do - EnemyProjectile{group = main.current.main, x = self.x, y = self.y, color = blue[0], r = (i-1)*math.pi/(n/2), v = 120 + math.min(5*self.parent.level, 300), dmg = 1.3*self.parent.dmg} + if main.current.main.world then + for i = 1, n do + EnemyProjectile{group = main.current.main, x = self.x, y = self.y, color = blue[0], r = (i-1)*math.pi/(n/2), v = 120 + math.min(5*self.parent.level, 300), dmg = 1.3*self.parent.dmg} + end end self.dead = true end, 'mine_count') diff --git a/player.lua b/player.lua index 608be36..14f6f7d 100644 --- a/player.lua +++ b/player.lua @@ -648,7 +648,7 @@ function Player:init(args) local r = self:angle_to_object(closest_enemy) self.barrager_counter = self.barrager_counter + 1 if self.barrager_counter == 3 and self.level == 3 then - self.barrage_counter = 0 + self.barrager_counter = 0 for i = 1, 15 do self.t:after((i-1)*0.05, function() self:shoot(r + random:float(-math.pi/32, math.pi/32), {knockback = (self.level == 3 and 14 or 7)}) @@ -2365,6 +2365,7 @@ function Projectile:on_trigger_enter(other, contact) local src = other for j = 1, 3 do main.current.t:after((j-1)*0.1, function() + if not self.parent then return end _G[random:table{'spark1', 'spark2', 'spark3'}]:play{pitch = random:float(0.9, 1.1), volume = 0.3} for i = 1, 3 do table.insert(self.infused_enemies_hit, src) @@ -3102,13 +3103,18 @@ function Sentry:init(args) self.t:every({2.75, 3.5}, function() self.hfx:use('hit', 0.25, 200, 10) local r = self.r - for i = 1, 4 do - archer1:play{pitch = random:float(0.95, 1.05), volume = 0.35} - HitCircle{group = main.current.effects, x = self.x + 0.8*self.shape.w*math.cos(r), y = self.y + 0.8*self.shape.w*math.sin(r), rs = 6} - local t = {group = main.current.main, x = self.x + 1.6*self.shape.w*math.cos(r), y = self.y + 1.6*self.shape.w*math.sin(r), v = 200, r = r, color = self.color, - dmg = self.parent.dmg*(self.parent.conjurer_buff_m or 1), character = 'sentry', parent = self.parent, ricochet = self.parent.level == 3 and 2 or 0} - Projectile(table.merge(t, mods or {})) - r = r + math.pi/2 + local n = random:bool((main.current.ranger_level == 2 and 16) or (main.current.ranger_level == 1 and 8) or 0) and 4 or 1 + for j = 1, n do + self.t:after((j-1)*0.1, function() + for i = 1, 4 do + archer1:play{pitch = random:float(0.95, 1.05), volume = 0.35} + HitCircle{group = main.current.effects, x = self.x + 0.8*self.shape.w*math.cos(r), y = self.y + 0.8*self.shape.w*math.sin(r), rs = 6} + local t = {group = main.current.main, x = self.x + 1.6*self.shape.w*math.cos(r), y = self.y + 1.6*self.shape.w*math.sin(r), v = 200, r = r, color = self.color, + dmg = self.parent.dmg*(self.parent.conjurer_buff_m or 1), character = 'sentry', parent = self.parent, ricochet = self.parent.level == 3 and 2 or 0} + Projectile(table.merge(t, mods or {})) + r = r + math.pi/2 + end + end) end if self.parent.taunt and random:bool((self.parent.taunt == 1 and 10) or (self.parent.taunt == 2 and 20) or (self.parent.taunt == 3 and 30)) then @@ -3651,6 +3657,8 @@ end function Gold:update(dt) self:update_game_object(dt) self.r = self:get_angle() + if not self.magnet_sensor then return end + if not self.weak_magnet_sensor then return end local players = self:get_objects_in_shape(main.current.player.magnetism and self.magnet_sensor or self.weak_magnet_sensor, {Player}) if players and #players > 0 then @@ -3763,6 +3771,8 @@ end function HealingOrb:update(dt) self:update_game_object(dt) self.r = self:get_angle() + if not self.magnet_sensor then return end + if not self.weak_magnet_sensor then return end local players = self:get_objects_in_shape(main.current.player.magnetism and self.magnet_sensor or self.weak_magnet_sensor, {Player}) if players and #players > 0 then