# Copyright (c) 2022 by Michael Zahniser
#
# Endless Sky is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later version.
#
# Endless Sky is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <https://www.gnu.org/licenses/>.

# A set of constants and booleans that determine game behavior.
# If the game data does not specify a value for a certain gamerule, then its default
# value is used.
gamerules
	# Determines whether the "universal ramscoop" is active on all ships. This ramscoop
	# provides a very small amount of fuel to every ship regardless of whether they have
	# an actual ramscoop or not. The strength of this ramscoop is scaled with the distance
	# to the system center twice, meaning it falls off much more quickly than a normal ramscoop.
	# DEFAULT: true
	# ALLOWABLE VALUES: false, true, 0, 1
	"universal ramscoop" true
	
	# An attempt to spawn a person ship happens on average every this many frames.
	# DEFAULT: 36000 frames (ten minutes)
	# ALLOWABLE VALUES: any integer >= 1
	"person spawn period" 36000
	
	# While an attempt to spawn a person ship is made on average every number of frames specified
	# above, a person ship may still not spawn. Each person ship has a "weight" associated with them
	# which determines their chance of spawning. The chance of any single person ship spawning is their
	# weight divided by the sum of the weights of all person ships and this value here. That means that
	# the chance of no person ship spawning is this number over the same sum.
	# DEFAULT: 1000
	# ALLOWABLE VALUES: any integer >= 0
	"no person spawn weight" 1000
	
	# NPC ships with the mining personality will spend this many frames mining in the current system
	# before deciding to do something else. The purpose of this limit is so that NPC ships can be seen
	# by the player to show how to mine without also stripping the system bare of minable asteroids.
	# This limit does not apply to mining ships that are spawned by a mission.
	# DEFAULT: 3600 frames (one minute)
	# ALLOWABLE VALUES: any integer >= 0
	"npc max mining time" 3600
	
	# Ships with the "frugal" personality will only use weapons that consume ammo or fuel while their
	# health is at or below this fraction.
	# DEFAULT: .75 (75 percent)
	# ALLOWABLE VALUES: any value between 0. and 1.
	"universal frugal threshold" 0.75

	# Depreciation related game rules:

	# The depreciated value of an item that is "age" days old is calculated with the following equation:
	# Where: "base value" is the undepreciated value of the item;
	# min is "depreciation min";
	# "grace period" is "depreciation grace period";
	# daily is "depreciation daily"; and
	# "max age" is "depreciation max age", and
	# age is at greater than "grace period" and less than "max age".
	# "depreciated value" = "base value" *
	#   (min + (1 - min) * (daily ^ (age - "grace period")) * ("max age" + "grace period" - age) / "max age")

	# The lowest value that a ship or outfit can depreciate to relative to its full price.
	# Captured and gifted items start at this value.
	# DEFAULT: 0.25 (25 percent)
	# ALLOWABLE VALUES: any value between 0. and 1.
	"depreciation min" 0.25

	# Number of days before a new outfit or ship will begin to depreciate.
	# DEFAULT: 7 (7 days)
	# ALLOWABLE VALUES: any integer >= 0.
	"depreciation grace period" 7

	# The percentage of an item's depreciable value that it maintains day over day.
	# DEFAULT: .997 (99.7 percent)
	# ALLOWABLE VALUES: any value between 0. and 1.
	"depreciation daily" 0.997

	# The age (in days), after the end of the grace period, at which an item will become fully depreciated.
	# DEFAULT: 1000 (1000 days)
	# ALLOWABLE VALUES: any integer >= 0.
	"depreciation max age" 1000
