-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIRROR] Basic Constructs: Wraith [MDB IGNORE] (#356)
* Basic Constructs: Wraith (#79235) * Update defcon2.dmm --------- Co-authored-by: lizardqueenlexi <[email protected]> Co-authored-by: Giz <[email protected]>
- Loading branch information
1 parent
1f0ca6f
commit c6f41e1
Showing
17 changed files
with
184 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/// Reduces the cooldown of a given action upon landing attacks, critting, or killing mobs. | ||
/datum/component/recharging_attacks | ||
/// The target of the most recent attack | ||
var/last_target | ||
/// The stat of the most recently attacked mob | ||
var/last_stat | ||
/// The action to recharge when attacking | ||
var/datum/action/cooldown/recharged_action | ||
/// The amount of cooldown to refund on a successful attack | ||
var/attack_refund | ||
/// The amount of cooldown to refund when putting a target into critical | ||
var/crit_refund | ||
|
||
/datum/component/recharging_attacks/Initialize( | ||
datum/action/cooldown/recharged_action, | ||
attack_refund = 1 SECONDS, | ||
crit_refund = 5 SECONDS, | ||
) | ||
. = ..() | ||
if (!isbasicmob(parent) || !istype(recharged_action)) | ||
return COMPONENT_INCOMPATIBLE | ||
src.recharged_action = recharged_action | ||
src.attack_refund = attack_refund | ||
src.crit_refund = crit_refund | ||
|
||
/datum/component/recharging_attacks/Destroy() | ||
UnregisterSignal(recharged_action, COMSIG_QDELETING) | ||
recharged_action = null | ||
return ..() | ||
|
||
/datum/component/recharging_attacks/RegisterWithParent() | ||
. = ..() | ||
RegisterSignal(parent, COMSIG_HOSTILE_PRE_ATTACKINGTARGET, PROC_REF(set_old_stat)) | ||
RegisterSignal(parent, COMSIG_HOSTILE_POST_ATTACKINGTARGET, PROC_REF(check_stat)) | ||
RegisterSignal(recharged_action, COMSIG_QDELETING, PROC_REF(on_action_qdel)) | ||
|
||
/datum/component/recharging_attacks/UnregisterFromParent() | ||
. = ..() | ||
UnregisterSignal(parent, list(COMSIG_HOSTILE_PRE_ATTACKINGTARGET, COMSIG_HOSTILE_POST_ATTACKINGTARGET)) | ||
if(recharged_action) | ||
UnregisterSignal(recharged_action, COMSIG_QDELETING) | ||
|
||
/datum/component/recharging_attacks/proc/set_old_stat(mob/attacker, mob/attacked) | ||
SIGNAL_HANDLER | ||
if(!isliving(attacked)) | ||
return | ||
last_target = attacked | ||
last_stat = attacked.stat | ||
|
||
/datum/component/recharging_attacks/proc/check_stat(mob/living/attacker, mob/living/attacked, success) | ||
SIGNAL_HANDLER | ||
if(!isliving(attacked) || attacked != last_target || attacker.faction_check_atom(attacked)) | ||
return | ||
|
||
var/final_refund = attack_refund | ||
if(QDELETED(attacked) || (attacked.stat == DEAD && last_stat != DEAD)) //The target is dead and we killed them - full refund | ||
final_refund = recharged_action.cooldown_time | ||
else if(attacked.stat > CONSCIOUS && last_stat == CONSCIOUS) //We knocked the target unconscious - partial refund | ||
final_refund = crit_refund | ||
|
||
recharged_action.next_use_time -= final_refund | ||
recharged_action.build_all_button_icons() | ||
|
||
/datum/component/recharging_attacks/proc/on_action_qdel() | ||
SIGNAL_HANDLER | ||
qdel(src) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/mob/living/basic/construct/wraith | ||
name = "Wraith" | ||
real_name = "Wraith" | ||
desc = "A wicked, clawed shell constructed to assassinate enemies and sow chaos behind enemy lines." | ||
icon_state = "wraith" | ||
icon_living = "wraith" | ||
maxHealth = 65 | ||
health = 65 | ||
melee_damage_lower = 20 | ||
melee_damage_upper = 20 | ||
attack_verb_continuous = "slashes" | ||
attack_verb_simple = "slash" | ||
attack_sound = 'sound/weapons/bladeslice.ogg' | ||
attack_vis_effect = ATTACK_EFFECT_SLASH | ||
construct_spells = list( | ||
/datum/action/cooldown/spell/jaunt/ethereal_jaunt/shift, | ||
/datum/action/innate/cult/create_rune/tele, | ||
) | ||
playstyle_string = span_bold("You are a Wraith. Though relatively fragile, you are fast, deadly, and can phase through walls. Your attacks will lower the cooldown on phasing, moreso for fatal blows.") | ||
|
||
/mob/living/basic/construct/wraith/Initialize(mapload) | ||
. = ..() | ||
var/datum/action/cooldown/spell/jaunt/ethereal_jaunt/shift/jaunt = locate() in actions | ||
if(isnull(jaunt)) | ||
return . | ||
AddComponent(/datum/component/recharging_attacks, recharged_action = jaunt) | ||
|
||
/// Hostile NPC version. Attempts to kill the lowest-health mob it can see. | ||
/mob/living/basic/construct/wraith/hostile | ||
ai_controller = /datum/ai_controller/basic_controller/wraith | ||
melee_attack_cooldown = 1.5 SECONDS | ||
|
||
// Alternate wraith themes | ||
/mob/living/basic/construct/wraith/angelic | ||
theme = THEME_HOLY | ||
construct_spells = list( | ||
/datum/action/cooldown/spell/jaunt/ethereal_jaunt/shift/angelic, | ||
/datum/action/innate/cult/create_rune/tele, | ||
) | ||
|
||
/mob/living/basic/construct/wraith/angelic/Initialize(mapload) | ||
. = ..() | ||
ADD_TRAIT(src, TRAIT_ANGELIC, INNATE_TRAIT) | ||
|
||
/mob/living/basic/construct/wraith/mystic | ||
theme = THEME_WIZARD | ||
construct_spells = list( | ||
/datum/action/cooldown/spell/jaunt/ethereal_jaunt/shift/mystic, | ||
/datum/action/innate/cult/create_rune/tele, | ||
) |
Oops, something went wrong.