otherworldly_simulation/autoload/database/database.gd
2024-10-26 22:17:29 +08:00

66 lines
1.2 KiB
GDScript

extends Node
#不同族群单位之间的初始好感度
#下面意思为测试族群1对2具有初始负面好感
#相反2对1具有正面好感
var init_favour:Dictionary={
#测试族群1
"test_1":{
#对测试族群2的初始好感度为-10
"test_1":-100,
"test_2":-100,
"player":-100,
},
"test_2":{
"test_2":-100,
"test_1":-100,
"player":-100,
}
}
#获取初始好感度
func get_init_favour(self_type:String,other_type:String):
if not init_favour.has(self_type):
return 0
var favour_dic=init_favour[self_type]
if not favour_dic.has(other_type):
return 0
else:
return favour_dic[other_type]
pass
static func pre_proces_data(dic:Dictionary):
var new_dic=dic.duplicate(true)
for i in new_dic.keys():
new_dic[i]["id"]=i
for j in other_unit_data.keys():
new_dic[i][j]=other_unit_data[j]
return new_dic
static var other_unit_data={
"hungry":0,
"fatigue":0,
"rage":0,
"tensity":0,
"panic":0,
#压力
"pressure":0,
"hp_max":100,
"hp":100,
"atk":10,
}
#角色数据
@onready var character_data:Dictionary=pre_proces_data(preload("res://json/character.json").data)
func get_unit_data(id:String):
if character_data.has(id):
return character_data[id].duplicate(true)
else:
return null