1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2024-12-28 23:06:38 +02:00

class related update

- Damage reduction for players work even with "lethal blows" (except when player is about to be one shotted and regenerates slight amount of health to still get oneshotted, but that's quite rare against biters, although if damage reduction works against uranium grenades, this last_health maybe should be updated every now and then (perhaps every 30 or 60 seconds))
- Moved a lot of class related hard coded constants to Balance.lua
- New command: /classinfofull <class>
- Samurai and Hatamoto classes melee damage now also scales from 'physical projectile damage' research bonus
- Other various code related changes
This commit is contained in:
Piratux 2022-06-03 16:41:49 +03:00
parent 4b1f9a7f8c
commit e21483149d
5 changed files with 77 additions and 37 deletions

View File

@ -210,9 +210,12 @@ role_officer_description=Assigned by the captain, officers can use the Captain's
role_captain=Captain
role_captain_description=Has executive power to undock the ship, purchase items, and various other special actions. When the game assigns a captain, it gives priority to those who have been playing the longest as a non-captain.
class_obtainable=Class is obtainable.
class_unobtainable=Class was disabled and is unobtainable.
class_deckhand=Deckhand
class_deckhand_explanation=They move faster and generate ore 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_deckhand_explanation_advanced=They move __1__% times faster and generate ore(with current crew size +__2__ 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(as well as reach objects as side effect) at greater distance(__1__ extra tile range).
@ -221,25 +224,25 @@ 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_samurai_explanation_advanced=They receive __1__% less damage, and with no weapon equipped do extra __2__ damage in melee(scales with 'physical projectile damage' research bonuses), but deal __3__% less damage 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_shoresman_explanation_advanced=They move __1__% times faster and generate ore(with current crew size +__2__ every __3__ seconds) 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_boatswain_explanation_advanced=They move __1__% times faster and generate ore(with current crew size +__2__ every __3__ seconds) 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_lumberjack_explanation_advanced=They find ores and more coins 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_master_angler_explanation_advanced=They fish at much greater distance(__1__ extra tile range), and catch more(+__2__ fish and +__3__ coins).
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.
@ -248,16 +251,16 @@ 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_hatamoto_explanation_advanced=They receive __1__% less damage, and with no weapon equipped do extra __2__ damage in melee(scales with 'physical projectile damage' research bonuses), but deal __3__% less damage 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_iron_leg_explanation_advanced=They receive __1__% less damage when carrying at least __2__ 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_quartermaster_explanation_advanced=Nearby crewmates(at __1__ tile radius) get +__2__% physical attack and generate ore for the cabin (ore amount depends on nearby crewmate count).
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_dredger_explanation_advanced=They inherit the previous class bonuses and 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.

View File

@ -387,14 +387,14 @@ local function damage_dealt_by_players_changes(event)
local big_number = 1000
local extra_physical_damage_from_research_multiplier = 1 -- TODO: implement this later
local extra_physical_damage_from_research_multiplier = 1 + memory.force.get_ammo_damage_modifier('bullet')
if melee and event.final_health > 0 then
if physical then
if samurai then
extra_damage_to_deal = Balanace.samurai_damage_dealt_with_melee_multiplier * extra_physical_damage_from_research_multiplier
extra_damage_to_deal = Balance.samurai_damage_dealt_with_melee_multiplier * extra_physical_damage_from_research_multiplier
elseif hatamoto then
extra_damage_to_deal = Balanace.hatamoto_damage_dealt_with_melee_multiplier * extra_physical_damage_from_research_multiplier
extra_damage_to_deal = Balance.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
@ -430,7 +430,7 @@ local function damage_dealt_by_players_changes(event)
if p2.player and p2.player.valid then
local p2_index = p2.player.index
if event.entity.valid and player_index ~= p2_index and memory.classes_table[p2_index] and memory.classes_table[p2_index] == Classes.enum.QUARTERMASTER then
event.entity.damage(Balance.quartermaster_bonus_damage * event.final_damage_amount, character.force, 'impact', character) --triggers this function again, but not physical this time
event.entity.damage(Balance.quartermaster_bonus_physical_damage * event.final_damage_amount, character.force, 'impact', character) --triggers this function again, but not physical this time
end
end
end

View File

@ -37,10 +37,10 @@ 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.samurai_damage_dealt_with_melee_multiplier = 25
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.hatamoto_damage_dealt_with_melee_multiplier = 45
Public.iron_leg_damage_taken_multiplier = 0.18
Public.iron_leg_iron_ore_required = 3000
Public.deckhand_extra_speed = 1.25
@ -53,7 +53,7 @@ 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_bonus_physical_damage = 0.1
Public.quartermaster_ore_scaling_enabled = false
Public.scout_extra_speed = 1.3
Public.scout_damage_taken_multiplier = 1.25
@ -66,7 +66,6 @@ Public.dredger_reach_bonus = 16
Public.dredger_fish_bonus = 1
Public.gourmet_ore_scaling_enabled = false
function Public.starting_boatEEIpower_production_MW()
-- return 3 * Math.sloped(Common.capacity_scale(), 1/2) / 2 --/2 as we have 2
return 3/2

View File

@ -244,6 +244,7 @@ commands.add_command(
'classinfofull',
'{classname} returns detailed definition of the named class.',
function(cmd)
cmd_set_memory(cmd)
local param = tostring(cmd.parameter)
local player = game.players[cmd.player_index]
if not Common.validate_player(player) then return end

View File

@ -73,17 +73,58 @@ end
function Public.explanation_advanced(class)
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 extra_speed = Public.calculate_percentage(Balance.deckhand_extra_speed)
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}
full_explanation = {'', {explanation, extra_speed, ore_amount, tick_rate}}
elseif class == enum.BOATSWAIN then
local extra_speed = Public.calculate_percentage(Balance.boatswain_extra_speed)
local ore_amount = Public.ore_grant_amount(Balance.boatswain_ore_grant_multiplier, Balance.boatswain_ore_scaling_enabled)
local tick_rate = Balance.class_reward_tick_rate_in_seconds
full_explanation = {'', {explanation, extra_speed, ore_amount, tick_rate}}
elseif class == enum.SHORESMAN then
local extra_speed = Public.calculate_percentage(Balance.shoresman_extra_speed)
local ore_amount = Public.ore_grant_amount(Balance.shoresman_ore_grant_multiplier, Balance.shoresman_ore_scaling_enabled)
local tick_rate = Balance.class_reward_tick_rate_in_seconds
full_explanation = {'', {explanation, extra_speed, ore_amount, tick_rate}}
elseif class == enum.QUARTERMASTER then
local range = Balance.quartermaster_range
local extra_physical = Public.calculate_percentage(Balance.quartermaster_bonus_physical_damage)
full_explanation = {'', {explanation, range, extra_physical}}
elseif class == enum.FISHERMAN then
local extra_range = Balance.fisherman_reach_bonus
full_explanation = {'', {explanation, extra_range}}
elseif class == enum.MASTER_ANGLER then
local extra_range = Balance.master_angler_reach_bonus
local extra_fish = Balance.master_angler_fish_bonus
local extra_coins = Balance.master_angler_coin_bonus
full_explanation = {'', {explanation, extra_range, extra_fish, extra_coins}}
elseif class == enum.SCOUT then
local extra_speed = Public.calculate_percentage(Balance.scout_extra_speed)
local received_damage = Public.calculate_percentage(Balance.scout_damage_taken_multiplier)
local dealt_damage = Public.calculate_percentage(Balance.scout_damage_dealt_multiplier)
full_explanation = {'', {explanation, extra_speed, received_damage, dealt_damage}}
elseif class == enum.SAMURAI then
local received_damage = Public.calculate_percentage(Balance.samurai_damage_taken_multiplier)
local melee_damage = Balance.samurai_damage_dealt_with_melee_multiplier
local non_melee_damage = Public.calculate_percentage(Balance.samurai_damage_dealt_when_not_melee_multiplier)
full_explanation = {'', {explanation, received_damage, melee_damage, non_melee_damage}}
elseif class == enum.HATAMOTO then
local received_damage = Public.calculate_percentage(Balance.hatamoto_damage_taken_multiplier)
local melee_damage = Balance.hatamoto_damage_dealt_with_melee_multiplier
local non_melee_damage = Public.calculate_percentage(Balance.hatamoto_damage_dealt_when_not_melee_multiplier)
full_explanation = {'', {explanation, received_damage, melee_damage, non_melee_damage}}
elseif class == enum.IRON_LEG then
local received_damage = Public.calculate_percentage(Balance.iron_leg_damage_taken_multiplier)
local iron_ore_required = Balance.iron_leg_iron_ore_required
full_explanation = {'', {explanation, received_damage, iron_ore_required}}
else
full_explanation = {'', {explanation}}
end
full_explanation[#full_explanation + 1] = Public.required_class_to_unlock_at_market()
full_explanation[#full_explanation + 1] = Public.class_is_obtainable()
full_explanation[#full_explanation + 1] = Public.class_is_obtainable(class) and {'', ' ', {'pirates.class_obtainable'}} or {'', ' ', {'pirates.class_unobtainable'}}
return full_explanation
end
@ -96,6 +137,13 @@ end
-- }
function Public.calculate_percentage(multiplier)
if(multiplier < 1) then
return (1 - multiplier) * 100
else
return (multiplier - 1) * 100
end
end
Public.class_unlocks = {
@ -134,15 +182,6 @@ 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()
@ -154,13 +193,11 @@ function Public.class_is_obtainable(class)
for _, unlockable_class in ipairs(obtainable_class_pool) do
if unlockable_class == class then
--return true
return {'\n(', 'Enabled', ')'}
return true
end
end
--return false
return {'\n(', 'Disabled', ')'}
return false
end