diff --git a/maps/fish_defender.lua b/maps/fish_defender.lua index a8123220..ca3aed43 100644 --- a/maps/fish_defender.lua +++ b/maps/fish_defender.lua @@ -8,6 +8,13 @@ local math_random = math.random local insert = table.insert local wave_interval = 3600 --interval between waves in ticks local biter_count_limit = 3600 --maximum biters on the east side of the map, next wave will be delayed if the maximum has been reached +local boss_waves = { + [50] = {{name = "big-biter", count = 3}}, + [100] = {{name = "behemoth-biter", count = 1}}, + [200] = {{name = "behemoth-biter", count = 3}, {name = "behemoth-spitter", count = 6}}, + [300] = {{name = "behemoth-biter", count = 8}, {name = "behemoth-spitter", count = 16}}, + [400] = {{name = "behemoth-biter", count = 16}, {name = "behemoth-spitter", count = 32}} +} local function shuffle(tbl) local size = #tbl @@ -238,6 +245,40 @@ local function clear_corpses(surface) end end +local function spawn_boss_units(surface) + if not boss_waves[global.wave_count] then return end + if global.wave_count == 50 then game.print("The Big Biter Gang", {r = 0.7, g = 0.1, b = 0.1}) end + if global.wave_count == 100 then game.print("Biterzilla", {r = 0.7, g = 0.1, b = 0.1}) end + local position = {x = 216, y = 0} + local biter_group = surface.create_unit_group({position = position}) + for _, entry in pairs(boss_waves[global.wave_count]) do + for x = 1, entry.count, 1 do + local pos = surface.find_non_colliding_position(entry.name, position, 64, 3) + if pos then + local biter = surface.create_entity({name = entry.name, position = pos}) + biter_group.add_member(biter) + end + end + end + biter_group.set_command({ + type = defines.command.compound, + structure_type = defines.compound_command.return_last, + commands = { + { + type=defines.command.attack_area, + destination={x = -32, y = 0}, + radius=16, + distraction=defines.distraction.by_anything + }, + { + type=defines.command.attack, + target=global.market, + distraction=defines.distraction.by_enemy + } + } + }) +end + local function biter_attack_wave() if not global.market then return end if global.wave_grace_period then return end @@ -267,33 +308,6 @@ local function biter_attack_wave() unit_search_distance=16 }) - if surface.count_entities_filtered({type = "unit", area = {{-128,-256},{360, 256}}}) > biter_count_limit then - game.print("Biter limit reached, wave stalled.", {r = 0.7, g = 0.1, b = 0.1}) - return - end - - if not global.wave_count then - global.wave_count = 1 - else - global.wave_count = global.wave_count + 1 - end - - global.attack_wave_threat = global.wave_count * 5 - if global.attack_wave_threat > 25000 then global.attack_wave_threat = 25000 end - - local evolution = global.wave_count * 0.00125 - if evolution > 1 then evolution = 1 end - game.forces.enemy.evolution_factor = evolution - - if game.forces.enemy.evolution_factor == 1 then - if not global.endgame_modifier then - global.endgame_modifier = 1 - game.print("Endgame enemy evolution reached. Biter damage is rising...", {r = 0.7, g = 0.1, b = 0.1}) - else - global.endgame_modifier = global.endgame_modifier + 1 - end - end - local units = surface.find_entities_filtered({type = "unit", area = {{192, -256},{360, 256}}}) for _, unit in pairs(units) do unit.set_command({ @@ -315,6 +329,40 @@ local function biter_attack_wave() }) end + if surface.count_entities_filtered({type = "unit", area = {{-128,-256},{360, 256}}}) > biter_count_limit then + game.print("Biter limit reached, wave stalled.", {r = 0.7, g = 0.1, b = 0.1}) + return + end + + if not global.wave_count then + global.wave_count = 1 + else + global.wave_count = global.wave_count + 1 + end + + if global.wave_count % 100 == 0 or global.wave_count == 50 then + game.print("Boss Wave " .. global.wave_count, {r = 0.7, g = 0.1, b = 0.1}) + global.attack_wave_threat = global.wave_count * 10 + spawn_boss_units(surface) + else + global.attack_wave_threat = global.wave_count * 5 + end + + if global.attack_wave_threat > 35000 then global.attack_wave_threat = 35000 end + + local evolution = global.wave_count * 0.00125 + if evolution > 1 then evolution = 1 end + game.forces.enemy.evolution_factor = evolution + + if game.forces.enemy.evolution_factor == 1 then + if not global.endgame_modifier then + global.endgame_modifier = 1 + game.print("Endgame enemy evolution reached. Biter damage is rising...", {r = 0.7, g = 0.1, b = 0.1}) + else + global.endgame_modifier = global.endgame_modifier + 1 + end + end + local units = surface.find_entities_filtered({force = "player", area = {{160, -256},{360, 256}}}) for _, unit in pairs(units) do if unit.health then @@ -700,18 +748,17 @@ local function on_entity_died(event) if event.entity.name == "behemoth-biter" then local spawn_entity = false - if global.wave_count >= 1000 then - spawn_entity = "small-worm-turret" - end - if global.wave_count >= 1500 then - spawn_entity = "medium-worm-turret" - end - if global.wave_count >= 2000 then - spawn_entity = "big-worm-turret" + if global.endgame_modifier then + if global.endgame_modifier > 500 then + spawn_entity = "big-worm-turret" + else + spawn_entity = "medium-worm-turret" + end end + if spawn_entity then local surface = event.entity.surface - if surface.count_entities_filtered({area = {{event.entity.position.x - 4, event.entity.position.y - 4},{event.entity.position.x + 4, event.entity.position.y + 4}}, name = spawn_entity}) == 0 then + if surface.count_entities_filtered({area = {{event.entity.position.x - 5, event.entity.position.y - 5},{event.entity.position.x + 5, event.entity.position.y + 5}}, name = spawn_entity}) == 0 then surface.create_entity({name = "blood-explosion-huge", position = event.entity.position}) surface.create_entity({name = spawn_entity, position = event.entity.position}) end @@ -809,11 +856,18 @@ local function on_player_joined_game(event) game.forces["player"].technologies["flamethrower-damage-5"].enabled = false game.forces["player"].technologies["flamethrower-damage-6"].enabled = false game.forces["player"].technologies["flamethrower-damage-7"].enabled = false + game.forces["player"].technologies["gun-turret-damage-1"].enabled = false + game.forces["player"].technologies["gun-turret-damage-2"].enabled = false + game.forces["player"].technologies["gun-turret-damage-3"].enabled = false + game.forces["player"].technologies["gun-turret-damage-4"].enabled = false + game.forces["player"].technologies["gun-turret-damage-5"].enabled = false + game.forces["player"].technologies["gun-turret-damage-6"].enabled = false + game.forces["player"].technologies["gun-turret-damage-7"].enabled = false game.forces.player.set_ammo_damage_modifier("shotgun-shell", 0.5) global.entity_limits = { - ["gun-turret"] = {placed = 1, limit = 1, str = "gun turret", slot_price = 75}, + ["gun-turret"] = {placed = 1, limit = 1, str = "gun turret", slot_price = 100}, ["laser-turret"] = {placed = 0, limit = 1, str = "laser turret", slot_price = 250}, ["artillery-turret"] = {placed = 0, limit = 1, str = "artillery turret", slot_price = 500}, ["flamethrower-turret"] = {placed = 0, limit = 0, str = "flamethrower turret", slot_price = 50000},