1
0
mirror of https://github.com/veden/Rampant.git synced 2024-12-28 21:08:22 +02:00

need to finish faction selection on damage

This commit is contained in:
Aaron Veden 2021-07-21 17:48:52 -07:00
parent e88c4ef1ec
commit 5450359cfe
No known key found for this signature in database
GPG Key ID: FF5990B1C6DD3F84
3 changed files with 48 additions and 15 deletions

View File

@ -3,6 +3,7 @@ Factorio Mod - Improves the enemies tactics by using potential fields/pheromones
# Forum Post
https://mod.factorio.com/veden/Rampant
https://forums.factorio.com/viewtopic.php?f=94&t=31445
# Notes

View File

@ -16,6 +16,8 @@ local FACTION_MUTATION_MAPPING = constants.FACTION_MUTATION_MAPPING
local MAGIC_MAXIMUM_NUMBER = constants.MAGIC_MAXIMUM_NUMBER
local FACTIONS_BY_DAMAGE_TYPE = constants.FACTIONS_BY_DAMAGE_TYPE
local BASE_AI_STATE_ACTIVE = constants.BASE_AI_STATE_ACTIVE
local BASE_AI_STATE_MUTATE = constants.BASE_AI_STATE_MUTATE
@ -333,22 +335,25 @@ end
local function pickMutationFromDamageType(map, damageType, roll, base)
local baseAlignment = base.alignment
if (damageType == "physical") then
elseif (damageType == "impact") then
elseif (damageType == "poison") then
elseif (damageType == "explosion") then
elseif (damageType == "fire") then
elseif (damageType == "laser") then
elseif (damageType == "acid") then
elseif (damageType == "electric") then
local damageFactions = FACTIONS_BY_DAMAGE_TYPE[damageType]
if (damageFactions) then
if baseAlignment[2] then
if (roll < 0.05) then
baseAlignment[2] = nil
baseAlignment[1] = damageFactions[math.random(#damageFactions)]
elseif (roll < 0.25) then
baseAlignment[1] = damageFactions[math.random(#damageFactions)]
else
baseAlignment[2] = damageFactions[math.random(#damageFactions)]
end
else
if (roll < 0.85) then
base.alignment[1] = damageFactions[math.random(#damageFactions)]
else
base.alignment[2] = damageFactions[math.random(#damageFactions)]
end
end
else
if baseAlignment[2] then
if (roll < 0.05) then

View File

@ -472,6 +472,33 @@ for tier=1, 10 do
end
end
constants.FACTIONS_BY_DAMAGE_TYPE = {
["physical"] = {
},
["impact"] = {
},
["poison"] = {
},
["explosion"] = {
},
["fire"] = {
},
["laser"] = {
},
["acid"] = {
},
["electric"] = {
}
}
constants.FACTION_SET = {}
constants.FACTION_SET[#constants.FACTION_SET+1] = {