Merge pull request #9579 from YakumoChen/shapeshift
Ports #41638 and #43784, "Wizard Shapeshift now converts damage taken while transformed"
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
|
||||
|
||||
/mob/living/carbon/apply_damage(damage, damagetype = BRUTE, def_zone = null, blocked = FALSE)
|
||||
/mob/living/carbon/apply_damage(damage, damagetype = BRUTE, def_zone = null, blocked = FALSE, forced = FALSE)
|
||||
var/hit_percent = (100-blocked)/100
|
||||
if(hit_percent <= 0)
|
||||
if(!forced && hit_percent <= 0)
|
||||
return 0
|
||||
|
||||
var/obj/item/bodypart/BP = null
|
||||
@@ -15,34 +15,35 @@
|
||||
if(!BP)
|
||||
BP = bodyparts[1]
|
||||
|
||||
var/damage_amount = forced ? damage : damage * hit_percent
|
||||
switch(damagetype)
|
||||
if(BRUTE)
|
||||
if(BP)
|
||||
if(damage > 0 ? BP.receive_damage(damage * hit_percent, 0) : BP.heal_damage(abs(damage * hit_percent), 0))
|
||||
if(damage > 0 ? BP.receive_damage(damage_amount) : BP.heal_damage(abs(damage_amount), 0))
|
||||
update_damage_overlays()
|
||||
else //no bodypart, we deal damage with a more general method.
|
||||
adjustBruteLoss(damage * hit_percent)
|
||||
adjustBruteLoss(damage_amount, forced = forced)
|
||||
if(BURN)
|
||||
if(BP)
|
||||
if(damage > 0 ? BP.receive_damage(0, damage * hit_percent) : BP.heal_damage(0, abs(damage * hit_percent)))
|
||||
if(damage > 0 ? BP.receive_damage(0, damage_amount) : BP.heal_damage(0, abs(damage_amount)))
|
||||
update_damage_overlays()
|
||||
else
|
||||
adjustFireLoss(damage * hit_percent)
|
||||
adjustFireLoss(damage_amount, forced = forced)
|
||||
if(TOX)
|
||||
adjustToxLoss(damage * hit_percent)
|
||||
adjustToxLoss(damage_amount, forced = forced)
|
||||
if(OXY)
|
||||
adjustOxyLoss(damage * hit_percent)
|
||||
adjustOxyLoss(damage_amount, forced = forced)
|
||||
if(CLONE)
|
||||
adjustCloneLoss(damage * hit_percent)
|
||||
adjustCloneLoss(damage_amount, forced = forced)
|
||||
if(STAMINA)
|
||||
if(BP)
|
||||
if(damage > 0 ? BP.receive_damage(0, 0, damage * hit_percent) : BP.heal_damage(0, 0, abs(damage * hit_percent)))
|
||||
if(damage > 0 ? BP.receive_damage(0, 0, damage_amount) : BP.heal_damage(0, 0, abs(damage_amount)))
|
||||
update_damage_overlays()
|
||||
else
|
||||
adjustStaminaLoss(damage * hit_percent)
|
||||
adjustStaminaLoss(damage_amount, forced = forced)
|
||||
//citadel code
|
||||
if(AROUSAL)
|
||||
adjustArousalLoss(damage * hit_percent)
|
||||
adjustArousalLoss(damage_amount, forced = forced)
|
||||
return TRUE
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
|
||||
/mob/living/carbon/human/apply_damage(damage = 0,damagetype = BRUTE, def_zone = null, blocked = FALSE)
|
||||
/mob/living/carbon/human/apply_damage(damage = 0,damagetype = BRUTE, def_zone = null, blocked = FALSE, forced = FALSE)
|
||||
// depending on the species, it will run the corresponding apply_damage code there
|
||||
return dna.species.apply_damage(damage, damagetype, def_zone, blocked, src)
|
||||
return dna.species.apply_damage(damage, damagetype, def_zone, blocked, src, forced)
|
||||
|
||||
@@ -1959,10 +1959,10 @@ GLOBAL_LIST_EMPTY(roundstart_race_names)
|
||||
append_message = "loosening their grip on [target_held_item]"
|
||||
log_combat(user, target, "shoved", append_message)
|
||||
|
||||
/datum/species/proc/apply_damage(damage, damagetype = BRUTE, def_zone = null, blocked, mob/living/carbon/human/H)
|
||||
/datum/species/proc/apply_damage(damage, damagetype = BRUTE, def_zone = null, blocked, mob/living/carbon/human/H, forced = FALSE)
|
||||
var/hit_percent = (100-(blocked+armor))/100
|
||||
hit_percent = (hit_percent * (100-H.physiology.damage_resistance))/100
|
||||
if(hit_percent <= 0)
|
||||
if(!forced && hit_percent <= 0)
|
||||
return 0
|
||||
|
||||
var/obj/item/bodypart/BP = null
|
||||
@@ -1984,37 +1984,44 @@ GLOBAL_LIST_EMPTY(roundstart_race_names)
|
||||
switch(damagetype)
|
||||
if(BRUTE)
|
||||
H.damageoverlaytemp = 20
|
||||
var/damage_amount = forced ? damage : damage * hit_percent * brutemod * H.physiology.brute_mod
|
||||
if(BP)
|
||||
if(damage > 0 ? BP.receive_damage(damage * hit_percent * brutemod * H.physiology.brute_mod, 0) : BP.heal_damage(abs(damage * hit_percent * brutemod * H.physiology.brute_mod), 0))
|
||||
if(damage > 0 ? BP.receive_damage(damage_amount, 0) : BP.heal_damage(abs(damage_amount), 0))
|
||||
H.update_damage_overlays()
|
||||
if(HAS_TRAIT(H, TRAIT_MASO))
|
||||
H.adjustArousalLoss(damage * brutemod * H.physiology.brute_mod)
|
||||
H.adjustArousalLoss(damage_amount, 0)
|
||||
if (H.getArousalLoss() >= 100 && ishuman(H) && H.has_dna())
|
||||
H.mob_climax(forced_climax=TRUE)
|
||||
|
||||
else//no bodypart, we deal damage with a more general method.
|
||||
H.adjustBruteLoss(damage * hit_percent * brutemod * H.physiology.brute_mod)
|
||||
H.adjustBruteLoss(damage_amount)
|
||||
if(BURN)
|
||||
H.damageoverlaytemp = 20
|
||||
var/damage_amount = forced ? damage : damage * hit_percent * burnmod * H.physiology.burn_mod
|
||||
if(BP)
|
||||
if(damage > 0 ? BP.receive_damage(0, damage * hit_percent * burnmod * H.physiology.burn_mod) : BP.heal_damage(0, abs(damage * hit_percent * burnmod * H.physiology.burn_mod)))
|
||||
if(damage > 0 ? BP.receive_damage(0, damage_amount) : BP.heal_damage(0, abs(damage_amount)))
|
||||
H.update_damage_overlays()
|
||||
else
|
||||
H.adjustFireLoss(damage * hit_percent * burnmod * H.physiology.burn_mod)
|
||||
H.adjustFireLoss(damage_amount)
|
||||
if(TOX)
|
||||
H.adjustToxLoss(damage * hit_percent * H.physiology.tox_mod)
|
||||
var/damage_amount = forced ? damage : damage * hit_percent * H.physiology.tox_mod
|
||||
H.adjustToxLoss(damage_amount)
|
||||
if(OXY)
|
||||
H.adjustOxyLoss(damage * hit_percent * H.physiology.oxy_mod)
|
||||
var/damage_amount = forced ? damage : damage * hit_percent * H.physiology.oxy_mod
|
||||
H.adjustOxyLoss(damage_amount)
|
||||
if(CLONE)
|
||||
H.adjustCloneLoss(damage * hit_percent * H.physiology.clone_mod)
|
||||
var/damage_amount = forced ? damage : damage * hit_percent * H.physiology.clone_mod
|
||||
H.adjustCloneLoss(damage_amount)
|
||||
if(STAMINA)
|
||||
var/damage_amount = forced ? damage : damage * hit_percent * H.physiology.stamina_mod
|
||||
if(BP)
|
||||
if(damage > 0 ? BP.receive_damage(0, 0, damage * hit_percent * H.physiology.stamina_mod) : BP.heal_damage(0, 0, abs(damage * hit_percent * H.physiology.stamina_mod), only_robotic = FALSE, only_organic = FALSE))
|
||||
if(damage > 0 ? BP.receive_damage(0, 0, damage_amount) : BP.heal_damage(0, 0, abs(damage * hit_percent * H.physiology.stamina_mod), only_robotic = FALSE, only_organic = FALSE))
|
||||
H.update_stamina()
|
||||
else
|
||||
H.adjustStaminaLoss(damage * hit_percent * H.physiology.stamina_mod)
|
||||
H.adjustStaminaLoss(damage_amount)
|
||||
if(BRAIN)
|
||||
H.adjustOrganLoss(ORGAN_SLOT_BRAIN, damage * hit_percent * H.physiology.brain_mod)
|
||||
var/damage_amount = forced ? damage : damage * hit_percent * H.physiology.brain_mod
|
||||
H.adjustOrganLoss(ORGAN_SLOT_BRAIN, damage_amount)
|
||||
if(AROUSAL) //Citadel edit - arousal
|
||||
H.adjustArousalLoss(damage * hit_percent)
|
||||
return 1
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
/datum/species/zombie/infectious/spec_stun(mob/living/carbon/human/H,amount)
|
||||
. = min(20, amount)
|
||||
|
||||
/datum/species/zombie/infectious/apply_damage(damage, damagetype = BRUTE, def_zone = null, blocked, mob/living/carbon/human/H)
|
||||
/datum/species/zombie/infectious/apply_damage(damage, damagetype = BRUTE, def_zone = null, blocked, mob/living/carbon/human/H, forced = FALSE)
|
||||
. = ..()
|
||||
if(.)
|
||||
regen_cooldown = world.time + REGENERATION_DELAY
|
||||
|
||||
@@ -8,23 +8,24 @@
|
||||
Returns
|
||||
standard 0 if fail
|
||||
*/
|
||||
/mob/living/proc/apply_damage(damage = 0,damagetype = BRUTE, def_zone = null, blocked = FALSE)
|
||||
/mob/living/proc/apply_damage(damage = 0,damagetype = BRUTE, def_zone = null, blocked = FALSE, forced = FALSE)
|
||||
var/hit_percent = (100-blocked)/100
|
||||
if(!damage || (hit_percent <= 0))
|
||||
return 0
|
||||
var/damage_amount = forced ? damage : damage * hit_percent
|
||||
switch(damagetype)
|
||||
if(BRUTE)
|
||||
adjustBruteLoss(damage * hit_percent)
|
||||
adjustBruteLoss(damage_amount, forced = forced)
|
||||
if(BURN)
|
||||
adjustFireLoss(damage * hit_percent)
|
||||
adjustFireLoss(damage_amount, forced = forced)
|
||||
if(TOX)
|
||||
adjustToxLoss(damage * hit_percent)
|
||||
adjustToxLoss(damage_amount, forced = forced)
|
||||
if(OXY)
|
||||
adjustOxyLoss(damage * hit_percent)
|
||||
adjustOxyLoss(damage_amount, forced = forced)
|
||||
if(CLONE)
|
||||
adjustCloneLoss(damage * hit_percent)
|
||||
adjustCloneLoss(damage_amount, forced = forced)
|
||||
if(STAMINA)
|
||||
adjustStaminaLoss(damage * hit_percent)
|
||||
adjustStaminaLoss(damage_amount, forced = forced)
|
||||
return 1
|
||||
|
||||
/mob/living/proc/apply_damage_type(damage = 0, damagetype = BRUTE) //like apply damage except it always uses the damage procs
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
|
||||
/mob/living/silicon/apply_damage(damage = 0,damagetype = BRUTE, def_zone = null, blocked = FALSE)
|
||||
/mob/living/silicon/apply_damage(damage = 0,damagetype = BRUTE, def_zone = null, blocked = FALSE, forced = FALSE)
|
||||
var/hit_percent = (100-blocked)/100
|
||||
if(!damage || (hit_percent <= 0))
|
||||
if(!damage || (!forced && hit_percent <= 0))
|
||||
return 0
|
||||
var/damage_amount = forced ? damage : damage * hit_percent
|
||||
switch(damagetype)
|
||||
if(BRUTE)
|
||||
adjustBruteLoss(damage * hit_percent)
|
||||
adjustBruteLoss(damage_amount, forced = forced)
|
||||
if(BURN)
|
||||
adjustFireLoss(damage * hit_percent)
|
||||
adjustFireLoss(damage_amount, forced = forced)
|
||||
if(OXY)
|
||||
if(damage < 0) //we shouldn't be taking oxygen damage through this proc, but we'll let it heal.
|
||||
adjustOxyLoss(damage * hit_percent)
|
||||
if(damage < 0 || forced) //we shouldn't be taking oxygen damage through this proc, but we'll let it heal.
|
||||
adjustOxyLoss(damage_amount, forced = forced)
|
||||
return 1
|
||||
|
||||
|
||||
@@ -29,7 +30,7 @@
|
||||
/mob/living/silicon/setCloneLoss(amount, updating_health = TRUE, forced = FALSE)
|
||||
return FALSE
|
||||
|
||||
/mob/living/silicon/adjustStaminaLoss(amount, updating_stamina = 1)//immune to stamina damage.
|
||||
/mob/living/silicon/adjustStaminaLoss(amount, updating_stamina = 1, forced = FALSE)//immune to stamina damage.
|
||||
return FALSE
|
||||
|
||||
/mob/living/silicon/setStaminaLoss(amount, updating_stamina = 1)
|
||||
|
||||
@@ -81,8 +81,11 @@
|
||||
/mob/living/silicon/pai/adjustCloneLoss(amount, updating_health = TRUE, forced = FALSE)
|
||||
return FALSE
|
||||
|
||||
/mob/living/silicon/pai/adjustStaminaLoss(amount)
|
||||
take_holo_damage(amount & 0.25)
|
||||
/mob/living/silicon/pai/adjustStaminaLoss(amount, updating_health, forced = FALSE)
|
||||
if(forced)
|
||||
take_holo_damage(amount)
|
||||
else
|
||||
take_holo_damage(amount * 0.25)
|
||||
|
||||
/mob/living/silicon/pai/adjustOrganLoss(slot, amount, maximum = 500) //I kept this in, unlike tg
|
||||
Knockdown(amount * 0.2)
|
||||
|
||||
@@ -37,5 +37,5 @@
|
||||
else if(damage_coeff[CLONE])
|
||||
. = adjustHealth(amount * damage_coeff[CLONE] * CONFIG_GET(number/damage_multiplier), updating_health, forced)
|
||||
|
||||
/mob/living/simple_animal/adjustStaminaLoss(amount)
|
||||
/mob/living/simple_animal/adjustStaminaLoss(amount, forced = FALSE)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user