Permalink
Browse files

Initial D(warf)

Basic bitch mob framework added
  • Loading branch information...
DerFlammenwerfer committed Dec 7, 2017
1 parent b1593a8 commit 19cd3b26edc7eecb37f23cd449eac36351489a4d

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,50 @@
/mob/living/carbon/dwarf/attack_alien(mob/living/carbon/alien/humanoid/M as mob)
if(check_shields(0, M.name))
visible_message("<span class='danger'>[M] attempted to touch [src]!</span>")
return 0
if(..())
if(M.a_intent == "harm")
if (w_uniform)
w_uniform.add_fingerprint(M)
var/damage = rand(10, 25)
if(!damage)
playsound(loc, 'sound/weapons/slashmiss.ogg', 50, 1, -1)
visible_message("<span class='danger'>[M] has lunged at [src]!</span>", \
"<span class='userdanger'>[M] has lunged at [src]!</span>")
return 0
var/zone = ran_zone(M.zone_sel.selecting)
zone = check_zone(zone)
var/armor_block = run_armor_check(zone, "melee","","",10)
playsound(loc, 'sound/weapons/slice.ogg', 25, 1, -1)
visible_message("<span class='danger'>[M] has slashed at [src]!</span>", \
"<span class='userdanger'>[M] has slashed at [src]!</span>")
apply_damage(damage, BRUTE, zone, armor_block)
if (damage >= 24)
visible_message("<span class='danger'>[M] has wounded [src]!</span>", \
"<span class='userdanger'>[M] has wounded [src]!</span>")
apply_effect(4, WEAKEN, armor_block)
add_logs(M, src, "attacked", admin=0)
updatehealth()
if(M.a_intent == "disarm") //Unlike in Dwarf Fortress, a low center of gravity is an advantage against larger opponents
var/randn = rand(1, 100)
if (randn <= 20)
playsound(loc, 'sound/weapons/pierce.ogg', 25, 1, -1)
Weaken(5)
add_logs(M, src, "tackled", admin=0)
visible_message("<span class='danger'>[M] has tackled down [src]!</span>", \
"<span class='userdanger'>[M] has tackled down [src]!</span>")
else
if (randn <= 33)
playsound(loc, 'sound/weapons/slash.ogg', 25, 1, -1)
drop_item()
visible_message("<span class='danger'>[M] disarmed [src]!</span>", \
"<span class='userdanger'>[M] disarmed [src]!</span>")
else
playsound(loc, 'sound/weapons/slashmiss.ogg', 50, 1, -1)
visible_message("<span class='danger'>[M] has tried to disarm [src]!</span>", \
"<span class='userdanger'>[M] has tried to disarm [src]!</span>")
return
@@ -0,0 +1,41 @@
/mob/living/carbon/dwarf/attack_hulk(mob/living/carbon/human/user)
if(user.a_intent == "harm")
..(user, 1)
adjustBruteLoss(5)
Weaken(4)
/mob/living/carbon/dwarf/attack_hulk(mob/living/carbon/dwarf/user)
if(user.a_intent == "harm")
..(user, 1)
adjustBruteLoss(10)
Weaken(8)
/mob/living/carbon/dwarf/attack_hand(mob/living/carbon/human/M)
if(ismommi(M))
return
if(..()) //to allow surgery to return properly.
return
if(dna)
dna.species.spec_attack_hand(M, src)
return
/mob/living/carbon/dwarf/attack_hand(mob/living/carbon/dwarf/M)
if(ismommi(M))
return
if(..()) //to allow surgery to return properly.
return
if(dna)
dna.species.spec_attack_hand(M, src)
return
/mob/living/carbon/dwarf/proc/afterattack(atom/target as mob|obj|turf|area, mob/living/user as mob|obj, inrange, params)
return
@@ -0,0 +1,15 @@
/mob/living/carbon/dwarf/attack_paw(mob/living/carbon/monkey/M as mob)
var/dam_zone = pick("chest", "l_hand", "r_hand", "l_leg", "r_leg")
dam_zone = ran_zone(dam_zone)
if(M.a_intent == "help")
..() //shaking
return 0
if(can_inject(M, 1, dam_zone))//Thick suits can stop monkey bites.
if(..()) //successful monkey bite, this handles disease contraction.
var/damage = rand(1, 3)
if(stat != DEAD)
apply_damage(damage, BRUTE, dam_zone, run_armor_check(dam_zone, "melee"))
updatehealth()
return 1
@@ -0,0 +1,202 @@
//Updates the mob's health from organs and mob damage variables
/mob/living/carbon/dwarf/updatehealth()
if(status_flags & GODMODE)
health = maxHealth
stat = CONSCIOUS
return
var/total_burn = 0
var/total_brute = 0
for(var/datum/organ/limb/O in get_limbs())
if(O.status & (ORGAN_DESTROYED | ORGAN_NOBLEED))
total_brute += O.destroyed_dam
else if(O.counts_for_damage())
var/obj/item/organ/limb/L = O.organitem
total_brute += L.brute_dam
total_burn += L.burn_dam
health = maxHealth - getOxyLoss() - getToxLoss() - getCloneLoss() - total_burn - total_brute
//TODO: fix husking //fuck you leatherman
if( ((maxHealth - total_burn) < config.health_threshold_dead) && stat == DEAD )
ChangeToHusk()
med_hud_set_health()
med_hud_set_status()
return
//These procs fetch a cumulative total damage from all organs
/mob/living/carbon/dwarf/getBruteLoss()
var/amount = 0
for(var/datum/organ/limb/O in get_limbs())
if(O.status & ORGAN_DESTROYED)
amount += O.destroyed_dam //A destroyed limb is basically a severe brute wound, right?
else if(O.exists() && O.counts_for_damage())
var/obj/item/organ/limb/L = O.organitem
amount += L.brute_dam
//Else the organ is either ORGAN_REMOVED or something weird happened.
return amount
/mob/living/carbon/dwarf/getFireLoss()
var/amount = 0
for(var/datum/organ/limb/O in get_limbs())
if(O.status & ORGAN_NOBLEED)
amount += O.destroyed_dam //Count it as burnt for purposes of damage
else if(O.exists() && O.counts_for_damage())
var/obj/item/organ/limb/L = O.organitem
amount += L.burn_dam
return amount
/mob/living/carbon/dwarf/adjustBruteLoss(var/amount)
if(amount > 0)
take_overall_damage(amount, 0)
else
heal_overall_damage(-amount, 0)
/mob/living/carbon/dwarf/adjustFireLoss(var/amount)
if(amount > 0)
take_overall_damage(0, amount)
else
heal_overall_damage(0, -amount)
/mob/living/carbon/dwarf/proc/hat_fall_prob()
var/multiplier = 1
var/obj/item/clothing/head/H = head
var/loose = 40
if(stat || (status_flags & FAKEDEATH))
multiplier = 2
if(H.body_parts_covered & (EYES | MOUTH) || H.flags_inv & (HIDEEYES | HIDEFACE))
loose = 0
return loose * multiplier
////////////////////////////////////////////
//Returns a list of damaged organs
/mob/living/carbon/dwarf/proc/get_damaged_organs(var/brute, var/burn)
var/list/obj/item/organ/limb/parts = list()
for(var/datum/organ/limb/O in get_limbs())
if(O.counts_for_damage())
var/obj/item/organ/limb/L = O.organitem
if((brute && L.brute_dam) || (burn && L.burn_dam))
parts += L
return parts
//Returns a list of damageable organs
/mob/living/carbon/dwarf/proc/get_damageable_organs()
var/list/obj/item/organ/limb/parts = list()
for(var/datum/organ/limb/O in get_limbs())
if(O.counts_for_damage())
var/obj/item/organ/limb/L = O.organitem
if(L.brute_dam + L.burn_dam < L.max_damage)
parts += L
return parts
//Heals ONE external organ, organ gets randomly selected from damaged ones.
//It automatically updates damage overlays if necesary
//It automatically updates health status
/mob/living/carbon/dwarf/heal_organ_damage(var/brute, var/burn)
var/list/obj/item/organ/limb/parts = get_damaged_organs(brute,burn)
if(!parts.len) return
var/obj/item/organ/limb/picked = pick(parts)
if(picked.heal_damage(brute,burn,0))
update_damage_overlays(0)
updatehealth()
//Damages ONE external organ, organ gets randomly selected from damagable ones.
//It automatically updates damage overlays if necesary
//It automatically updates health status
/mob/living/carbon/dwarf/take_organ_damage(var/brute, var/burn)
var/list/obj/item/organ/limb/parts = get_damageable_organs()
if(!parts.len) return
var/obj/item/organ/limb/picked = pick(parts)
if(picked.take_damage(brute,burn))
update_damage_overlays(0)
updatehealth()
//Heal MANY external organs, in random order
/mob/living/carbon/dwarf/heal_overall_damage(var/brute, var/burn)
var/list/obj/item/organ/limb/parts = get_damaged_organs(brute,burn)
var/update = 0
while(parts.len && (brute>0 || burn>0) )
var/obj/item/organ/limb/picked = pick(parts)
var/brute_was = picked.brute_dam
var/burn_was = picked.burn_dam
update |= picked.heal_damage(brute,burn,0)
brute -= (brute_was-picked.brute_dam)
burn -= (burn_was-picked.burn_dam)
parts -= picked
updatehealth()
if(update) update_damage_overlays(0)
// damage MANY external organs, in random order
/mob/living/carbon/dwarf/take_overall_damage(var/brute, var/burn)
if(status_flags & GODMODE) return //godmode
var/list/obj/item/organ/limb/parts = get_damageable_organs()
var/update = 0
while(parts.len && (brute>0 || burn>0) )
var/obj/item/organ/limb/picked = pick(parts)
var/brute_was = picked.brute_dam
var/burn_was = picked.burn_dam
update |= picked.take_damage(brute,burn)
brute -= (picked.brute_dam - brute_was)
burn -= (picked.burn_dam - burn_was)
parts -= picked
updatehealth()
if(update) update_damage_overlays(0)
/mob/living/carbon/dwarf/proc/restore_blood()
if(!(NOBLOOD in dna.species.specflags))
var/blood_volume = vessel.get_reagent_amount("blood")
vessel.add_reagent("blood",800.0-blood_volume)
////////////////////////////////////////////
/mob/living/carbon/dwarf/apply_damage(var/damage = 0,var/damagetype = BRUTE, var/def_zone = null, var/blocked = 0)
if(dna) // if you have a species, it will run the apply_damage code there instead
dna.species.apply_damage(damage, damagetype, def_zone, blocked, src)
else
if((damagetype != BRUTE) && (damagetype != BURN))
..(damage, damagetype, def_zone, blocked)
return 1
else
blocked = (100-blocked)/100
if(blocked <= 0) return 0
var/obj/item/organ/limb/organ = null
if(!def_zone)
def_zone = ran_zone(def_zone)
def_zone = check_zone(def_zone)
organ = get_organitem(def_zone)
if(!organ)
return 0
damage = (damage * blocked)
switch(damagetype)
if(BRUTE)
damageoverlaytemp = 20
if(organ.take_damage(damage, 0))
update_damage_overlays(0)
if(BURN)
damageoverlaytemp = 20
if(organ.take_damage(0, damage))
update_damage_overlays(0)
// Will set our damageoverlay icon to the next level, which will then be set back to the normal level the next mob.Life().
updatehealth()
return 1
Oops, something went wrong.

0 comments on commit 19cd3b2

Please sign in to comment.