69 lines
1.8 KiB
GDScript
69 lines
1.8 KiB
GDScript
class_name CharacterTool
|
|
static func get_character_attribute(character_data:Dictionary,attribute_name:String):
|
|
|
|
var arr=has_attribute(character_data)
|
|
if arr[0]:
|
|
var attribute_data=arr[1]
|
|
if attribute_data.has(attribute_name):
|
|
return attribute_data[attribute_name]
|
|
else:
|
|
return null
|
|
else:
|
|
return null
|
|
|
|
|
|
pass
|
|
static func has_attribute(character_data:Dictionary):
|
|
if character_data.has("basic_attribute"):
|
|
return [true,character_data["basic_attribute"]]
|
|
else:
|
|
return [false,null]
|
|
|
|
func get_head(character_data:Dictionary):
|
|
|
|
|
|
pass
|
|
static func cacul_fight_attribute(character_data:Dictionary)->Dictionary:
|
|
var res={}
|
|
var arr=has_attribute(character_data)
|
|
if arr[0]:
|
|
var attribute_data=arr[1]
|
|
#"CON":100,体质
|
|
#"AGI":100,敏捷
|
|
#"INT":100,智力
|
|
#"WIS":100,感知
|
|
#"STR":100,力量
|
|
#"MND":100,意志
|
|
#"LUC":100,幸运
|
|
#"AM":100,魅力
|
|
#体质
|
|
var CON=attribute_data["CON"]
|
|
var AGI=attribute_data["AGI"]
|
|
var INT=attribute_data["INT"]
|
|
var WIS=attribute_data["WIS"]
|
|
var STR=attribute_data["STR"]
|
|
var MND=attribute_data["MND"]
|
|
var LUC=attribute_data["LUC"]
|
|
var AM=attribute_data["AM"]
|
|
res["HP"]=CON*5
|
|
res["SP"]=INT+MND
|
|
res["VIT"]=120
|
|
|
|
pass
|
|
|
|
return res
|
|
pass
|
|
|
|
static func get_skin_now_use_data(character_data:Dictionary)->Dictionary:
|
|
return character_data["character"]["skin"][character_data["character"]["skin_now_use"]]
|
|
static func get_character_name(character_data:Dictionary)->String:
|
|
return character_data["character"]["name"]
|
|
pass
|
|
static func get_character_star_num(character_data:Dictionary)->int:
|
|
return int(character_data["character"]["star"])
|
|
|
|
pass
|
|
static func get_initiative_value(character_data:Dictionary)->int:
|
|
var AGI=get_character_attribute(character_data,"AGI")
|
|
return AGI/2+randi_range(-10,10)
|