From b02c117218e0a58d4a806c98562b85152ee253c4 Mon Sep 17 00:00:00 2001 From: Gerkiz Date: Sat, 2 May 2020 11:45:59 +0200 Subject: [PATCH] moar scrappy changes --- maps/scrapyard/balance.lua | 233 ++++++++++++++++++--------------- maps/scrapyard/locomotive.lua | 24 +++- maps/scrapyard/main.lua | 55 ++++---- maps/scrapyard/player_list.lua | 2 +- maps/scrapyard/rpg.lua | 4 +- 5 files changed, 180 insertions(+), 138 deletions(-) diff --git a/maps/scrapyard/balance.lua b/maps/scrapyard/balance.lua index 952dee6f..525c364d 100644 --- a/maps/scrapyard/balance.lua +++ b/maps/scrapyard/balance.lua @@ -1,126 +1,143 @@ --Hunger games balance things by Gerkiz -- local Event = require 'utils.event' -local player_ammo_starting_modifiers = { - ['artillery-shell'] = -0.75, - ['biological'] = -0.5, - ['bullet'] = -0.25, - ['cannon-shell'] = -0.75, - ['capsule'] = -0.5, - ['combat-robot-beam'] = -0.5, - ['combat-robot-laser'] = -0.5, - ['electric'] = -0.5, - ['flamethrower'] = -0.75, - ['grenade'] = -0.5, - ['landmine'] = -0.33, - ['laser-turret'] = -0.75, - ['melee'] = 2, - ['railgun'] = 1, - ['rocket'] = -0.75, - ['shotgun-shell'] = -0.20 -} +local function player_ammo_starting_modifiers() + local data = { + ['artillery-shell'] = -0.75, + ['biological'] = -0.5, + ['bullet'] = -0.25, + ['cannon-shell'] = -0.75, + ['capsule'] = -0.5, + ['combat-robot-beam'] = -0.5, + ['combat-robot-laser'] = -0.5, + ['electric'] = -0.5, + ['flamethrower'] = -0.75, + ['grenade'] = -0.5, + ['landmine'] = -0.33, + ['laser-turret'] = -0.75, + ['melee'] = 2, + ['railgun'] = 1, + ['rocket'] = -0.75, + ['shotgun-shell'] = -0.20 + } + return data +end -local player_gun_speed_modifiers = { - ['artillery-shell'] = -0.75, - ['biological'] = -0.5, - ['bullet'] = -0.55, - ['cannon-shell'] = -0.75, - ['capsule'] = -0.5, - ['combat-robot-beam'] = -0.5, - ['combat-robot-laser'] = -0.5, - ['electric'] = -0.5, - ['flamethrower'] = -0.75, - ['grenade'] = -0.5, - ['landmine'] = -0.33, - ['laser-turret'] = -0.75, - ['melee'] = 1, - ['railgun'] = 0, - ['rocket'] = -0.75, - ['shotgun-shell'] = -0.50 -} +local function player_gun_speed_modifiers() + local data = { + ['artillery-shell'] = -0.75, + ['biological'] = -0.5, + ['bullet'] = -0.55, + ['cannon-shell'] = -0.75, + ['capsule'] = -0.5, + ['combat-robot-beam'] = -0.5, + ['combat-robot-laser'] = -0.5, + ['electric'] = -0.5, + ['flamethrower'] = -0.75, + ['grenade'] = -0.5, + ['landmine'] = -0.33, + ['laser-turret'] = -0.75, + ['melee'] = 1, + ['railgun'] = 0, + ['rocket'] = -0.75, + ['shotgun-shell'] = -0.50 + } + return data +end +local function player_ammo_research_modifiers() + local data = { + ['artillery-shell'] = -0.75, + ['biological'] = -0.5, + ['bullet'] = -0.5, + ['cannon-shell'] = -0.85, + ['capsule'] = -0.5, + ['combat-robot-beam'] = -0.5, + ['combat-robot-laser'] = -0.5, + ['electric'] = -0.6, + ['flamethrower'] = -0.75, + ['grenade'] = -0.5, + ['landmine'] = -0.5, + ['laser-turret'] = -0.75, + ['melee'] = -0.5, + ['railgun'] = -0.5, + ['rocket'] = -0.5, + ['shotgun-shell'] = -0.20 + } + return data +end -local player_ammo_research_modifiers = { - ['artillery-shell'] = -0.75, - ['biological'] = -0.5, - ['bullet'] = -0.5, - ['cannon-shell'] = -0.85, - ['capsule'] = -0.5, - ['combat-robot-beam'] = -0.5, - ['combat-robot-laser'] = -0.5, - ['electric'] = -0.6, - ['flamethrower'] = -0.75, - ['grenade'] = -0.5, - ['landmine'] = -0.5, - ['laser-turret'] = -0.75, - ['melee'] = -0.5, - ['railgun'] = -0.5, - ['rocket'] = -0.5, - ['shotgun-shell'] = -0.20 -} +local function player_turrets_research_modifiers() + local data = { + ['gun-turret'] = -0.75, + ['laser-turret'] = -0.75, + ['flamethrower-turret'] = -0.75 + } + return data +end -local player_turrets_research_modifiers = { - ['gun-turret'] = -0.75, - ['laser-turret'] = -0.75, - ['flamethrower-turret'] = -0.75 -} +local function enemy_ammo_starting_modifiers() + local data = { + ['artillery-shell'] = 3, + ['biological'] = 3, + ['bullet'] = 2, + ['cannon-shell'] = 0, + ['capsule'] = 0, + ['combat-robot-beam'] = 0, + ['combat-robot-laser'] = 0, + ['electric'] = 0, + ['flamethrower'] = 0, + ['grenade'] = 0, + ['landmine'] = 0, + ['laser-turret'] = 3, + ['melee'] = 1, + ['railgun'] = 0, + ['rocket'] = 0, + ['shotgun-shell'] = 0 + } + return data +end -local enemy_ammo_starting_modifiers = { - ['artillery-shell'] = 3, - ['biological'] = 3, - ['bullet'] = 2, - ['cannon-shell'] = 0, - ['capsule'] = 0, - ['combat-robot-beam'] = 0, - ['combat-robot-laser'] = 0, - ['electric'] = 0, - ['flamethrower'] = 0, - ['grenade'] = 0, - ['landmine'] = 0, - ['laser-turret'] = 3, - ['melee'] = 1, - ['railgun'] = 0, - ['rocket'] = 0, - ['shotgun-shell'] = 0 -} - -local enemy_ammo_evolution_modifiers = { - ['artillery-shell'] = 1, - ['biological'] = 2, - ['bullet'] = 1, - --['cannon-shell'] = 1, - --['capsule'] = 1, - --['combat-robot-beam'] = 1, - --['combat-robot-laser'] = 1, - --['electric'] = 1, - ['flamethrower'] = 2, - --['grenade'] = 1, - --['landmine'] = 1, - ['laser-turret'] = 2, - ['melee'] = 2 - --['railgun'] = 1, - --['rocket'] = 1, - --['shotgun-shell'] = 1 -} +local function enemy_ammo_evolution_modifiers() + local data = { + ['artillery-shell'] = 1, + ['biological'] = 2, + ['bullet'] = 1, + --['cannon-shell'] = 1, + ['capsule'] = 1, + ['combat-robot-beam'] = 1, + ['combat-robot-laser'] = 1, + ['electric'] = 1, + ['flamethrower'] = 2, + --['grenade'] = 1, + --['landmine'] = 1, + ['laser-turret'] = 2, + ['melee'] = 2 + --['railgun'] = 1, + --['rocket'] = 1, + --['shotgun-shell'] = 1 + } + return data +end local function init_player_weapon_damage(force) - for k, v in pairs(player_ammo_starting_modifiers) do + for k, v in pairs(player_ammo_starting_modifiers()) do force.set_ammo_damage_modifier(k, v) end - for k, v in pairs(player_gun_speed_modifiers) do + for k, v in pairs(player_gun_speed_modifiers()) do force.set_gun_speed_modifier(k, v) end end local function init_enemy_weapon_damage() - local e_force, scrap, scrap_defense = game.forces["enemy"], game.forces["scrap"], game.forces["scrap_defense"] + local e, s, sd = game.forces["enemy"], game.forces["scrap"], game.forces["scrap_defense"] - for k, v in pairs(enemy_ammo_starting_modifiers) do - e_force.set_ammo_damage_modifier(k, v) - scrap.set_ammo_damage_modifier(k, v) - scrap_defense.set_ammo_damage_modifier(k, v) + for k, v in pairs(enemy_ammo_starting_modifiers()) do + e.set_ammo_damage_modifier(k, v) + s.set_ammo_damage_modifier(k, v) + sd.set_ammo_damage_modifier(k, v) end end @@ -129,8 +146,8 @@ local function enemy_weapon_damage() local ef = e.evolution_factor - for k, v in pairs(enemy_ammo_evolution_modifiers) do - local base = enemy_ammo_starting_modifiers[k] + for k, v in pairs(enemy_ammo_evolution_modifiers()) do + local base = enemy_ammo_starting_modifiers()[k] local new = base + v * ef e.set_ammo_damage_modifier(k, new) @@ -148,7 +165,7 @@ local function research_finished(event) if t == 'ammo-damage' then local category = e.ammo_category - local factor = player_ammo_research_modifiers[category] + local factor = player_ammo_research_modifiers()[category] if factor then local current_m = p_force.get_ammo_damage_modifier(category) @@ -157,7 +174,7 @@ local function research_finished(event) end elseif t == 'turret-attack' then local category = e.turret_id - local factor = player_turrets_research_modifiers[category] + local factor = player_turrets_research_modifiers()[category] if factor then local current_m = p_force.get_turret_attack_modifier(category) @@ -166,7 +183,7 @@ local function research_finished(event) end elseif t == 'gun-speed' then local category = e.ammo_category - local factor = player_gun_speed_modifiers[category] + local factor = player_gun_speed_modifiers()[category] if factor then local current_m = p_force.get_gun_speed_modifier(category) diff --git a/maps/scrapyard/locomotive.lua b/maps/scrapyard/locomotive.lua index 1ffa7800..1ba0e16e 100644 --- a/maps/scrapyard/locomotive.lua +++ b/maps/scrapyard/locomotive.lua @@ -244,6 +244,26 @@ local function on_gui_opened(event) if event.entity.name == "market" then refresh_market(data) return end end +--local function distance(data) +-- local sqrt = math.sqrt +-- local floor = math.floor +-- local player = data.player +-- local rpg = data.rpg +-- local distance_to_center = floor(sqrt(player.position.x ^ 2 + player.position.y ^ 2)) +-- local location = distance_to_center +-- if location < 950 then return end +-- local min = 960 * rpg[player.index].bonus +-- local max = 965 * rpg[player.index].bonus +-- local min_times = location >= min +-- local max_times = location <= max +-- if min_times and max_times then +-- rpg[player.index].bonus = rpg[player.index].bonus + 1 +-- player.print("[color=blue]Grandmaster:[/color] Survivor! Well done.") +-- Public.gain_xp(player, 300 * rpg[player.index].bonus) +-- return +-- end +--end + local function property_boost(data) local surface = data.surface local rng = math.random @@ -260,7 +280,7 @@ local function property_boost(data) if player.surface ~= surface then return end if Public.contains_positions(player.position, area) then local pos = player.position - RPG.gain_xp(player, 0.2) + RPG.gain_xp(player, 0.2 * rpg[player.index].bonus) player.create_local_flying_text{text="+" .. "", position={x=pos.x, y=pos.y-2}, color=xp_floating_text_color, time_to_live=120, speed=2} rpg[player.index].xp_since_last_floaty_text = 0 rpg[player.index].last_floaty_text = game.tick + visuals_delay @@ -439,7 +459,7 @@ local function tick() Public.power_source_overworld() Public.power_source_locomotive() Public.place_market() - if game.tick % 90 == 0 then + if game.tick % 120 == 0 then Public.boost_players_around_train() end if game.tick % 30 == 0 then diff --git a/maps/scrapyard/main.lua b/maps/scrapyard/main.lua index 570031d2..508605aa 100644 --- a/maps/scrapyard/main.lua +++ b/maps/scrapyard/main.lua @@ -57,11 +57,13 @@ local treasure_chest_messages = { } local rare_treasure_chest_messages = { - "Your magic improves. You have found a chest that is filled with rare treasure!", + "Your magic improves. You have found a chest that is filled with rare treasures!", "Oh wonderful magic. You found a chest underneath the broken rocks. It's filled with rare goodies!", "You're a wizard Harry! We has found the rare precious!", } +local grandmaster = "[color=blue]Grandmaster:[/color]" + local function shuffle(tbl) local size = #tbl for i = size, 1, -1 do @@ -373,7 +375,7 @@ local function on_player_changed_position(event) if position.y < 5 then Terrain.reveal(player) end if position.y >= 190 then player.teleport({position.x, position.y - 1}, surface) - player.print("[color=blue]Grandmaster:[/color] Forcefield does not approve.",{r=0.98, g=0.66, b=0.22}) + player.print(grandmaster .. " Forcefield does not approve.",{r=0.98, g=0.66, b=0.22}) if player.character then player.character.health = player.character.health - 5 player.character.surface.create_entity({name = "water-splash", position = position}) @@ -401,10 +403,10 @@ local function on_player_joined_game(event) end if not this.players[player.index].first_join then - player.print("[color=blue]Grandmaster:[/color] Greetings, newly joined " .. player.name .. "!", {r = 1, g = 0.5, b = 0.1}) - player.print("[color=blue]Grandmaster:[/color] Please read the map info.", {r = 1, g = 0.5, b = 0.1}) - player.print("[color=blue]Grandmaster:[/color] Guide the choo through the black mist.", {r = 1, g = 0.5, b = 0.1}) - player.print("[color=blue]Grandmaster:[/color] To disable rainbow mode, type in console: /rainbow_mode", Color.info) + player.print(grandmaster .. " Greetings, newly joined " .. player.name .. "!", {r = 1, g = 0.5, b = 0.1}) + player.print(grandmaster .. " Please read the map info.", {r = 1, g = 0.5, b = 0.1}) + player.print(grandmaster .. " Guide the choo through the black mist.", {r = 1, g = 0.5, b = 0.1}) + player.print(grandmaster .. " To disable rainbow mode, type in console: /rainbow_mode", Color.info) this.players[player.index].first_join = true end @@ -540,7 +542,7 @@ local function on_player_repaired_entity(event) if not event.entity.health then return end local entity = event.entity if entity == this.locomotive_cargo or entity == this.locomotive then - set_objective_health(entity, -4) + set_objective_health(entity, -1) end end @@ -551,8 +553,8 @@ function Public.loco_died() if not this.locomotive.valid then wave_defense_table.game_lost = true wave_defense_table.target = nil - game.print("[color=blue]Grandmaster:[/color] Oh noooeeeew, the void destroyed my train!", {r = 1, g = 0.5, b = 0.1}) - game.print("[color=blue]Grandmaster:[/color] Better luck next time.", {r = 1, g = 0.5, b = 0.1}) + game.print(grandmaster .. " Oh noooeeeew, the void destroyed my train!", {r = 1, g = 0.5, b = 0.1}) + game.print(grandmaster .. " Better luck next time.", {r = 1, g = 0.5, b = 0.1}) Public.reset_map() return end @@ -561,9 +563,9 @@ function Public.loco_died() rendering.set_text(this.health_text, "HP: " .. this.locomotive_health .. " / " .. this.locomotive_max_health) wave_defense_table.game_lost = true wave_defense_table.target = nil - game.print("[color=blue]Grandmaster:[/color] Oh noooeeeew, they destroyed my train!", {r = 1, g = 0.5, b = 0.1}) - game.print("[color=blue]Grandmaster:[/color] Better luck next time.", {r = 1, g = 0.5, b = 0.1}) - game.print("[color=blue]Grandmaster:[/color] Game will soft-reset shortly.", {r = 1, g = 0.5, b = 0.1}) + game.print(grandmaster .. " Oh noooeeeew, they destroyed my train!", {r = 1, g = 0.5, b = 0.1}) + game.print(grandmaster .. " Better luck next time.", {r = 1, g = 0.5, b = 0.1}) + game.print(grandmaster .. " Game will soft-reset shortly.", {r = 1, g = 0.5, b = 0.1}) local fake_shooter = surface.create_entity({name = "character", position = this.locomotive.position, force = "enemy"}) surface.create_entity({name = "atomic-rocket", position = this.locomotive.position, force = "enemy", speed = 1, max_range = 800, target = this.locomotive, source = fake_shooter}) @@ -630,7 +632,7 @@ local function on_built_entity(event) local y = event.created_entity.position.y local ent = event.created_entity if y >= 150 then - player.print("[color=blue]Grandmaster:[/color] I do not approve, " .. ent.name .. " was obliterated.", {r = 1, g = 0.5, b = 0.1}) + player.print(grandmaster .. " I do not approve, " .. ent.name .. " was obliterated.", {r = 1, g = 0.5, b = 0.1}) ent.die() return else @@ -639,7 +641,7 @@ local function on_built_entity(event) if y >= 0 then ent.active = false if event.player_index then - player.print("[color=blue]Grandmaster:[/color] Can't build here. I disabled your " .. ent.name ..".", {r = 1, g = 0.5, b = 0.1}) + player.print(grandmaster .. " Can't build here. I disabled your " .. ent.name ..".", {r = 1, g = 0.5, b = 0.1}) return end end @@ -660,7 +662,7 @@ local function on_robot_built_entity(event) local y = event.created_entity.position.y local ent = event.created_entity if y >= 150 then - game.print("[color=blue]Grandmaster:[/color] I do not approve, " .. ent.name .. " was obliterated.", {r = 1, g = 0.5, b = 0.1}) + game.print(grandmaster .. " I do not approve, " .. ent.name .. " was obliterated.", {r = 1, g = 0.5, b = 0.1}) ent.die() return else @@ -669,7 +671,7 @@ local function on_robot_built_entity(event) if y >= 0 then ent.active = false if event.player_index then - game.print("[color=blue]Grandmaster:[/color] Can't build here. I disabled your " .. ent.name ..".", {r = 1, g = 0.5, b = 0.1}) + game.print(grandmaster .. " Can't build here. I disabled your " .. ent.name ..".", {r = 1, g = 0.5, b = 0.1}) return end end @@ -685,8 +687,9 @@ local on_init = function() game.forces.enemy.set_friend('scrap', true) game.forces.scrap.set_friend('player', true) game.forces.scrap.set_friend('enemy', true) + game.forces.player.technologies["land-mine"].enabled = false game.forces.scrap.share_chart = false - global.rocks_yield_ore_maximum_amount = 999 + global.rocks_yield_ore_maximum_amount = 500 global.rocks_yield_ore_base_amount = 50 global.rocks_yield_ore_distance_modifier = 0.025 Public.reset_map() @@ -724,7 +727,9 @@ local on_init = function() "Moved comfylatron to overworld, 'lil bugger was causing issues\n", "RPG now has a global XP pool\n", "Locomotive has now market upgrades\n", - "XP is granted after each breached wall\n" + "XP is granted after each breached wall\n", + "Train now has a XP aura, stay near it!\n", + "Aura increases after each breach wall" }) T.main_caption_color = {r = 150, g = 150, b = 0} T.sub_caption_color = {r = 0, g = 150, b = 0} @@ -751,8 +756,8 @@ local function darkness(data) local surface = data.surface if rnd(1, 64) == 1 then if this.freeze_daytime then return end - game.print("[color=blue]Grandmaster:[/color] Darkness has surrounded us!", {r = 1, g = 0.5, b = 0.1}) - game.print("[color=blue]Grandmaster:[/color] Builds some lamps!", {r = 1, g = 0.5, b = 0.1}) + game.print(grandmaster .. " Darkness has surrounded us!", {r = 1, g = 0.5, b = 0.1}) + game.print(grandmaster .. " Builds some lamps!", {r = 1, g = 0.5, b = 0.1}) surface.min_brightness = 0 surface.brightness_visual_weights = {0.90, 0.90, 0.90} surface.daytime = 0.42 @@ -762,7 +767,7 @@ local function darkness(data) return elseif rnd(1, 32) == 1 then if not this.freeze_daytime then return end - game.print("[color=blue]Grandmaster:[/color] Sunlight, finally!", {r = 1, g = 0.5, b = 0.1}) + game.print(grandmaster .. " Sunlight, finally!", {r = 1, g = 0.5, b = 0.1}) surface.min_brightness = 1 surface.brightness_visual_weights = {1, 0, 0, 0} surface.daytime = 0.7 @@ -780,14 +785,14 @@ local function scrap_randomness(data) if rnd(1, 64) == 1 then if not this.scrap_enabled then return end this.scrap_enabled = false - game.print("[color=blue]Grandmaster:[/color] It seems that the scrap is temporarily gone.", {r = 1, g = 0.5, b = 0.1}) - game.print("[color=blue]Grandmaster:[/color] Output from scrap is now only ores.", {r = 1, g = 0.5, b = 0.1}) + game.print(grandmaster .. " It seems that the scrap is temporarily gone.", {r = 1, g = 0.5, b = 0.1}) + game.print(grandmaster .. " Output from scrap is now only ores.", {r = 1, g = 0.5, b = 0.1}) return elseif rnd(1, 32) == 1 then if this.scrap_enabled then return end this.scrap_enabled = true - game.print("[color=blue]Grandmaster:[/color] Scrap is back!", {r = 1, g = 0.5, b = 0.1}) - game.print("[color=blue]Grandmaster:[/color] Output from scrap is now randomized.", {r = 1, g = 0.5, b = 0.1}) + game.print(grandmaster .. " Scrap is back!", {r = 1, g = 0.5, b = 0.1}) + game.print(grandmaster .. " Output from scrap is now randomized.", {r = 1, g = 0.5, b = 0.1}) return end end diff --git a/maps/scrapyard/player_list.lua b/maps/scrapyard/player_list.lua index 6420cb82..577f1cda 100644 --- a/maps/scrapyard/player_list.lua +++ b/maps/scrapyard/player_list.lua @@ -183,7 +183,7 @@ local function player_list_show(player, frame, sort_by) -- Header management local t = frame.add { type = "table", name = "player_list_panel_header_table", column_count = 6 } - local column_widths = {tonumber(40), tonumber(150), tonumber(150), tonumber(150), tonumber(150), tonumber(100)} + local column_widths = {tonumber(60), tonumber(150), tonumber(125), tonumber(150), tonumber(150), tonumber(100)} for _, w in ipairs(column_widths) do local label = t.add { type = "label", caption = "" } label.style.minimal_width = w diff --git a/maps/scrapyard/rpg.lua b/maps/scrapyard/rpg.lua index d730b5a4..8f0831b1 100644 --- a/maps/scrapyard/rpg.lua +++ b/maps/scrapyard/rpg.lua @@ -462,12 +462,12 @@ end function Public.gain_xp(player, amount) local fee if rpg_t[player.index].xp > 50 then - fee = math.ceil(rpg_t[player.index].xp * 0.01, 0) / 6 + fee = amount * 0.3 else fee = 0 end amount = math_round(amount, 2) - fee - rpg_t.global_pool = rpg_t.global_pool + math_round(fee) + rpg_t.global_pool = rpg_t.global_pool + fee rpg_t[player.index].xp = rpg_t[player.index].xp + amount rpg_t[player.index].xp_since_last_floaty_text = rpg_t[player.index].xp_since_last_floaty_text + amount if player.gui.left.rpg then draw_gui(player, false) end