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

In progress again

This commit is contained in:
Piratux 2022-06-02 22:08:55 +03:00
parent 96f1463adb
commit 776a91fad2
7 changed files with 163 additions and 71 deletions

View File

@ -206,42 +206,58 @@ role_captain_description=Has executive power to undock the ship, purchase items,
class_deckhand=Deckhand
class_deckhand_explanation=They move faster and generate ore for the cabin whilst onboard above deck.
class_deckhand_explanation_advanced=Their move __1__x times faster and generate iron/copper ore(with current crew size +__2__ roughly every __3__ seconds) for the cabin whilst onboard above deck.
class_deckhand_explanation_advanced=They move __1__% times faster and generate iron/copper ore(with current crew size +__2__ roughly every __3__ seconds) for the cabin whilst onboard above deck.
class_fisherman=Fisherman
class_fisherman_explanation=They fish at greater distance.
class_fisherman_explanation_advanced=They fish() at greater distance(__1__ extra tile range).
class_fisherman_explanation_advanced=They fish(as well as reach objects as side effect) at greater distance(__1__ extra tile range).
class_scout=Scout
class_scout_explanation=They are faster, but frail and deal less damage.
class_scout_explanation_advanced=They move __1__% times faster, but receive __2__% more damage and deal __3__% less damage.
class_samurai=Samurai
class_samurai_explanation=They are tough, and *with no weapon equipped* fight well by melee, but poorly otherwise.
class_samurai_explanation_advanced=They receive __1__% less damage, and *with no weapon equipped* fight well by melee, but poorly otherwise.
class_merchant=Merchant
class_merchant_explanation=They generate 50 doubloons per league.
class_merchant_explanation_advanced=They generate 50 doubloons per league.
class_shoresman=Shoresman
class_shoresman_explanation=They move slightly faster and generate ore for the cabin whilst offboard.
class_shoresman_explanation_advanced=They move slightly faster and generate ore for the cabin whilst offboard.
class_boatswain=Boatswain
class_boatswain_explanation=They move faster and generate ore for the cabin whilst below deck.
class_boatswain_explanation_advanced=They move faster and generate ore for the cabin whilst below deck.
class_prospector=Prospector
class_prospector_explanation=They find more resources when handmining.
class_prospector_explanation_advanced=They find more resources when handmining.
class_lumberjack=Lumberjack
class_lumberjack_explanation=They find more resources when chopping trees.
class_lumberjack_explanation_advanced=They find more resources when chopping trees.
class_master_angler=Master Angler
class_master_angler_explanation=They fish at much greater distance, and catch more.
class_master_angler_explanation_advanced=They fish at much greater distance, and catch more.
class_wood_lord=Lord of the Woods
class_wood_lord_explanation=They find many more resources when chopping trees.
class_wood_lord_explanation_advanced=They find many more resources when chopping trees.
class_chief_excavator=Chief Excavator
class_chief_excavator_explanation=They find many more resources when handmining.
class_chief_excavator_explanation_advanced=They find many more resources when handmining.
class_hatamoto=Hatamoto
class_hatamoto_explanation=They are very tough, and *with no weapon equipped* fight well by melee, but poorly otherwise.
class_hatamoto_explanation_advanced=They are very tough, and *with no weapon equipped* fight well by melee, but poorly otherwise.
class_iron_leg=Iron Leg
class_iron_leg_explanation=They are very resistant to damage when carrying 3000 iron ore.
class_iron_leg_explanation_advanced=They are very resistant to damage when carrying 3000 iron ore.
class_quartermaster=Quartermaster
class_quartermaster_explanation=Nearby crewmates get +10% physical attack and generate ore for the cabin.
class_quartermaster_explanation_advanced=Nearby crewmates get +10% physical attack and generate ore for the cabin.
class_dredger=Dredger
class_dredger_explanation=They find surprising items when they fish.
class_dredger_explanation_advanced=They find surprising items when they fish.
class_smoldering=Smoldering
class_smoldering_explanation=They periodically convert wood into coal, if they have less than 50 coal.
class_smoldering_explanation_advanced=They periodically convert wood into coal, if they have less than 50 coal.
class_gourmet=Gourmet
class_gourmet_explanation=They generate ore for the cabin by eating fish in fancy locations.
class_gourmet_explanation_advanced=They generate ore for the cabin by eating fish in fancy locations.
class_explanation=__1__: __2__

