2019-02-15 20:17:30 -08:00
|
|
|
if aiPlanningG then
|
|
|
|
return aiPlanningG
|
|
|
|
end
|
2016-10-14 17:00:18 -07:00
|
|
|
local aiPlanning = {}
|
|
|
|
|
|
|
|
-- imports
|
|
|
|
|
|
|
|
local constants = require("Constants")
|
|
|
|
local mathUtils = require("MathUtils")
|
2019-03-09 14:47:35 -08:00
|
|
|
-- local aiPredicates = require("AIPredicates")
|
2017-05-31 18:46:53 -07:00
|
|
|
|
2016-10-14 17:00:18 -07:00
|
|
|
-- constants
|
|
|
|
|
2017-05-31 18:46:53 -07:00
|
|
|
local NO_RETREAT_BASE_PERCENT = constants.NO_RETREAT_BASE_PERCENT
|
|
|
|
local NO_RETREAT_EVOLUTION_BONUS_MAX = constants.NO_RETREAT_EVOLUTION_BONUS_MAX
|
|
|
|
|
2016-10-14 17:00:18 -07:00
|
|
|
local AI_STATE_PEACEFUL = constants.AI_STATE_PEACEFUL
|
|
|
|
local AI_STATE_AGGRESSIVE = constants.AI_STATE_AGGRESSIVE
|
2018-02-09 23:57:04 -08:00
|
|
|
local AI_STATE_RAIDING = constants.AI_STATE_RAIDING
|
2018-02-14 00:28:42 -08:00
|
|
|
local AI_STATE_MIGRATING = constants.AI_STATE_MIGRATING
|
2019-02-08 21:48:00 -08:00
|
|
|
local AI_STATE_ONSLAUGHT = constants.AI_STATE_ONSLAUGHT
|
2018-02-18 20:18:04 -08:00
|
|
|
local AI_STATE_SIEGE = constants.AI_STATE_SIEGE
|
|
|
|
|
2019-04-24 23:13:22 -07:00
|
|
|
local AGGRESSIVE_CAN_ATTACK_WAIT_MAX_DURATION = constants.AGGRESSIVE_CAN_ATTACK_WAIT_MAX_DURATION
|
|
|
|
local AGGRESSIVE_CAN_ATTACK_WAIT_MIN_DURATION = constants.AGGRESSIVE_CAN_ATTACK_WAIT_MIN_DURATION
|
2016-10-14 17:00:18 -07:00
|
|
|
|
2017-05-31 18:46:53 -07:00
|
|
|
local AI_UNIT_REFUND = constants.AI_UNIT_REFUND
|
|
|
|
|
2016-10-14 17:00:18 -07:00
|
|
|
local AI_MAX_POINTS = constants.AI_MAX_POINTS
|
|
|
|
local AI_POINT_GENERATOR_AMOUNT = constants.AI_POINT_GENERATOR_AMOUNT
|
|
|
|
|
|
|
|
local AI_MIN_STATE_DURATION = constants.AI_MIN_STATE_DURATION
|
|
|
|
local AI_MIN_TEMPERAMENT_DURATION = constants.AI_MIN_TEMPERAMENT_DURATION
|
|
|
|
local AI_MAX_STATE_DURATION = constants.AI_MAX_STATE_DURATION
|
|
|
|
local AI_MAX_TEMPERAMENT_DURATION = constants.AI_MAX_TEMPERAMENT_DURATION
|
|
|
|
|
2017-05-31 18:46:53 -07:00
|
|
|
local BASE_RALLY_CHANCE = constants.BASE_RALLY_CHANCE
|
|
|
|
local BONUS_RALLY_CHANCE = constants.BONUS_RALLY_CHANCE
|
|
|
|
|
2018-02-18 16:21:18 -08:00
|
|
|
local RETREAT_MOVEMENT_PHEROMONE_LEVEL_MIN = constants.RETREAT_MOVEMENT_PHEROMONE_LEVEL_MIN
|
|
|
|
local RETREAT_MOVEMENT_PHEROMONE_LEVEL_MAX = constants.RETREAT_MOVEMENT_PHEROMONE_LEVEL_MAX
|
2020-04-02 20:47:26 -07:00
|
|
|
local MINIMUM_AI_POINTS = constants.MINIMUM_AI_POINTS
|
2017-05-31 18:46:53 -07:00
|
|
|
|
2016-10-14 17:00:18 -07:00
|
|
|
-- imported functions
|
|
|
|
|
|
|
|
local randomTickEvent = mathUtils.randomTickEvent
|
|
|
|
|
2018-02-14 00:28:42 -08:00
|
|
|
local linearInterpolation = mathUtils.linearInterpolation
|
|
|
|
|
2017-06-15 18:30:26 -07:00
|
|
|
local mFloor = math.floor
|
|
|
|
|
2017-06-30 21:36:23 -07:00
|
|
|
local mRandom = math.random
|
|
|
|
|
2016-10-14 17:00:18 -07:00
|
|
|
local mMax = math.max
|
2019-12-08 19:31:51 -08:00
|
|
|
local mMin = math.min
|
2016-10-14 17:00:18 -07:00
|
|
|
|
|
|
|
-- module code
|
|
|
|
|
2019-03-09 14:47:35 -08:00
|
|
|
function aiPlanning.planning(natives, evolution_factor, tick)
|
2019-12-08 19:31:51 -08:00
|
|
|
natives.evolutionLevel = evolution_factor
|
2019-12-15 17:16:56 -08:00
|
|
|
|
2020-04-02 20:47:26 -07:00
|
|
|
local maxPoints = mMax(AI_MAX_POINTS * evolution_factor, MINIMUM_AI_POINTS)
|
2017-05-31 18:46:53 -07:00
|
|
|
|
2019-12-06 21:57:20 -08:00
|
|
|
if not natives.ranIncompatibleMessage and natives.newEnemies and (game.active_mods["bobenemies"] or game.active_mods["Natural_Evolution_Enemies"]) then
|
|
|
|
natives.ranIncompatibleMessage = true
|
2020-04-27 20:41:18 -07:00
|
|
|
game.print({"description.rampant-bobs-nee-newEnemies"})
|
2019-12-06 21:57:20 -08:00
|
|
|
end
|
|
|
|
|
2019-10-19 12:13:48 -07:00
|
|
|
local maxOverflowPoints = maxPoints * 3
|
2017-05-31 18:46:53 -07:00
|
|
|
|
|
|
|
local attackWaveMaxSize = natives.attackWaveMaxSize
|
2018-02-18 16:21:18 -08:00
|
|
|
natives.retreatThreshold = linearInterpolation(evolution_factor, RETREAT_MOVEMENT_PHEROMONE_LEVEL_MIN, RETREAT_MOVEMENT_PHEROMONE_LEVEL_MAX)
|
2017-05-31 18:46:53 -07:00
|
|
|
natives.rallyThreshold = BASE_RALLY_CHANCE + (evolution_factor * BONUS_RALLY_CHANCE)
|
2020-05-19 19:37:16 -07:00
|
|
|
natives.formSquadThreshold = mMax((0.20 * evolution_factor), 0.05)
|
2018-02-14 00:28:42 -08:00
|
|
|
|
2020-04-02 20:47:26 -07:00
|
|
|
natives.attackWaveSize = attackWaveMaxSize * (evolution_factor ^ 1.15)
|
|
|
|
natives.attackWaveDeviation = (natives.attackWaveSize * 0.333)
|
|
|
|
natives.attackWaveUpperBound = natives.attackWaveSize + (natives.attackWaveSize * 0.35)
|
|
|
|
|
|
|
|
if (natives.attackWaveSize < 1) then
|
|
|
|
natives.attackWaveSize = 2
|
|
|
|
natives.attackWaveDeviation = 1
|
|
|
|
natives.attackWaveUpperBound = 3
|
|
|
|
end
|
2019-02-02 22:01:28 -08:00
|
|
|
|
2018-02-14 00:28:42 -08:00
|
|
|
natives.settlerWaveSize = linearInterpolation(evolution_factor ^ 1.66667, natives.expansionMinSize, natives.expansionMaxSize)
|
2019-05-03 12:32:59 -07:00
|
|
|
natives.settlerWaveDeviation = (natives.settlerWaveSize * 0.33)
|
2019-02-05 22:25:43 -08:00
|
|
|
|
2019-05-03 12:32:59 -07:00
|
|
|
natives.settlerCooldown = mFloor(linearInterpolation(evolution_factor ^ 1.66667, natives.expansionMaxTime, natives.expansionMinTime))
|
2019-02-02 22:01:28 -08:00
|
|
|
|
2017-05-31 18:46:53 -07:00
|
|
|
natives.unitRefundAmount = AI_UNIT_REFUND * evolution_factor
|
|
|
|
natives.kamikazeThreshold = NO_RETREAT_BASE_PERCENT + (evolution_factor * NO_RETREAT_EVOLUTION_BONUS_MAX)
|
2018-01-20 23:42:47 -08:00
|
|
|
|
2020-05-15 13:51:38 -07:00
|
|
|
local points = mFloor((AI_POINT_GENERATOR_AMOUNT * mRandom()) + (natives.activeNests * 0.25) + ((AI_POINT_GENERATOR_AMOUNT * 0.7) * (evolution_factor ^ 2.5)) * natives.aiPointsScaler)
|
2019-02-02 22:01:28 -08:00
|
|
|
|
2019-02-08 21:48:00 -08:00
|
|
|
if (natives.state == AI_STATE_ONSLAUGHT) then
|
|
|
|
points = points * 2
|
|
|
|
end
|
|
|
|
|
2018-01-20 23:42:47 -08:00
|
|
|
natives.baseIncrement = points
|
2019-02-02 22:01:28 -08:00
|
|
|
|
2019-10-19 12:13:48 -07:00
|
|
|
local currentPoints = natives.points
|
2019-12-15 17:16:56 -08:00
|
|
|
|
2019-10-19 12:13:48 -07:00
|
|
|
if (currentPoints < maxPoints) then
|
|
|
|
natives.points = currentPoints + points
|
|
|
|
end
|
2019-12-08 19:31:51 -08:00
|
|
|
|
2019-10-19 12:13:48 -07:00
|
|
|
if (currentPoints > maxOverflowPoints) then
|
|
|
|
natives.points = maxOverflowPoints
|
2016-10-14 17:00:18 -07:00
|
|
|
end
|
2019-02-02 22:01:28 -08:00
|
|
|
|
2019-05-09 17:46:57 -07:00
|
|
|
if (natives.stateTick <= tick) then
|
2019-12-08 19:31:51 -08:00
|
|
|
-- local roll = mRandom() * mMax(1 - evolution_factor, 0.15) * natives.aiAggressiveness
|
|
|
|
|
|
|
|
local roll = mRandom()
|
2019-12-15 17:16:56 -08:00
|
|
|
if (natives.temperament < 0.05) then -- 0 - 0.05
|
|
|
|
if natives.enabledMigration then
|
2019-12-08 19:31:51 -08:00
|
|
|
natives.state = AI_STATE_SIEGE
|
|
|
|
else
|
|
|
|
if natives.raidAIToggle then
|
2019-12-15 17:16:56 -08:00
|
|
|
if (roll < 0.85) then
|
|
|
|
natives.state = AI_STATE_AGGRESSIVE
|
|
|
|
natives.canAttackTick = randomTickEvent(tick,
|
|
|
|
AGGRESSIVE_CAN_ATTACK_WAIT_MIN_DURATION,
|
|
|
|
AGGRESSIVE_CAN_ATTACK_WAIT_MAX_DURATION)
|
|
|
|
else
|
|
|
|
natives.state = AI_STATE_RAIDING
|
|
|
|
end
|
2019-12-08 19:31:51 -08:00
|
|
|
else
|
|
|
|
natives.state = AI_STATE_AGGRESSIVE
|
2019-12-15 17:16:56 -08:00
|
|
|
natives.canAttackTick = randomTickEvent(tick,
|
|
|
|
AGGRESSIVE_CAN_ATTACK_WAIT_MIN_DURATION,
|
|
|
|
AGGRESSIVE_CAN_ATTACK_WAIT_MAX_DURATION)
|
2019-12-08 19:31:51 -08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
elseif (natives.temperament < 0.20) then -- 0.05 - 0.2
|
2019-12-15 17:16:56 -08:00
|
|
|
if (natives.enabledMigration) then
|
|
|
|
if (roll < 0.4) then
|
|
|
|
natives.state = AI_STATE_SIEGE
|
|
|
|
else
|
|
|
|
natives.state = AI_STATE_MIGRATING
|
|
|
|
end
|
|
|
|
else
|
|
|
|
if natives.raidAIToggle then
|
|
|
|
if (roll < 0.95) then
|
|
|
|
natives.state = AI_STATE_AGGRESSIVE
|
|
|
|
natives.canAttackTick = randomTickEvent(tick,
|
|
|
|
AGGRESSIVE_CAN_ATTACK_WAIT_MIN_DURATION,
|
|
|
|
AGGRESSIVE_CAN_ATTACK_WAIT_MAX_DURATION)
|
|
|
|
else
|
|
|
|
natives.state = AI_STATE_RAIDING
|
|
|
|
end
|
|
|
|
else
|
|
|
|
natives.state = AI_STATE_AGGRESSIVE
|
|
|
|
natives.canAttackTick = randomTickEvent(tick,
|
|
|
|
AGGRESSIVE_CAN_ATTACK_WAIT_MIN_DURATION,
|
|
|
|
AGGRESSIVE_CAN_ATTACK_WAIT_MAX_DURATION)
|
|
|
|
end
|
2019-12-08 19:31:51 -08:00
|
|
|
end
|
|
|
|
elseif (natives.temperament < 0.4) then -- 0.2 - 0.4
|
2019-12-15 17:16:56 -08:00
|
|
|
if (natives.enabledMigration) then
|
|
|
|
if (roll < 0.2) then
|
|
|
|
natives.state = AI_STATE_AGGRESSIVE
|
|
|
|
natives.canAttackTick = randomTickEvent(tick,
|
|
|
|
AGGRESSIVE_CAN_ATTACK_WAIT_MIN_DURATION,
|
|
|
|
AGGRESSIVE_CAN_ATTACK_WAIT_MAX_DURATION)
|
|
|
|
elseif (roll < 0.8) then
|
|
|
|
natives.state = AI_STATE_MIGRATING
|
|
|
|
else
|
|
|
|
natives.state = AI_STATE_PEACEFUL
|
|
|
|
end
|
2019-12-08 19:31:51 -08:00
|
|
|
else
|
2019-12-15 17:16:56 -08:00
|
|
|
if (roll < 0.6) then
|
|
|
|
natives.state = AI_STATE_AGGRESSIVE
|
|
|
|
natives.canAttackTick = randomTickEvent(tick,
|
|
|
|
AGGRESSIVE_CAN_ATTACK_WAIT_MIN_DURATION,
|
|
|
|
AGGRESSIVE_CAN_ATTACK_WAIT_MAX_DURATION)
|
|
|
|
else
|
|
|
|
natives.state = AI_STATE_PEACEFUL
|
|
|
|
end
|
2019-12-08 19:31:51 -08:00
|
|
|
end
|
|
|
|
elseif (natives.temperament < 0.6) then -- 0.4 - 0.6
|
2019-12-15 17:16:56 -08:00
|
|
|
if (roll < 0.5) then
|
2019-12-08 19:31:51 -08:00
|
|
|
natives.state = AI_STATE_AGGRESSIVE
|
2019-12-15 17:16:56 -08:00
|
|
|
natives.canAttackTick = randomTickEvent(tick,
|
|
|
|
AGGRESSIVE_CAN_ATTACK_WAIT_MIN_DURATION,
|
|
|
|
AGGRESSIVE_CAN_ATTACK_WAIT_MAX_DURATION)
|
2019-12-08 19:31:51 -08:00
|
|
|
else
|
|
|
|
natives.state = AI_STATE_PEACEFUL
|
2019-12-15 17:16:56 -08:00
|
|
|
end
|
2019-12-08 19:31:51 -08:00
|
|
|
elseif (natives.temperament < 0.8) then -- 0.6 - 0.8
|
|
|
|
if (roll < 0.6) then
|
|
|
|
natives.state = AI_STATE_AGGRESSIVE
|
2019-12-15 17:16:56 -08:00
|
|
|
natives.canAttackTick = randomTickEvent(tick,
|
|
|
|
AGGRESSIVE_CAN_ATTACK_WAIT_MIN_DURATION,
|
|
|
|
AGGRESSIVE_CAN_ATTACK_WAIT_MAX_DURATION)
|
2019-12-08 19:31:51 -08:00
|
|
|
elseif (roll < 0.8) then
|
|
|
|
natives.state = AI_STATE_ONSLAUGHT
|
|
|
|
else
|
|
|
|
natives.state = AI_STATE_PEACEFUL
|
2019-12-15 17:16:56 -08:00
|
|
|
end
|
2019-12-08 19:31:51 -08:00
|
|
|
else -- 0.8 - 1
|
2019-12-15 17:16:56 -08:00
|
|
|
if (natives.enabledMigration and natives.raidAIToggle) then
|
|
|
|
if (roll < 0.3) then
|
|
|
|
natives.state = AI_STATE_SIEGE
|
|
|
|
elseif (roll < 0.6) then
|
|
|
|
natives.state = AI_STATE_ONSLAUGHT
|
|
|
|
elseif (roll < 0.8) then
|
|
|
|
natives.state = AI_STATE_RAIDING
|
|
|
|
else
|
|
|
|
natives.state = AI_STATE_AGGRESSIVE
|
|
|
|
natives.canAttackTick = randomTickEvent(tick,
|
|
|
|
AGGRESSIVE_CAN_ATTACK_WAIT_MIN_DURATION,
|
|
|
|
AGGRESSIVE_CAN_ATTACK_WAIT_MAX_DURATION)
|
|
|
|
end
|
|
|
|
elseif (natives.enabledMigration) then
|
|
|
|
if (roll < 0.3) then
|
|
|
|
natives.state = AI_STATE_SIEGE
|
|
|
|
elseif (roll < 0.7) then
|
|
|
|
natives.state = AI_STATE_ONSLAUGHT
|
|
|
|
else
|
|
|
|
natives.state = AI_STATE_AGGRESSIVE
|
|
|
|
natives.canAttackTick = randomTickEvent(tick,
|
|
|
|
AGGRESSIVE_CAN_ATTACK_WAIT_MIN_DURATION,
|
|
|
|
AGGRESSIVE_CAN_ATTACK_WAIT_MAX_DURATION)
|
|
|
|
end
|
|
|
|
elseif (natives.raidAIToggle) then
|
|
|
|
if (roll < 0.4) then
|
|
|
|
natives.state = AI_STATE_ONSLAUGHT
|
|
|
|
elseif (roll < 0.7) then
|
|
|
|
natives.state = AI_STATE_RAIDING
|
|
|
|
else
|
|
|
|
natives.state = AI_STATE_AGGRESSIVE
|
|
|
|
natives.canAttackTick = randomTickEvent(tick,
|
|
|
|
AGGRESSIVE_CAN_ATTACK_WAIT_MIN_DURATION,
|
|
|
|
AGGRESSIVE_CAN_ATTACK_WAIT_MAX_DURATION)
|
|
|
|
end
|
|
|
|
else
|
|
|
|
if (roll < 0.6) then
|
|
|
|
natives.state = AI_STATE_ONSLAUGHT
|
|
|
|
else
|
|
|
|
natives.state = AI_STATE_AGGRESSIVE
|
|
|
|
natives.canAttackTick = randomTickEvent(tick,
|
|
|
|
AGGRESSIVE_CAN_ATTACK_WAIT_MIN_DURATION,
|
|
|
|
AGGRESSIVE_CAN_ATTACK_WAIT_MAX_DURATION)
|
|
|
|
end
|
2019-10-19 12:13:48 -07:00
|
|
|
end
|
|
|
|
end
|
2019-12-08 19:31:51 -08:00
|
|
|
|
2019-12-15 17:16:56 -08:00
|
|
|
-- print("changing state", natives.state)
|
|
|
|
|
2019-10-19 12:13:48 -07:00
|
|
|
natives.stateTick = randomTickEvent(tick, AI_MIN_STATE_DURATION, AI_MAX_STATE_DURATION)
|
2017-04-21 16:33:17 -07:00
|
|
|
end
|
|
|
|
|
2016-10-14 17:00:18 -07:00
|
|
|
end
|
|
|
|
|
2019-12-08 19:31:51 -08:00
|
|
|
|
|
|
|
function aiPlanning.temperamentPlanner(natives)
|
|
|
|
local destroyPlayerBuildings = natives.destroyPlayerBuildings
|
|
|
|
local lostEnemyUnits = natives.lostEnemyUnits
|
|
|
|
local lostEnemyBuilding = natives.lostEnemyBuilding
|
|
|
|
local rocketLaunched = natives.rocketLaunched
|
|
|
|
local builtEnemyBuilding = natives.builtEnemyBuilding
|
|
|
|
local ionCannonBlasts = natives.ionCannonBlasts
|
|
|
|
local artilleryBlasts = natives.artilleryBlasts
|
|
|
|
local activeNests = natives.activeNests
|
|
|
|
local activeRaidNests = natives.activeRaidNests
|
|
|
|
|
|
|
|
local currentTemperament = natives.temperamentScore
|
|
|
|
local delta = 0
|
|
|
|
|
|
|
|
if activeNests > 0 then
|
2019-12-15 17:16:56 -08:00
|
|
|
local val = (1.5 * activeNests)
|
2019-12-08 19:31:51 -08:00
|
|
|
delta = delta + val
|
|
|
|
|
|
|
|
if destroyPlayerBuildings > 0 then
|
2019-12-15 17:16:56 -08:00
|
|
|
delta = delta - (200 * destroyPlayerBuildings)
|
2019-12-08 19:31:51 -08:00
|
|
|
end
|
|
|
|
|
|
|
|
else
|
|
|
|
delta = delta - 1
|
|
|
|
|
|
|
|
if destroyPlayerBuildings > 0 then
|
2019-12-15 17:16:56 -08:00
|
|
|
if (currentTemperament > 0) then
|
|
|
|
delta = delta - (200 * destroyPlayerBuildings)
|
|
|
|
else
|
|
|
|
delta = delta + (200 * destroyPlayerBuildings)
|
|
|
|
end
|
2019-12-08 19:31:51 -08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
if activeRaidNests > 0 then
|
2020-05-24 16:41:12 -07:00
|
|
|
local val = (0.002 * activeRaidNests)
|
2019-12-08 19:31:51 -08:00
|
|
|
delta = delta - val
|
|
|
|
else
|
2019-12-15 17:16:56 -08:00
|
|
|
delta = delta - 0.5
|
2019-12-08 19:31:51 -08:00
|
|
|
end
|
|
|
|
|
|
|
|
if lostEnemyUnits > 0 then
|
2020-05-23 20:47:14 -07:00
|
|
|
local val = (0.001 * lostEnemyUnits)
|
2019-12-08 19:31:51 -08:00
|
|
|
if (currentTemperament > 0) then
|
|
|
|
delta = delta - val
|
|
|
|
else
|
|
|
|
delta = delta + val
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
if lostEnemyBuilding > 0 then
|
2019-12-15 17:16:56 -08:00
|
|
|
delta = delta + (20 * lostEnemyBuilding)
|
2019-12-08 19:31:51 -08:00
|
|
|
end
|
|
|
|
|
|
|
|
if (builtEnemyBuilding > 0) then
|
2019-12-15 17:16:56 -08:00
|
|
|
local val = (50 * builtEnemyBuilding)
|
2019-12-08 19:31:51 -08:00
|
|
|
if (currentTemperament > 0) then
|
|
|
|
delta = delta - val
|
|
|
|
else
|
|
|
|
delta = delta + val
|
|
|
|
end
|
|
|
|
else
|
2019-12-15 17:16:56 -08:00
|
|
|
delta = delta - 0.5
|
2019-12-08 19:31:51 -08:00
|
|
|
end
|
|
|
|
|
|
|
|
if (rocketLaunched > 0) then
|
2019-12-15 17:16:56 -08:00
|
|
|
local val = (100 * rocketLaunched)
|
2019-12-08 19:31:51 -08:00
|
|
|
delta = delta + val
|
|
|
|
end
|
|
|
|
|
|
|
|
if (ionCannonBlasts > 0) then
|
2019-12-15 17:16:56 -08:00
|
|
|
local val = (50 * ionCannonBlasts)
|
2019-12-08 19:31:51 -08:00
|
|
|
delta = delta + val
|
|
|
|
end
|
|
|
|
|
|
|
|
if (artilleryBlasts > 0) then
|
2019-12-15 17:16:56 -08:00
|
|
|
local val = (50 * artilleryBlasts)
|
2019-12-08 19:31:51 -08:00
|
|
|
delta = delta + val
|
|
|
|
end
|
|
|
|
|
2019-12-15 17:16:56 -08:00
|
|
|
-- print(natives.activeNests, natives.activeRaidNests, natives.destroyPlayerBuildings, natives.lostEnemyUnits,
|
|
|
|
-- natives.lostEnemyBuilding, natives.rocketLaunched, natives.builtEnemyBuilding, natives.ionCannonBlasts,
|
|
|
|
-- natives.artilleryBlasts)
|
|
|
|
|
2019-12-08 19:31:51 -08:00
|
|
|
natives.destroyPlayerBuildings = 0
|
|
|
|
natives.lostEnemyUnits = 0
|
|
|
|
natives.lostEnemyBuilding = 0
|
|
|
|
natives.rocketLaunched = 0
|
|
|
|
natives.builtEnemyBuilding = 0
|
|
|
|
natives.ionCannonBlasts = 0
|
|
|
|
natives.artilleryBlasts = 0
|
|
|
|
|
2019-12-15 17:16:56 -08:00
|
|
|
natives.temperamentScore = mMin(10000, mMax(-10000, currentTemperament + (natives.evolutionLevel * delta)))
|
|
|
|
natives.temperament = ((natives.temperamentScore + 10000) * 0.00005)
|
|
|
|
-- print(natives.temperament, natives.temperamentScore)
|
|
|
|
-- print("--")
|
2019-12-08 19:31:51 -08:00
|
|
|
end
|
|
|
|
|
2019-02-15 20:17:30 -08:00
|
|
|
aiPlanningG = aiPlanning
|
2016-10-14 17:00:18 -07:00
|
|
|
return aiPlanning
|