4
0
Fork 0
WolfBox/scripts/werewolf/night_actions/night_action.gd

47 lines
1.3 KiB
GDScript

extends Resource
class_name NightAction
@export var initial_prompt: Prompt
@export_multiline var message_success: String = "Your action succeeded."
@export_multiline var message_failure: String = "Your action failed."
@export var night_action_priority: NightActionPriority = NightActionPriority.DEFAULT
@export var team_nightly_action: bool = false
@export var able_to_kill: bool = false
enum NightActionPriority {
COPY = 10,
HIDE = 20,
SWITCH = 30,
ROLEBLOCK = 40,
REDIRECT = 50,
PROTECT = 60,
DEFAULT = 70,
KILL = 80,
RECRUIT = 90,
CLEANUP = 95,
INSPECT = 100,
}
#answered_function = _prompt_answered
func _prompt_answered(answer: String, user: Player) -> bool:
var wolf_user: WolfPlayer = user as WolfPlayer
wolf_user.night_action_answer = answer
return true
## This function is [rainbow]gay[/rainbow]
func setup(user: WolfPlayer) -> bool:
if team_nightly_action and user.game_state.is_team_night_action_used(user.team):
user.send_message("Another member of your team has already used your team's special nightly action.")
return false
var action: Action = Action.new(initial_prompt, _prompt_answered)
user.send_action(action)
return true
func execute(user: WolfPlayer) -> bool:
if !user.leave():
return false
user.add_message_context_dict(user.get_context_dict("user_"))
#if user.night_action_blocked:
#return false
return true