1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-08 00:39:30 +02:00

biter_battles_v2 game_won kaboom

This commit is contained in:
MewMew 2019-03-18 10:15:51 +01:00
parent 953c43036d
commit 4edc185c5f
7 changed files with 58 additions and 29 deletions

View File

@ -3,8 +3,8 @@ local math_random = math.random
local ai = {}
local threat_values = {
["small-spitter"] = 1,
["small-biter"] = 1,
["small-spitter"] = 1.5,
["small-biter"] = 1.5,
["medium-spitter"] = 4,
["medium-biter"] = 4,
["big-spitter"] = 8,

View File

@ -3,28 +3,28 @@ local event = require 'utils.event'
local info = [[
- - B I T E R B A T T L E S - -
Your goal is to defend your team's rocket silo and defeat the other team.
Feeding science packs via the gui buttons,
increases the strength of the opposing team's biters.
Your goal is to defend your team's rocket silo and defeat the other team.
Feed the opponent's biters with science packs to increase their strength.
High tier science juice will yield stronger results.
There is no major direct pvp combat
The horizontal border river is landfill proof.
Construction robots can not build on the other teams's side.
There is no biter evolution from pollution, time or destruction.
ONLY feeding them increases their power and will lead to your teams victory.
ONLY feeding increases their power and will lead to your teams victory.
The gui yields two different main stats for each team's biters.
- EVO -
The evolution of the biters.
It can go above 100% which unlocks endgame modifiers,
granting biters increased damage and evasion.
granting them increased damage and evasion.
- THREAT -
Threat creates biter attacks.
Feeding gives permanent "threat-income", as well as creating instant threat.
A high threat value will cause more biters to attack.
A threat of zero or below will cause no attacks.
A high threat value causes big attacks.
Values of zero or below will cause no attacks.
]]
local function create_map_intro_button(player)

View File

@ -8,8 +8,8 @@ local event = require 'utils.event'
local function init_surface()
local map_gen_settings = {}
map_gen_settings.water = "0.25"
map_gen_settings.starting_area = "4.5"
map_gen_settings.water = "0.35"
map_gen_settings.starting_area = "4.25"
map_gen_settings.cliff_settings = {cliff_elevation_interval = 12, cliff_elevation_0 = 32}
map_gen_settings.autoplace_controls = {
["coal"] = {frequency = "2", size = "1", richness = "1"},
@ -19,7 +19,7 @@ local function init_surface()
["uranium-ore"] = {frequency = "2", size = "1", richness = "1"},
["crude-oil"] = {frequency = "3", size = "1", richness = "1"},
["trees"] = {frequency = "1", size = "0.5", richness = "0.7"},
["enemy-base"] = {frequency = "2", size = "3", richness = "1"}
["enemy-base"] = {frequency = "4", size = "2", richness = "2"}
}
game.create_surface("biter_battles", map_gen_settings)

View File

@ -61,7 +61,7 @@ local function feed_biters(player, food)
local e = (global.bb_evolution[biter_force_name] * 100) + 1
--local diminishing_modifier = 1 / (10 ^ (e * 0.03))
local diminishing_modifier = (1 / (10 ^ (e * 0.014))) / (e * 0.5)
global.bb_threat_income[biter_force_name] = global.bb_threat_income[biter_force_name] + (food_values[food].value * diminishing_modifier * 10)
global.bb_threat_income[biter_force_name] = global.bb_threat_income[biter_force_name] + (food_values[food].value * diminishing_modifier * 15)
---SET EVOLUTION
local e = (game.forces[biter_force_name].evolution_factor * 100) + 1
@ -75,12 +75,12 @@ local function feed_biters(player, food)
end
--ADD INSTANT THREAT
global.bb_threat[biter_force_name] = global.bb_threat[biter_force_name] + (food_values[food].value * 100 * flask_amount)
global.bb_threat[biter_force_name] = global.bb_threat[biter_force_name] + (food_values[food].value * 200 * flask_amount)
set_biter_endgame_damage(biter_force_name, game.forces[biter_force_name])
global.bb_evasion[biter_force_name] = (global.bb_evolution[biter_force_name] - 1) * 333
if global.bb_evasion[biter_force_name] > 900 then global.bb_evasion[biter_force_name] = 900 end
if global.bb_evasion[biter_force_name] > 950 then global.bb_evasion[biter_force_name] = 950 end
end
return feed_biters

View File

@ -28,9 +28,9 @@ local function destroy_entity(e)
e.die()
end
local function annihilate_base(center_pos, surface, force_name)
local function annihilate_base_old(center_pos, surface, force_name)
local entities = {}
for _, e in pairs(surface.find_entities_filtered({force = force_name, area = {{center_pos.x - 40, center_pos.y - 40},{center_pos.x + 40, center_pos.y + 40}}})) do
for _, e in pairs(surface.find_entities_filtered({force = force_name, area = {{center_pos.x - 32, center_pos.y - 32},{center_pos.x + 32, center_pos.y + 32}}})) do
if e.name ~= "player" then
entities[#entities + 1] = e
end
@ -51,7 +51,7 @@ local function annihilate_base(center_pos, surface, force_name)
end
for i = 1, #entities, 1 do
local t = i * 5
local t = i * 2
if not global.on_tick_schedule[game.tick + t] then global.on_tick_schedule[game.tick + t] = {} end
local pos = global.rocket_silo[global.bb_game_won_by_team].position
global.on_tick_schedule[game.tick + t][#global.on_tick_schedule[game.tick + t] + 1] = {
@ -61,6 +61,33 @@ local function annihilate_base(center_pos, surface, force_name)
end
end
local function annihilate_base(center_pos, surface, force_name)
local entities = {}
for _, e in pairs(surface.find_entities_filtered({force = force_name, area = {{center_pos.x - 128, center_pos.y - 128},{center_pos.x + 128, center_pos.y + 128}}})) do
if e.name ~= "player" then
if e.valid then
local distance_to_center = math.ceil(math.sqrt((e.position.x - center_pos.x)^2 + (e.position.y - center_pos.y)^2))
if not entities[distance_to_center] then entities[distance_to_center] = {} end
entities[distance_to_center][#entities[distance_to_center] + 1] = e
end
end
end
if #entities == 0 then return end
local t = 1
for i1, entity_list in pairs(entities) do
for i2, e in pairs(entity_list) do
if not global.on_tick_schedule[game.tick + t] then global.on_tick_schedule[game.tick + t] = {} end
global.on_tick_schedule[game.tick + t][#global.on_tick_schedule[game.tick + t] + 1] = {
func = destroy_entity,
args = {e}
}
t = t + 3
end
end
end
local function create_fireworks_rocket(surface, position)
local particles = {"coal-particle", "copper-ore-particle", "iron-ore-particle", "stone-particle"}
local particle = particles[math.random(1, #particles)]

View File

@ -39,21 +39,25 @@ local function create_team_lock_gui(player)
if player.admin == false and global.teams_are_locked ~= true then return end
local caption = "Teams unlocked"
local caption = "Unlocked"
local color = {r = 0.33, g = 0.77, b = 0.33}
local width = 68
local tooltip = "Lock teams to disable joining"
if global.teams_are_locked then
caption = "Teams locked"
caption = "Teams Locked"
color = {r = 0.77, g = 0.33, b = 0.33}
width = 100
tooltip = "An admin has locked the teams, joining is currently disabled"
end
local button = player.gui.top.add({type = "sprite-button", name = "bb_team_lock_button", caption = caption})
local button = player.gui.top.add({type = "sprite-button", name = "bb_team_lock_button", caption = caption, tooltip = tooltip})
button.style.font = "heading-2"
button.style.font_color = color
button.style.minimal_height = 38
button.style.minimal_width = 120
button.style.minimal_width = width
button.style.top_padding = 2
button.style.left_padding = 4
button.style.right_padding = 4
button.style.left_padding = 0
button.style.right_padding = 0
button.style.bottom_padding = 2
end

View File

@ -25,7 +25,6 @@ local function get_noise(name, pos)
noise[2] = simplex_noise(pos.x * 0.05, pos.y * 0.05, seed)
seed = seed + noise_seed_add
local noise = noise[1] + noise[2] * 0.1
--noise = noise * 0.5
return noise
end
if name == 2 then
@ -35,7 +34,6 @@ local function get_noise(name, pos)
noise[2] = simplex_noise(pos.x * 0.07, pos.y * 0.07, seed)
seed = seed + noise_seed_add
local noise = noise[1] + noise[2] * 0.2
--noise = noise * 0.5
return noise
end
end
@ -166,8 +164,8 @@ local function rainbow_ore_and_ponds(event)
if i == 0 then i = 4 end
surface.create_entity({name = ores[i], position = pos, amount = amount})
end
if noise < -0.83 then
if noise < -0.9 then
if noise < -0.85 then
if noise < -0.91 then
surface.set_tiles({{name = "deepwater", position = pos}})
else
surface.set_tiles({{name = "water", position = pos}})