2024-10-25 15:41:39 +08:00
|
|
|
|
extends Node
|
|
|
|
|
|
2024-11-01 23:23:07 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-10-25 15:41:39 +08:00
|
|
|
|
#不同族群单位之间的初始好感度
|
|
|
|
|
#下面意思为测试族群1对2具有初始负面好感
|
|
|
|
|
#相反2对1具有正面好感
|
|
|
|
|
var init_favour:Dictionary={
|
|
|
|
|
#测试族群1
|
|
|
|
|
"test_1":{
|
|
|
|
|
#对测试族群2的初始好感度为-10
|
2024-10-25 17:45:08 +08:00
|
|
|
|
"test_1":-100,
|
|
|
|
|
"test_2":-100,
|
|
|
|
|
"player":-100,
|
2024-10-25 15:41:39 +08:00
|
|
|
|
},
|
|
|
|
|
"test_2":{
|
|
|
|
|
|
2024-10-25 17:45:08 +08:00
|
|
|
|
"test_2":-100,
|
|
|
|
|
"test_1":-100,
|
|
|
|
|
"player":-100,
|
2024-10-25 15:41:39 +08:00
|
|
|
|
|
2024-10-28 19:24:10 +08:00
|
|
|
|
},
|
|
|
|
|
"default":{
|
|
|
|
|
"default":-60
|
2024-10-25 15:41:39 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#获取初始好感度
|
|
|
|
|
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
|
2024-10-26 22:17:29 +08:00
|
|
|
|
|
|
|
|
|
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,
|
2024-11-01 23:23:07 +08:00
|
|
|
|
"position":[0,0],
|
|
|
|
|
"bag":[]
|
2024-10-26 22:17:29 +08:00
|
|
|
|
}
|
2024-10-28 19:24:10 +08:00
|
|
|
|
|
|
|
|
|
|
2024-10-26 22:17:29 +08:00
|
|
|
|
#角色数据
|
|
|
|
|
@onready var character_data:Dictionary=pre_proces_data(preload("res://json/character.json").data)
|
2024-10-28 19:24:10 +08:00
|
|
|
|
func get_unit_data(id:String,as_unit_id:String="default"):
|
2024-10-26 22:17:29 +08:00
|
|
|
|
if character_data.has(id):
|
2024-10-28 19:24:10 +08:00
|
|
|
|
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]
|
2024-10-26 22:17:29 +08:00
|
|
|
|
else:
|
|
|
|
|
return null
|
2024-11-01 23:23:07 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#获取预先添加的物品默认数据
|
|
|
|
|
static var pre_item_add_data:Dictionary={"num":1}:
|
|
|
|
|
get():
|
|
|
|
|
return pre_item_add_data.duplicate(true)
|
|
|
|
|
#预处理物品数据
|
|
|
|
|
static func pre_process_item_data(origin_data:Dictionary):
|
|
|
|
|
var new_res=origin_data
|
|
|
|
|
var pre_item_data=pre_item_add_data
|
|
|
|
|
#如数据中没有默认数据则填入默认数据
|
|
|
|
|
for i in new_res.keys():
|
|
|
|
|
for j in pre_item_data.keys():
|
|
|
|
|
if not new_res[i].has(j):
|
|
|
|
|
new_res[i][j]=new_res[j]
|
|
|
|
|
return new_res
|
|
|
|
|
|
|
|
|
|
#物品数据
|
|
|
|
|
|
|
|
|
|
@export var item_data:Dictionary=preload("res://json/item.json").data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#获取- 新 -的物品单例,默认数量为1
|
|
|
|
|
func get_item(id:String,num:int=1)->BagItem:
|
|
|
|
|
|
|
|
|
|
if item_data.has(id):
|
|
|
|
|
var itd=item_data[id]
|
|
|
|
|
itd["num"]=num
|
|
|
|
|
return BagItem.new(itd)
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
return BagItem.new({})
|