Mining difficult
This commit is contained in:
parent
df393cccd4
commit
500cdaa6c9
@ -1,23 +1,23 @@
|
||||
extends Node
|
||||
|
||||
const RESOURCE_TYPES = [
|
||||
{"name": "iron", "chance": 100}, # żelazo – powszechne
|
||||
{"name": "copper", "chance": 80}, # miedź – bardzo częsta
|
||||
{"name": "water", "chance": 75}, # woda – potrzebna do życia
|
||||
{"name": "carbon", "chance": 70}, # węgiel – podstawowy pierwiastek
|
||||
{"name": "aluminium", "chance": 45}, # lekki metal
|
||||
{"name": "silicon", "chance": 40}, # do elektroniki
|
||||
{"name": "titanium", "chance": 35}, # mocny, ale rzadszy
|
||||
{"name": "uranium", "chance": 20}, # radioaktywny, cenny
|
||||
{"name": "platinum", "chance": 20}, # szlachetny metal
|
||||
{"name": "helium-3", "chance": 15}, # paliwo przyszłości
|
||||
{"name": "neutronium", "chance": 15}, # ultra-gęsty materiał
|
||||
{"name": "quantium", "chance": 12}, # niestabilny pierwiastek kwantowy
|
||||
{"name": "aetherium", "chance": 10}, # energetyczny surowiec z wymiaru Aether
|
||||
{"name": "stardust", "chance": 7}, # kosmiczny pył o właściwościach magicznych
|
||||
{"name": "xenonite", "chance": 6}, # materiał używany przez obce cywilizacje
|
||||
{"name": "solarium", "chance": 5}, # czysta energia słoneczna w postaci stałej
|
||||
{"name": "chronite", "chance": 2} # minerał manipulujący czasem
|
||||
{"name": "iron", "chance": 100, "mining_difficulty": 1.0}, # żelazo – powszechne
|
||||
{"name": "copper", "chance": 80, "mining_difficulty": 0.9}, # miedź – bardzo częsta
|
||||
{"name": "water", "chance": 75, "mining_difficulty": 1.5}, # woda – potrzebna do życia
|
||||
{"name": "carbon", "chance": 70, "mining_difficulty": 1.0}, # węgiel – podstawowy pierwiastek
|
||||
{"name": "aluminium", "chance": 45, "mining_difficulty": 0.5}, # lekki metal
|
||||
{"name": "silicon", "chance": 40, "mining_difficulty": 1.0}, # do elektroniki
|
||||
{"name": "titanium", "chance": 35, "mining_difficulty": 1.0}, # mocny, ale rzadszy
|
||||
{"name": "uranium", "chance": 20, "mining_difficulty": 1.0}, # radioaktywny, cenny
|
||||
{"name": "platinum", "chance": 20, "mining_difficulty": 1.0}, # szlachetny metal
|
||||
{"name": "helium-3", "chance": 15, "mining_difficulty": 1.0}, # paliwo przyszłości
|
||||
{"name": "neutronium", "chance": 15, "mining_difficulty": 1.0}, # ultra-gęsty materiał
|
||||
{"name": "quantium", "chance": 12, "mining_difficulty": 1.0}, # niestabilny pierwiastek kwantowy
|
||||
{"name": "aetherium", "chance": 10, "mining_difficulty": 1.0}, # energetyczny surowiec z wymiaru Aether
|
||||
{"name": "stardust", "chance": 7, "mining_difficulty": 1.0}, # kosmiczny pył o właściwościach magicznych
|
||||
{"name": "xenonite", "chance": 6, "mining_difficulty": 1.0}, # materiał używany przez obce cywilizacje
|
||||
{"name": "solarium", "chance": 5, "mining_difficulty": 1.0}, # czysta energia słoneczna w postaci stałej
|
||||
{"name": "chronite", "chance": 2, "mining_difficulty": 1.0} # minerał manipulujący czasem
|
||||
]
|
||||
|
||||
|
||||
|
||||
@ -92,12 +92,18 @@ func generate_planet_resources(planet):
|
||||
planet.resources = {} # resetujemy słownik
|
||||
|
||||
for resource in RESOURCE_TYPES:
|
||||
var res_name = resource.name
|
||||
var chance = resource.chance
|
||||
var res_name = resource["name"]
|
||||
var chance = resource["chance"]
|
||||
var mining_difficulty = resource["mining_difficulty"]
|
||||
|
||||
var exists = randi() % 100 < chance
|
||||
var amount = 0
|
||||
planet.resources[res_name] = {"exist": exists, "amount": amount}
|
||||
var amount = 0.0
|
||||
|
||||
planet.resources[res_name] = {
|
||||
"exist": exists,
|
||||
"amount": amount,
|
||||
"mining_difficulty": mining_difficulty
|
||||
}
|
||||
|
||||
#func assign_max_population(planet):
|
||||
## planet_size = 1 (mała), 2 (średnia), 3 (duża)
|
||||
|
||||
@ -125,7 +125,7 @@ func print_data():
|
||||
has_any_resource = true
|
||||
|
||||
var display_name = tr(key)
|
||||
text += "%s: %.2f +(%s)\n" % [display_name, round(res.get("amount", 0) * 100) / 100.0, check_growth()]
|
||||
text += "%s: %.2f +(%s)\n" % [display_name, round(res.get("amount", 0) * 100) / 100.0, check_growth(res["mining_difficulty"])]
|
||||
# --- Budynki ---
|
||||
if buildings.size() > 0:
|
||||
text += "Budynki na planecie:\n"
|
||||
@ -191,14 +191,15 @@ func _res_growth(delta):
|
||||
break
|
||||
|
||||
if can_produce:
|
||||
var growth = check_growth() # np. funkcja zwraca ile przyrasta
|
||||
|
||||
var growth = check_growth(res["mining_difficulty"]) # np. funkcja zwraca ile przyrasta
|
||||
res.amount += growth
|
||||
resources[res_name] = res
|
||||
|
||||
|
||||
func check_growth() -> float:
|
||||
func check_growth(mining_difficulty: float) -> float:
|
||||
# Zwraca przyrost zaokrąglony do 2 miejsc po przecinku
|
||||
var growth = res_rich * log(1 + population / 500.0)
|
||||
var growth = res_rich * log(1 + population / 500.0) * mining_difficulty
|
||||
|
||||
|
||||
return round(growth * 100) / 100.0
|
||||
|
||||
@ -68,7 +68,7 @@ func _update_info():
|
||||
text += "%s: %.2f +(%s)\n" % [
|
||||
display_name,
|
||||
round(res.get("amount",0)*100)/100.0,
|
||||
planet.check_growth()
|
||||
planet.check_growth(res["mining_difficulty"])
|
||||
]
|
||||
|
||||
# Budynki
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user