Blobwork, Human mobs with AIs can attack, AI mobs consider blobs to be enemies unless they're Blob faction.

This commit is contained in:
Mechoid
2020-03-20 12:29:40 -07:00
parent 9c67ccbbe5
commit cf5d750519
14 changed files with 337 additions and 16 deletions

View File

@@ -17,6 +17,7 @@ var/list/blobs = list()
var/heal_timestamp = 0 //we got healed when?
var/mob/observer/blob/overmind = null
var/base_name = "blob" // The name that gets appended along with the blob_type's name.
var/faction = "blob"
/obj/structure/blob/New(var/newloc, var/new_overmind)
..(newloc)
@@ -56,6 +57,8 @@ var/list/blobs = list()
return TRUE
else if(istype(mover, /obj/item/projectile))
var/obj/item/projectile/P = mover
if(istype(P.firer, /obj/structure/blob))
return TRUE
if(istype(P.firer) && P.firer.faction == "blob")
return TRUE
return FALSE
@@ -218,13 +221,97 @@ var/list/blobs = list()
qdel(src)
return B
/obj/structure/blob/attack_generic(var/mob/user, var/damage, var/attack_verb)
visible_message("<span class='danger'>[user] [attack_verb] the [src]!</span>")
playsound(loc, 'sound/effects/attackblob.ogg', 100, 1)
user.do_attack_animation(src)
if(overmind)
damage *= overmind.blob_type.brute_multiplier
else
damage *= 2
if(overmind)
damage = overmind.blob_type.on_received_damage(src, damage, BRUTE, user)
adjust_integrity(-damage)
return
/obj/structure/blob/attack_hand(mob/living/M as mob)
if(ishuman(M))
var/mob/living/carbon/human/H = M
H.setClickCooldown(H.get_attack_speed())
var/datum/unarmed_attack/attack = H.get_unarmed_attack(src, BP_TORSO)
if(!attack)
return FALSE
if(attack.unarmed_override(H, src, BP_TORSO))
return FALSE
H.do_attack_animation(src)
H.visible_message("<span class='danger'>[H] strikes \the [src]!</span>")
var/real_damage = rand(3,6)
var/hit_dam_type = attack.damage_type
real_damage += attack.get_unarmed_damage(H)
if(H.gloves)
if(istype(H.gloves, /obj/item/clothing/gloves))
var/obj/item/clothing/gloves/G = H.gloves
real_damage += G.punch_force
hit_dam_type = G.punch_damtype
if(HULK in H.mutations)
real_damage *= 2 // Hulks do twice the damage
real_damage = max(1, real_damage)
var/damage_mult_burn = 1
var/damage_mult_brute = 1
if(hit_dam_type == SEARING)
damage_mult_burn *= 0.3
damage_mult_brute *= 0.6
else if(hit_dam_type == BIOACID)
damage_mult_burn *= 0.6
damage_mult_brute = 0
else if(hit_dam_type in list(ELECTROCUTE, BURN))
damage_mult_brute = 0
else if(hit_dam_type in list(BRUTE, CLONE))
damage_mult_burn = 0
else if(hit_dam_type != HALLOSS) // Tox, Oxy, or something new. Half damage split to the organism.
damage_mult_burn = 0.25
damage_mult_brute = 0.25
else
damage_mult_brute = 0.25
damage_mult_burn = 0
var/burn_dam = real_damage * damage_mult_burn
var/brute_dam = real_damage * damage_mult_brute
if(overmind)
if(brute_dam)
brute_dam = overmind.blob_type.on_received_damage(src, brute_dam, BRUTE, M)
if(burn_dam)
burn_dam = overmind.blob_type.on_received_damage(src, burn_dam, BURN, M)
real_damage = burn_dam + brute_dam
adjust_integrity(-real_damage)
else
attack_generic(M, rand(1,10), "bashed")
/obj/structure/blob/attackby(var/obj/item/weapon/W, var/mob/user)
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
playsound(loc, 'sound/effects/attackblob.ogg', 50, 1)
visible_message("<span class='danger'>\The [src] has been attacked with \the [W][(user ? " by [user]." : ".")]</span>")
var/damage = W.force
switch(W.damtype)
if(BURN)
if(BURN, BIOACID, ELECTROCUTE, OXY)
if(overmind)
damage *= overmind.blob_type.burn_multiplier
else
@@ -234,7 +321,7 @@ var/list/blobs = list()
playsound(src.loc, 'sound/items/welder.ogg', 100, 1)
else
playsound(src, 'sound/weapons/tap.ogg', 50, 1)
if(BRUTE)
if(BRUTE, SEARING, TOX, CLONE)
if(overmind)
damage *= overmind.blob_type.brute_multiplier
else

View File

@@ -78,6 +78,15 @@ var/list/blob_cores = list()
/obj/structure/blob/core/volatile_alluvium
desired_blob_type = /datum/blob_type/volatile_alluvium
/obj/structure/blob/core/ravenous_macrophage
desired_blob_type = /datum/blob_type/ravenous_macrophage
/obj/structure/blob/core/roiling_mold
desired_blob_type = /datum/blob_type/roiling_mold
/obj/structure/blob/core/ectoplasmic_horror
desired_blob_type = /datum/blob_type/ectoplasmic_horror
/obj/structure/blob/core/classic
desired_blob_type = /datum/blob_type/classic

View File

@@ -51,3 +51,8 @@
name = "sluggish factory blob"
max_spores = 4
spore_cooldown = 16 SECONDS
/obj/structure/blob/factory/turret // Produces a single spore slowly, but is intended to be used as a 'mortar' by the blob type.
name = "volatile factory blob"
max_spores = 1
spore_cooldown = 10 SECONDS

View File

@@ -595,6 +595,7 @@
/datum/blob_type/radioactive_ooze/on_pulse(var/obj/structure/blob/B)
SSradiation.radiate(B, 200)
// A blob that steals your weapon.
/datum/blob_type/volatile_alluvium
name = "volatile alluvium"
desc = "A churning, earthy mass that moves in waves."
@@ -642,3 +643,161 @@
B.adjust_integrity(-(damage))
if(B && prob(damage))
B.visible_message("<span class='danger'>The [name] begins to crumble!</span>")
// A blob that produces noxious smoke-clouds and recycles its dying parts.
/datum/blob_type/ravenous_macrophage
name = "ravenous macrophage"
desc = "A disgusting gel that reeks of death."
ai_desc = "resourceful"
effect_desc = "Produces noxious fumes, and melts prey with acidic attacks. Weak to brute damage."
difficulty = BLOB_DIFFICULTY_MEDIUM
color = "#639b3f"
complementary_color = "#d1ec3c"
damage_type = BIOACID
damage_lower = 20
damage_upper = 30
armor_check = "bio"
brute_multiplier = 0.8
burn_multiplier = 0.3
spread_modifier = 0.8
ai_aggressiveness = 70
attack_message = "The macrophage splashes you"
attack_message_living = ", and you feel a horrible burning"
attack_message_synth = ", and your body begins to corrode"
attack_verb = "splashes"
/datum/blob_type/ravenous_macrophage/on_pulse(var/obj/structure/blob/B)
var/mob/living/L = locate() in range(world.view, B)
if(prob(1) && L.mind && !L.stat) // There's some active living thing nearby, produce offgas.
var/turf/T = get_turf(B)
var/datum/effect/effect/system/smoke_spread/noxious/BS = new /datum/effect/effect/system/smoke_spread/noxious
BS.attach(T)
BS.set_up(3, 0, T)
playsound(T, 'sound/effects/smoke.ogg', 50, 1, -3)
BS.start()
/datum/blob_type/ravenous_macrophage/on_death(obj/structure/blob/B)
var/obj/structure/blob/other = locate() in oview(2, B)
if(other)
B.visible_message("<span class='danger'>The dying mass is rapidly consumed by the nearby [other]!</span>")
if(other.overmind)
other.overmind.add_points(rand(1,4))
// Blob that fires biological mortar shells from its factories.
/datum/blob_type/roiling_mold
name = "roiling mold"
desc = "A bubbling, creeping mold."
ai_desc = "bombarding"
effect_desc = "Bombards nearby organisms with toxic spores. Weak to all damage."
difficulty = BLOB_DIFFICULTY_MEDIUM
color = "#571509"
complementary_color = "#ec4940"
damage_type = BRUTE
damage_lower = 5
damage_upper = 20
armor_check = "melee"
brute_multiplier = 1.2
burn_multiplier = 1.2
spread_modifier = 0.8
can_build_factories = TRUE
ai_aggressiveness = 50
attack_message = "The mold whips you"
attack_message_living = ", and you feel a searing pain"
attack_message_synth = ", and your shell buckles"
attack_verb = "lashes"
spore_projectile = /obj/item/projectile/arc/spore
/datum/blob_type/roiling_mold/proc/find_target(var/obj/structure/blob/B, var/tries = 0, var/list/previous_targets = null)
if(tries > 3)
return
var/mob/living/L = locate() in (view(world.view + 3, get_turf(B)) - view(2,get_turf(B)) - previous_targets) // No adjacent mobs.
if(!check_trajectory(L, B, PASSTABLE))
if(!LAZYLEN(previous_targets))
previous_targets = list()
previous_targets |= L
L = find_target(B, tries + 1, previous_targets)
return L
/datum/blob_type/roiling_mold/on_pulse(var/obj/structure/blob/B)
var/mob/living/L = find_target(B)
if(!istype(L))
return
if(istype(B, /obj/structure/blob/factory) && L.stat != DEAD && prob(ai_aggressiveness) && L.faction != "blob")
var/obj/item/projectile/arc/spore/P = new(get_turf(B))
P.launch_projectile(L, BP_TORSO, B)
// A blob that drains energy from nearby mobs in order to fuel itself, and 'negates' some attacks extradimensionally.
/datum/blob_type/ectoplasmic_horror
name = "ectoplasmic horror"
desc = "A disgusting translucent slime that feels out of place."
ai_desc = "dodging"
effect_desc = "Drains energy from nearby life-forms in order to expand itself. Weak to all damage."
difficulty = BLOB_DIFFICULTY_MEDIUM
color = "#72109eaa"
complementary_color = "#1a9de8"
damage_type = HALLOSS
damage_lower = 10
damage_upper = 30
armor_check = "energy"
brute_multiplier = 1.5
burn_multiplier = 1.5
spread_modifier = 0.9
ai_aggressiveness = 50
attack_message = "The horror strikes you"
attack_message_living = ", and you feel a wave of exhaustion"
attack_message_synth = ", and your systems begin to slow"
attack_verb = "strikes"
can_build_factories = TRUE
factory_type = /obj/structure/blob/factory/sluggish
spore_type = /mob/living/simple_mob/blob/spore/weak
var/list/active_beams = list()
/datum/blob_type/ectoplasmic_horror/on_pulse(var/obj/structure/blob/B)
if(B.type == /obj/structure/blob && (locate(/obj/structure/blob/node) in oview(2, get_turf(B))))
B.visible_message("<span class='alien'>The [name] quakes, before hardening.</span>")
new/obj/structure/blob/shield(get_turf(B), B.overmind)
qdel(B)
if(istype(B, /obj/structure/blob/factory))
listclearnulls(active_beams)
var/atom/movable/beam_origin = B
for(var/mob/living/L in oview(world.view, B))
if(L.stat == DEAD || L.faction == "blob")
continue
if(prob(5))
var/beamtarget_exists = FALSE
if(active_beams.len)
for(var/datum/beam/Beam in active_beams)
if(Beam.target == L)
beamtarget_exists = TRUE
break
if(!beamtarget_exists && GetAnomalySusceptibility(L) >= 0.5)
B.visible_message("<span class='danger'>\The [B] lashes out at \the [L]!</span>")
var/datum/beam/drain_beam = beam_origin.Beam(L, icon_state = "drain_life", time = 10 SECONDS)
active_beams |= drain_beam
spawn(9 SECONDS)
if(B && drain_beam)
B.visible_message("<span class='alien'>\The [B] siphons energy from \the [L]</span>")
L.add_modifier(/datum/modifier/berserk_exhaustion, 60 SECONDS)
B.overmind.add_points(rand(10,30))
if(!QDELETED(drain_beam))
qdel(drain_beam)
/datum/blob_type/ectoplasmic_horror/on_received_damage(var/obj/structure/blob/B, damage, damage_type)
if(prob(round(damage * 0.5)))
B.visible_message("<span class='alien'>\The [B] shimmers, distorting through some unseen dimension.</span>")
var/initial_alpha = B.alpha
spawn()
animate(B,alpha = initial_alpha, alpha = 10, time = 10)
animate(B,alpha = 10, alpha = initial_alpha, time = 10)
return 0
return ..()