This commit is contained in:
TsubakiLoL 2024-11-11 17:23:13 +08:00
parent 5a7ebda44a
commit bafd52723a

View File

@ -317,6 +317,11 @@ var now_game_data:Dictionary={
#存储的NPC数据(仅包含遇到的NPC用于存储NPC的背包在申请NPCdata时进行写入
"NPC_data":{},
#任务数据
"mission":[[],[],[]]
#三个分别为进行中任务,已完成任务,失败任务
,
#当前场景ID
"now_scene":"",
"difficulty":0,
@ -510,6 +515,10 @@ var triger:Dictionary={
"show_level_up":func (data):now_game_flow.show_item_level_up(),
"show_warehouse":func(data):now_game_flow.show_warehouse(),
"make_card":func(data):now_game_flow.show_make_card(),
#开启任务
"start_mission":func(data):add_mission_started(data),
#人类特质触发器,触发为当前游戏人物属性随机加一
"human":func(data):human_triger(),
@ -527,6 +536,7 @@ func call_triger(triger_type:String,data):
return triger[triger_type].call(data)
else:
return null
#人类特质触发器
func human_triger():
var character_data:Dictionary=now_game_data["character_data"]
@ -564,7 +574,15 @@ var condition_triger:Dictionary={
"date_limit":func (data:Dictionary):return TimeTool.is_in_date(data,get_time_dictionary()),
"time_limit":func (data:Dictionary):return TimeTool.is_in_time(data,get_time_dictionary()),
"rand":func (data:Dictionary):return get_rand(data["scene_id"],data["touch_id"],data["index"],data["condition"]),
"currency_more_than": func (data:Dictionary) :return get_currency_game(data["ind"])>=data["value"]
"currency_more_than": func (data:Dictionary) :return get_currency_game(data["ind"])>=data["value"],
#返回任务是否存在
"is_mission_started":func(data:Dictionary):return data["name"] in get_mission_started(),
"is_missionm_failed":func(data:Dictionary):return data["name"] in get_mission_finished(),
"is_mission_success":func(data:Dictionary):return data["name"] in get_mission_failed(),
}
#使用条件触发器
func call_condition_triger(triger_type:String,data):
@ -572,6 +590,34 @@ func call_condition_triger(triger_type:String,data):
return condition_triger[triger_type].call(data)
else:
return false
#获取已经开始的任务列表
func get_mission_started()->Array:
if not now_game_data.has("mission"):
now_game_data["mission"]=[[],[],[]]
return now_game_data["mission"][0]
#获取已经完成的任务列表
func get_mission_finished()->Array:
if not now_game_data.has("mission"):
now_game_data["mission"]=[[],[],[]]
return now_game_data["mission"][1]
#获取已经失败的任务列表
func get_mission_failed()->Array:
if not now_game_data.has("mission"):
now_game_data["mission"]=[[],[],[]]
return now_game_data["mission"][2]
#将任务添加到任务列表
func add_mission_started(i:String):
if not i in get_mission_started():
get_mission_started().append(i)
if i in get_mission_failed():
get_mission_failed().pop_at(get_mission_failed().find(i))
if i in get_mission_started():
get_mission_started().pop_at(get_mission_started().find(i))
#记录随机的场景上一次结果,如果时间不变则直接取上一次结果
#记录在游戏存档内,保证加载数据不改变
func get_rand(scene_id:String,touch_name:String,index:String,condition:float)->bool: