Files
Bubberstation/code/modules/mafia/abilities/protective/heal.dm
John Willard 2b844dab93 Mafia notes are no longer automatically written for you & new UI (#74819)
## About The Pull Request

Notes in Mafia are no longer written for you, you instead write it
yourself and save.
Also adds a button to automatically say out your notes for other
players.

Hides the judgment buttons when it's not time to judge
Makes the UI autoupdate and makes use of ui_data / ui_static_data

Video of it in action: https://www.youtube.com/watch?v=NDUSuIUqQv8

## Why It's Good For The Game

A downside to notes currently is that it's very easy to confirm yourself
as a role against players who don't code-dive to know exactly how notes
should be formatted for any role, this makes it easier, as everyone will
type out their own notes, and can send it directly to chat when needed.

## Changelog

🆑
balance: [Mafia] Notes are no longer written out for you.
qol: [Mafia] You can now send your notes to chat whenever.
qol: [Mafia] Roundend has changed. Solos will win over others in a 1v1,
but a HoP can keep a round going in case they can solo lynch.
/🆑
2023-04-25 08:43:36 -07:00

66 lines
2.2 KiB
Plaintext

/**
* Heal
*
* During the night, Healing will prevent a player from dying.
* Can be used to protect yourself, but only once.
*/
/datum/mafia_ability/heal
name = "Heal"
ability_action = "heal"
action_priority = COMSIG_MAFIA_NIGHT_ACTION_PHASE
use_flags = CAN_USE_ON_OTHERS | CAN_USE_ON_SELF
///The message sent when you've successfully saved someone.
var/saving_message = "someone nursed you back to health"
/datum/mafia_ability/heal/set_target(datum/mafia_controller/game, datum/mafia_role/new_target)
. = ..()
if(!.)
return FALSE
if(new_target.role_flags & ROLE_VULNERABLE)
to_chat(host_role.body, span_notice("[new_target] can't be protected."))
return FALSE
/datum/mafia_ability/heal/perform_action_target(datum/mafia_controller/game, datum/mafia_role/day_target)
. = ..()
if(!.)
return FALSE
if(target_role == host_role)
use_flags &= ~CAN_USE_ON_SELF
RegisterSignal(target_role, COMSIG_MAFIA_ON_KILL, PROC_REF(prevent_kill))
return TRUE
/datum/mafia_ability/heal/clean_action_refs(datum/mafia_controller/game)
if(target_role)
UnregisterSignal(target_role, COMSIG_MAFIA_ON_KILL)
return ..()
/datum/mafia_ability/heal/proc/prevent_kill(datum/source, datum/mafia_controller/game, datum/mafia_role/attacker, lynch)
SIGNAL_HANDLER
if(host_role == target_role)
to_chat(host_role.body, span_warning("You were attacked last night!"))
return MAFIA_PREVENT_KILL
to_chat(host_role.body, span_warning("The person you protected tonight was attacked!"))
to_chat(target_role.body, span_greentext("You were attacked last night, but [saving_message]!"))
return MAFIA_PREVENT_KILL
/**
* Defend subtype
* Kills both players when successfully defending.
*/
/datum/mafia_ability/heal/defend
name = "Defend"
ability_action = "defend"
saving_message = "security fought off the attacker"
/datum/mafia_ability/heal/defend/prevent_kill(datum/source, datum/mafia_controller/game, datum/mafia_role/attacker, lynch)
. = ..()
if(host_role == target_role)
return FALSE
if(attacker.kill(game, host_role, FALSE)) //you attack the attacker
to_chat(attacker.body, span_userdanger("You have been ambushed by Security!"))
host_role.kill(game, attacker, FALSE) //the attacker attacks you, they were able to attack the target so they can attack you.
return FALSE