View File

@ -280,20 +280,20 @@ local function damage_to_players_changes(event)
--game.print('on damage info: {name: ' .. event.damage_type.name .. ', object_name: ' .. event.damage_type.object_name .. '}')
if event.damage_type.name == 'poison' then --make all poison damage stronger against players
damage_multiplier = damage_multiplier * 1.85
if event.damage_type.name == 'poison' then --make all poison damage stronger against players and enemies
damage_multiplier = damage_multiplier * Balance.poison_damage_multiplier
else
if class and class == Classes.enum.SCOUT then
damage_multiplier = damage_multiplier * 1.25
damage_multiplier = damage_multiplier * Balance.scout_damage_taken_multiplier
-- elseif class and class == Classes.enum.MERCHANT then
-- damage_multiplier = damage_multiplier * 1.10
elseif class and class == Classes.enum.SAMURAI then
damage_multiplier = damage_multiplier * (1 - Balance.samurai_resistance)
elseif class and class == Classes.enum.HATAMOTO then
damage_multiplier = damage_multiplier * (1 - Balance.hatamoto_resistance)
elseif class and class == Classes.enum.IRON_LEG then
damage_multiplier = damage_multiplier * Balance.samurai_damage_taken_multiplier
elseif class and class == Classes.enum.HATAMOTO then --lethal damage needs to be unaffected
damage_multiplier = damage_multiplier * Balance.hatamoto_damage_taken_multiplier
elseif class and class == Classes.enum.IRON_LEG then --lethal damage needs to be unaffected
if memory.class_auxiliary_data[player_index] and memory.class_auxiliary_data[player_index].iron_leg_active then
damage_multiplier = damage_multiplier * (1 - Balance.iron_leg_resistance)
damage_multiplier = damage_multiplier * Balance.iron_leg_damage_taken_multiplier
end
-- else
-- damage_multiplier = damage_multiplier * (1 + Balance.bonus_damage_to_humans())
@ -317,7 +317,7 @@ local function damage_to_players_changes(event)
if not (player and player.valid and player.character and player.character.valid) then
return
end
local global_memory = Memory.get_global_memory()
if damage_multiplier < 1 and event.final_health <= 0 then
@ -371,7 +371,7 @@ local function damage_dealt_by_players_changes(event)
local class = memory.classes_table and memory.classes_table[player_index]
if class and class == Classes.enum.SCOUT and event.final_health > 0 then --lethal damage must be unaffected
event.entity.health = event.entity.health + 0.4 * event.final_damage_amount
event.entity.health = event.entity.health + (1 - Balance.scout_damage_dealt_multiplier) * event.final_damage_amount
elseif class and (class == Classes.enum.SAMURAI or class == Classes.enum.HATAMOTO) then
local samurai = memory.classes_table[player_index] == Classes.enum.SAMURAI
local hatamoto = memory.classes_table[player_index] == Classes.enum.HATAMOTO
@ -387,19 +387,23 @@ local function damage_dealt_by_players_changes(event)
local big_number = 1000
local extra_physical_damage_from_research_multiplier = 1 -- TODO: implement this later
if melee and event.final_health > 0 then
if physical then
if samurai then
extra_damage_to_deal = 30
extra_damage_to_deal = Balanace.samurai_damage_dealt_with_melee_multiplier * extra_physical_damage_from_research_multiplier
elseif hatamoto then
extra_damage_to_deal = 50
extra_damage_to_deal = Balanace.hatamoto_damage_dealt_with_melee_multiplier * extra_physical_damage_from_research_multiplier
end
elseif acid then --this hacky stuff is to implement repeated spillover splash damage, whilst getting around the fact that if ovekill damage takes something to zero health, we can't tell in that event how much double-overkill damage should be dealt by reading off its HP. This code assumes that characters only deal acid damage via this function.
extra_damage_to_deal = event.original_damage_amount * big_number
end
elseif (not melee) and event.final_health > 0 then
if samurai or hatamoto then
event.entity.health = event.entity.health + 0.25 * event.final_damage_amount
if samurai then
event.entity.health = event.entity.health + (1 - Balance.samurai_damage_dealt_when_not_melee_multiplier) * event.final_damage_amount
elseif hatamoto then
event.entity.health = event.entity.health + (1 - Balance.hatamoto_damage_dealt_when_not_melee_multiplier) * event.final_damage_amount
end
end
@ -680,10 +684,6 @@ local function event_pre_player_mined_item(event)
-- end
end
Public.every_nth_tree_gives_coins = 6
local function event_on_player_mined_entity(event)
if not event.player_index then return end
local player = game.players[event.player_index]
@ -759,7 +759,7 @@ local function event_on_player_mined_entity(event)
-- end
else
give[#give + 1] = {name = 'wood', count = amount}
if Math.random(Public.every_nth_tree_gives_coins) == 1 then --tuned
if Math.random(Balance.every_nth_tree_gives_coins) == 1 then --tuned
local a = 5
give[#give + 1] = {name = 'coin', count = a}
memory.playtesting_stats.coins_gained_by_trees_and_rocks = memory.playtesting_stats.coins_gained_by_trees_and_rocks + a
@ -1649,7 +1649,7 @@ local function event_on_rocket_launched(event)
destination.dynamic_data.quest_progress = destination.dynamic_data.rocketsilohp
Quest.try_resolve_quest()
end
if destination.dynamic_data.rocketsilos and destination.dynamic_data.rocketsilos[1] and destination.dynamic_data.rocketsilos[1].valid then
destination.dynamic_data.rocketsilos[1].die()
destination.dynamic_data.rocketsilos = nil

View File

@ -11,10 +11,60 @@ local _inspect = require 'utils.inspect'.inspect
-- this file is an API to all the balance tuning knobs
-- damage_taken_multiplier:
-- if multiplier > 1: entity takes more damage
-- if multiplier < 1: entity takes less damage (has damage reduction)
Public.base_extra_character_speed = 0.20
-- damage_dealt_multiplier:
-- if multiplier > 1: entity deals more damage
-- if multiplier < 1: entity deals less damage
-- extra_speed:
-- if multiplier > 1: entity moves faster
-- if multiplier < 1: entity moves slower
-- NOTE: when some extra speed modifiers stack, they stack multiplicatively
Public.base_extra_character_speed = 1.44
Public.respawn_speed_boost = 1.75
Public.technology_price_multiplier = 1
Public.rocket_launch_coin_reward = 5000
Public.base_caught_fish_amount = 3
Public.class_reward_tick_rate_in_seconds = 7
Public.poison_damage_multiplier = 1.85
Public.every_nth_tree_gives_coins = 6
Public.samurai_damage_taken_multiplier = 0.26
Public.samurai_damage_dealt_when_not_melee_multiplier = 0.75
Public.samurai_damage_dealt_with_melee_multiplier = 30
Public.hatamoto_damage_taken_multiplier = 0.16
Public.hatamoto_damage_dealt_when_not_melee_multiplier = 0.75
Public.hatamoto_damage_dealt_with_melee_multiplier = 50
Public.iron_leg_damage_taken_multiplier = 0.18
Public.iron_leg_iron_ore_required = 3000
Public.deckhand_extra_speed = 1.25
Public.deckhand_ore_grant_multiplier = 2
Public.deckhand_ore_scaling_enabled = true
Public.boatswain_extra_speed = 1.25
Public.boatswain_ore_grant_multiplier = 4
Public.boatswain_ore_scaling_enabled = true
Public.shoresman_extra_speed = 1.1
Public.shoresman_ore_grant_multiplier = 2
Public.shoresman_ore_scaling_enabled = true
Public.quartermaster_range = 19
Public.quartermaster_bonus_damage = 0.1
Public.quartermaster_ore_scaling_enabled = false
Public.scout_extra_speed = 1.3
Public.scout_damage_taken_multiplier = 1.25
Public.scout_damage_dealt_multiplier = 0.6
Public.fisherman_reach_bonus = 10
Public.master_angler_reach_bonus = 16
Public.master_angler_fish_bonus = 1
Public.master_angler_coin_bonus = 10
Public.dredger_reach_bonus = 16
Public.dredger_fish_bonus = 1
Public.gourmet_ore_scaling_enabled = false
function Public.starting_boatEEIpower_production_MW()
@ -43,8 +93,6 @@ function Public.cost_to_leave_multiplier()
return Math.sloped(Common.difficulty_scale(), 8/10)
end
Public.rocket_launch_coin_reward = 5000
function Public.crew_scale()
local ret = Common.activecrewcount()/10
if ret == 0 then ret = 1/10 end --if all players are afk
@ -300,25 +348,6 @@ function Public.class_resource_scale()
return 1 / (Public.crew_scale()^(2/5)) --already helped by longer timescales
end
Public.base_caught_fish_amount = 3
Public.class_reward_tick_rate_in_seconds = 7
Public.samurai_resistance = 0.74
Public.hatamoto_resistance = 0.84
Public.iron_leg_resistance = 0.82
Public.deckhand_extra_speed = 0.25
Public.boatswain_extra_speed = 0.25
Public.shoresman_extra_speed = 0.07
Public.quartermaster_range = 19
Public.quartermaster_bonus_damage = 0.1
Public.scout_extra_speed = 0.35
Public.fisherman_reach_bonus = 10
Public.master_angler_reach_bonus = 16
Public.master_angler_fish_bonus = 1
Public.master_angler_coin_bonus = 10
Public.dredger_reach_bonus = 16
Public.dredger_fish_bonus = 1
function Public.biter_base_density_scale()
local p = Public.crew_scale()
if p >= 1 then

View File

@ -839,7 +839,7 @@ function Public.reset_crew_and_enemy_force(id)
crew_force.manual_mining_speed_modifier = 3
crew_force.character_inventory_slots_bonus = 0
-- crew_force.character_inventory_slots_bonus = 10
crew_force.character_running_speed_modifier = Balance.base_extra_character_speed
-- crew_force.character_running_speed_modifier = Balance.base_extra_character_speed
crew_force.laboratory_productivity_bonus = 0
crew_force.ghost_time_to_live = 8 * 60 * 60

View File

@ -113,7 +113,7 @@ local function on_init()
Surfaces.Lobby.create_starting_dock_surface()
local lobby = game.surfaces[CoreData.lobby_surface_name]
game.forces.player.set_spawn_position(Common.lobby_spawnpoint, lobby)
game.forces.player.character_running_speed_modifier = Balance.base_extra_character_speed
-- game.forces.player.character_running_speed_modifier = Balance.base_extra_character_speed
game.create_force('environment')
for id = 1, 3, 1 do
@ -248,8 +248,8 @@ local function crew_tick()
end
if tick % 420 == 0 then
ClassPiratesApiOnTick.class_rewards_tick(420)
if tick % (60 * Balance.class_reward_tick_rate_in_seconds) == 0 then
ClassPiratesApiOnTick.class_rewards_tick(60 * Balance.class_reward_tick_rate_in_seconds)
end
end
end

View File

@ -71,7 +71,21 @@ function Public.explanation(class)
end
function Public.explanation_advanced(class)
return {'pirates.class_' .. class .. '_explanation_advanced', Balance.deckhand_extra_speed}
local explanation = 'pirates.class_' .. class .. '_explanation_advanced'
local full_explanation = {}
-- perhaps some of the code here could be simplified or put somewhere outside the function
if class == enum.DECKHAND then
local extra_speed = (Balance.deckhand_extra_speed - 1) * 100
local ore_amount = Public.ore_grant_amount(Balance.deckhand_ore_grant_multiplier, Balance.deckhand_ore_scaling_enabled)
local tick_rate = Balance.class_reward_tick_rate_in_seconds
full_explanation = {explanation, extra_speed, ore_amount, tick_rate}
end
full_explanation[#full_explanation + 1] = Public.required_class_to_unlock_at_market()
full_explanation[#full_explanation + 1] = Public.class_is_obtainable()
return full_explanation
end
-- Public.display_form = {
@ -120,6 +134,35 @@ function Public.initial_class_pool()
}
end
function Public.required_class_to_unlock_at_market(class)
local required_class = Public.class_purchase_requirement[class]
if required_class then
return {'\nRequired classes', ':', Public.display_form(required_class)}
else
return ''
end
end
function Public.class_is_obtainable(class)
local obtainable_class_pool = Public.initial_class_pool()
for _, unlocked_class_list in pairs(Public.class_unlocks) do
for __, unlocked_class in ipairs(unlocked_class_list) do
obtainable_class_pool[#obtainable_class_pool + 1] = unlocked_class
end
end
for _, unlockable_class in ipairs(obtainable_class_pool) do
if unlockable_class == class then
--return true
return {'\n(', 'Enabled', ')'}
end
end
--return false
return {'\n(', 'Disabled', ')'}
end
function Public.assign_class(player_index, class, self_assigned)
local memory = Memory.get_crew_memory()
@ -195,13 +238,9 @@ end
function Public.class_ore_grant(player, how_much, disable_scaling)
local count
if disable_scaling then
count = Math.ceil(how_much)
else
count = Math.ceil(how_much * Balance.class_resource_scale())
end
function Public.class_ore_grant(player, how_much, enable_scaling)
local count = ore_grant_amount(how_much, enable_scaling)
if Math.random(4) == 1 then
Common.flying_text_small(player.surface, player.position, '[color=0.85,0.58,0.37]+' .. count .. '[/color]')
Common.give_items_to_crew{{name = 'copper-ore', count = count}}
@ -211,6 +250,13 @@ function Public.class_ore_grant(player, how_much, disable_scaling)
end
end
function Public.ore_grant_amount(how_much, enable_scaling)
if enable_scaling then
return Math.ceil(how_much * Balance.class_resource_scale())
else
return Math.ceil(how_much)
end
end
local function class_on_player_used_capsule(event)
@ -270,7 +316,7 @@ local function class_on_player_used_capsule(event)
multiplier = multiplier * 5
memory.gourmet_recency_tick = game.tick - timescale*10 + timescale
end
Public.class_ore_grant(player, 10 * multiplier, true)
Public.class_ore_grant(player, 10 * multiplier, Balance.gourmet_ore_scaling_enabled)
end
end
end
@ -280,7 +326,7 @@ end
function Public.lumberjack_bonus_items(give_table)
local memory = Memory.get_crew_memory()
if Math.random(Public.every_nth_tree_gives_coins) == 1 then
if Math.random(Balance.every_nth_tree_gives_coins) == 1 then
local a = 12
give_table[#give_table + 1] = {name = 'coin', count = a}
memory.playtesting_stats.coins_gained_by_trees_and_rocks = memory.playtesting_stats.coins_gained_by_trees_and_rocks + a

View File

@ -103,7 +103,7 @@ function Public.class_renderings(tickinterval)
target = player.character,
color = CoreData.colors.toughness_rendering,
filled = false,
radius = Balance.samurai_resistance^2,
radius = (1 - Balance.samurai_damage_taken_multiplier)^2,
only_in_alt_mode = false,
draw_on_ground = true,
}
@ -115,7 +115,7 @@ function Public.class_renderings(tickinterval)
target = player.character,
color = CoreData.colors.toughness_rendering,
filled = false,
radius = Balance.hatamoto_resistance^2,
radius = (1 - Balance.hatamoto_damage_taken_multiplier)^2,
only_in_alt_mode = false,
draw_on_ground = true,
}
@ -127,7 +127,7 @@ function Public.class_renderings(tickinterval)
target = player.character,
color = CoreData.colors.toughness_rendering,
filled = false,
radius = Balance.iron_leg_resistance^2,
radius = (1 - Balance.iron_leg_damage_taken_multiplier)^2,
only_in_alt_mode = false,
draw_on_ground = true,
}
@ -207,13 +207,14 @@ function Public.update_character_properties(tickinterval)
character.character_health_bonus = health_boost
local speed_boost = Balance.base_extra_character_speed
if memory.speed_boost_characters and memory.speed_boost_characters[player_index] then
speed_boost = speed_boost + Balance.respawn_speed_boost
speed_boost = speed_boost * Balance.respawn_speed_boost
else
if memory.classes_table and memory.classes_table[player_index] then
local class = memory.classes_table[player_index]
if class == Classes.enum.SCOUT then
speed_boost = speed_boost + Balance.scout_extra_speed
speed_boost = speed_boost * Balance.scout_extra_speed
elseif class == Classes.enum.DECKHAND or class == Classes.enum.BOATSWAIN or class == Classes.enum.SHORESMAN then
local surfacedata = Surfaces.SurfacesCommon.decode_surface_name(player.surface.name)
local type = surfacedata.type
@ -222,21 +223,21 @@ function Public.update_character_properties(tickinterval)
if class == Classes.enum.DECKHAND then
if on_ship_bool and (not hold_bool) then
speed_boost = speed_boost + Balance.deckhand_extra_speed
speed_boost = speed_boost * Balance.deckhand_extra_speed
end
elseif class == Classes.enum.BOATSWAIN then
if hold_bool then
speed_boost = speed_boost + Balance.boatswain_extra_speed
speed_boost = speed_boost * Balance.boatswain_extra_speed
end
elseif class == Classes.enum.SHORESMAN then
if not on_ship_bool then
speed_boost = speed_boost + Balance.shoresman_extra_speed
speed_boost = speed_boost * Balance.shoresman_extra_speed
end
end
end
end
end
character.character_running_speed_modifier = speed_boost
character.character_running_speed_modifier = speed_boost - 1
end
end
end
@ -282,16 +283,16 @@ function Public.class_rewards_tick(tickinterval)
local hold_bool = surfacedata.type == Surfaces.enum.HOLD
if class == Classes.enum.DECKHAND and on_ship_bool and (not hold_bool) then
Classes.class_ore_grant(player, Balance.deckhand_ore_grant_multiplier)
Classes.class_ore_grant(player, Balance.deckhand_ore_grant_multiplier, Balance.deckhand_ore_scaling_enabled)
elseif class == Classes.enum.BOATSWAIN and hold_bool then
Classes.class_ore_grant(player, Balance.boatswain_ore_grant_multiplier)
Classes.class_ore_grant(player, Balance.boatswain_ore_grant_multiplier, Balance.boatswain_ore_scaling_enabled)
elseif class == Classes.enum.SHORESMAN and (not on_ship_bool) then
Classes.class_ore_grant(player, Balance.shoresman_ore_grant_multiplier)
Classes.class_ore_grant(player, Balance.shoresman_ore_grant_multiplier, Balance.shoresman_ore_scaling_enabled)
elseif class == Classes.enum.QUARTERMASTER then
local nearby_players = #player.surface.find_entities_filtered{position = player.position, radius = Balance.quartermaster_range, name = 'character'}
if nearby_players > 1 then
Classes.class_ore_grant(player, nearby_players - 1, true)
Classes.class_ore_grant(player, nearby_players - 1, Balance.quartermaster_ore_scaling_enabled)
end
end
end