86 lines
1.6 KiB
GDScript
86 lines
1.6 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,
|
|
|
|
},
|
|
"default":{
|
|
"default":-60
|
|
}
|
|
}
|
|
#获取初始好感度
|
|
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,
|
|
"position":[0,0]
|
|
}
|
|
|
|
|
|
#角色数据
|
|
@onready var character_data:Dictionary=pre_proces_data(preload("res://json/character.json").data)
|
|
func get_unit_data(id:String,as_unit_id:String="default"):
|
|
if character_data.has(id):
|
|
var res=character_data[id].duplicate(true)
|
|
res["unit_id"]=as_unit_id
|
|
return res
|
|
else:
|
|
return null
|
|
|
|
func get_all_unit_type()->Array:
|
|
return character_data.keys()
|
|
|
|
#地图数据
|
|
@export var map_data:Dictionary=preload("res://json/map.json").data
|
|
|
|
func get_map_data(id:String):
|
|
if map_data.has(id):
|
|
return map_data[id]
|
|
else:
|
|
return null
|