Skip to content

Commit

Permalink
hostile ai changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Halonexus committed Apr 26, 2024
1 parent 7c83259 commit 8bdced2
Show file tree
Hide file tree
Showing 58 changed files with 327 additions and 279 deletions.
8 changes: 4 additions & 4 deletions ModularTegustation/tegu_mobs/lc13_humanoids.dm
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,12 @@ Skittish, they prefer to move in groups and will run away if the enemies are in
return FALSE
return ..()

/mob/living/simple_animal/hostile/humanoid/rat/knife/AttackingTarget()
/mob/living/simple_animal/hostile/humanoid/rat/knife/AttackingTarget(atom/attacked_target)
if(!can_act)
return
..()
if(dash_cooldown < world.time)
BackstreetsDash(target)
BackstreetsDash(attacked_target)
return

/mob/living/simple_animal/hostile/humanoid/rat/knife/OpenFire()
Expand Down Expand Up @@ -620,8 +620,8 @@ Skittish, they prefer to move in groups and will run away if the enemies are in
return

. = ..()
if (istype(target, /mob/living))
var/mob/living/L = target
if (istype(attacked_target, /mob/living))
var/mob/living/L = attacked_target
L.apply_lc_burn(burn_stacks)

/mob/living/simple_animal/hostile/humanoid/fixer/flame/bullet_act(obj/projectile/Proj, def_zone, piercing_hit = FALSE)
Expand Down
20 changes: 10 additions & 10 deletions ModularTegustation/tegu_mobs/lc13_outskirtdwellers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@
if(maxHealth >= 250)
. += span_notice("Drag yourself onto [src] in order to ride them.")

/mob/living/simple_animal/hostile/morsel/AttackingTarget()
/mob/living/simple_animal/hostile/morsel/AttackingTarget(atom/attacked_target)
retreat_distance = 0
if(is_type_in_typecache(target,wanted_objects)) //we eats
qdel(target)
if(is_type_in_typecache(attacked_target, wanted_objects)) //we eats
qdel(attacked_target)
buffed = (buffed + 1)
if(buffed >= 10)
PustuleChurn()
Expand All @@ -84,10 +84,10 @@
if(!target)
retreat_distance = 0

/mob/living/simple_animal/hostile/morsel/AttackingTarget()
/mob/living/simple_animal/hostile/morsel/AttackingTarget(atom/attacked_target)
. = ..()
if(.)
var/dir_to_target = get_dir(get_turf(src), get_turf(target))
var/dir_to_target = get_dir(get_turf(src), get_turf(attacked_target))
animate(src, pixel_y = (base_pixel_y + 18), time = 2)
addtimer(CALLBACK(src, PROC_REF(AnimateBack)), 2)
for(var/i = 1 to 2)
Expand Down Expand Up @@ -724,11 +724,11 @@ Mobs that mostly focus on dealing RED damage, they are all a bit more frail than
return FALSE
return ..()

/mob/living/simple_animal/hostile/lovetown/slumberer/AttackingTarget()
/mob/living/simple_animal/hostile/lovetown/slumberer/AttackingTarget(atom/attacked_target)
if(countering)
return
if(grab_ready)
return OpenFire(target)
return OpenFire(attacked_target)
return ..()

/mob/living/simple_animal/hostile/lovetown/slumberer/OpenFire(target)
Expand Down Expand Up @@ -1023,8 +1023,8 @@ Mobs that mostly focus on dealing RED damage, they are all a bit more frail than
if(current_stage == 2)
adjustBruteLoss(-40) //self damages at stage 2

if(ishuman(target))
if(Finisher(target))
if(ishuman(attacked_target))
if(Finisher(attacked_target))
return

if(countering)
Expand All @@ -1037,7 +1037,7 @@ Mobs that mostly focus on dealing RED damage, they are all a bit more frail than
DisableCounter()
return
if(counter_ready)
return OpenFire(target)
return OpenFire(attacked_target)
return AoeAttack()

/mob/living/simple_animal/hostile/lovetown/abomination/OpenFire(target)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,15 @@
return FALSE
return ..()

/mob/living/simple_animal/hostile/abnormality/censored/AttackingTarget()
/mob/living/simple_animal/hostile/abnormality/censored/AttackingTarget(atom/attacked_target)
. = ..()
if(!can_act)
return

if(!ishuman(target))
if(!ishuman(attacked_target))
return

var/mob/living/carbon/human/H = target
var/mob/living/carbon/human/H = attacked_target
if(H.stat >= SOFT_CRIT || H.health < 0)
return Convert(H)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,24 +260,24 @@
Combusting_Courage()
return

/mob/living/simple_animal/hostile/abnormality/crying_children/AttackingTarget()
/mob/living/simple_animal/hostile/abnormality/crying_children/AttackingTarget(atom/attacked_target)
if(!can_act)
return FALSE
if(!client)
if(desperate && (courage_cooldown <= world.time) && prob(30))
return Combusting_Courage()
if(sorrow_cooldown <= world.time && prob(25))
return Wounds_Of_Sorrow(target)
return Wounds_Of_Sorrow(attacked_target)

if(prob(35))
return Bygone_Illusion(target)
return Bygone_Illusion(attacked_target)

// Distorted Illusion
can_act = FALSE
icon_state = "[icon_phase]_salvador"
. = ..()
if(isliving(target))
var/mob/living/L = target
if(isliving(attacked_target))
var/mob/living/L = attacked_target
L.apply_lc_burn(5*burn_mod)
SLEEP_CHECK_DEATH(10)
icon_state = "[icon_phase]_idle"
Expand Down Expand Up @@ -506,7 +506,7 @@
if(!target)
target = H
if(target in view(1, src))
AttackingTarget()
AttackingTarget(target)
tagged = TRUE

// Unseeing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,26 +80,26 @@
return FALSE
return ..()

/mob/living/simple_animal/hostile/abnormality/melting_love/AttackingTarget()
/mob/living/simple_animal/hostile/abnormality/melting_love/AttackingTarget(atom/attacked_target)
// Convert
if(ishuman(target))
var/mob/living/carbon/human/H = target
if(ishuman(attacked_target))
var/mob/living/carbon/human/H = attacked_target
if(H.stat == DEAD || H.health <= HEALTH_THRESHOLD_DEAD)
return SlimeConvert(H)

// Consume a slime. Cannot work on the big one, so the check is not istype()
if(target.type == /mob/living/simple_animal/hostile/slime)
var/mob/living/simple_animal/hostile/slime/S = target
if(attacked_target.type == /mob/living/simple_animal/hostile/slime)
var/mob/living/simple_animal/hostile/slime/S = attacked_target
visible_message(span_warning("[src] consumes \the [S], restoring its own health."))
. = ..() // We do a normal attack without AOE and then consume the slime to restore HP
adjustBruteLoss(-maxHealth * 0.2)
S.adjustBruteLoss(S.maxHealth) // To make sure it dies
return .

// AOE attack
if(isliving(target) || ismecha(target))
new /obj/effect/gibspawner/generic/silent/melty_slime(get_turf(target))
for(var/turf/open/T in view(1, target))
if(isliving(attacked_target) || ismecha(attacked_target))
new /obj/effect/gibspawner/generic/silent/melty_slime(get_turf(attacked_target))
for(var/turf/open/T in view(1, attacked_target))
var/obj/effect/temp_visual/small_smoke/halfsecond/S = new(T)
S.color = "#FF0081"
var/list/got_hit = list()
Expand Down Expand Up @@ -288,10 +288,10 @@
return FALSE
return ..()

/mob/living/simple_animal/hostile/slime/AttackingTarget()
/mob/living/simple_animal/hostile/slime/AttackingTarget(atom/attacked_target)
// Convert
if(ishuman(target))
var/mob/living/carbon/human/H = target
if(ishuman(attacked_target))
var/mob/living/carbon/human/H = attacked_target
if(H.stat == DEAD || H.health <= HEALTH_THRESHOLD_DEAD)
return SlimeConvert(H)
if(prob(statuschance))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,16 @@
return TRUE
return FALSE

/mob/living/simple_animal/hostile/abnormality/mountain/AttackingTarget()
/mob/living/simple_animal/hostile/abnormality/mountain/AttackingTarget(atom/attacked_target)
if(finishing)
return FALSE
if(phase >= 2)
if(prob(35) && OpenFire())
return
. = ..()
if(. && isliving(target))
var/mob/living/L = target
if(isliving(target) && (L.health < 0 || L.stat == DEAD))
if(. && isliving(attacked_target))
var/mob/living/L = attacked_target
if(isliving(attacked_target) && (L.health < 0 || L.stat == DEAD))
finishing = TRUE
if(phase == 3)
icon_state = "mosb_bite2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -604,8 +604,8 @@
for(var/i = 1 to 3)
target_turf = get_step(target_turf, get_dir(get_turf(src), target_turf))
return WhipAttack(target_turf)
if(isliving(target))
var/mob/living/L = target
if(isliving(attacked_target))
var/mob/living/L = attacked_target
if(L.health <= 0)
if(ishuman(L))
var/mob/living/carbon/human/H = L
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,8 @@
return ConeAttack(target)
if((slam_cooldown <= world.time) && prob(35))
return Slam()
if(ishuman(target))
if(Finisher(target))
if(ishuman(attacked_target))
if(Finisher(attacked_target))
return
return ..()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,16 @@
return ..()

//Attacking code
/mob/living/simple_animal/hostile/abnormality/titania/AttackingTarget()
/mob/living/simple_animal/hostile/abnormality/titania/AttackingTarget(atom/attacked_target)
if(fused)
return FALSE
var/mob/living/carbon/human/H = target
var/mob/living/carbon/human/H = attacked_target
//Kills the weak immediately.
if(get_user_level(H) < 4 && (ishuman(H)))
say("I rid you of your pain, mere human.")
H.gib()
for(var/i=fairy_spawn_number*2, i>=1, i--) //This counts down.
var/mob/living/simple_animal/hostile/fairyswarm/V = new(get_turf(target))
var/mob/living/simple_animal/hostile/fairyswarm/V = new(get_turf(attacked_target))
V.faction = faction
spawned_mobs+=V
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,16 +285,16 @@ GLOBAL_LIST_EMPTY(apostles)
return FALSE
return ..()

/mob/living/simple_animal/hostile/apostle/AttackingTarget()
/mob/living/simple_animal/hostile/apostle/AttackingTarget(atom/attacked_target)
if(!can_act)
return

if(isliving(target))
var/mob/living/L = target
if(isliving(attacked_target))
var/mob/living/L = attacked_target
if(faction_check_mob(L))
return
. = ..()
if(. && isliving(target))
if(. && isliving(attacked_target))
if(!client && ranged && ranged_cooldown <= world.time)
OpenFire()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@
if(!can_act)
return FALSE
if ((grab_cooldown <= world.time) && prob(35) && (!client))//checks for client since you can still use the claw if you click nearby
var/turf/target_turf = get_turf(target)
var/turf/target_turf = get_turf(attacked_target)
return ClawGrab(target_turf)
return Whip_Attack()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,12 @@
if(target_memory[the_target] <= 100)
return FALSE

/mob/living/simple_animal/hostile/better_memories_minion/AttackingTarget()
/mob/living/simple_animal/hostile/better_memories_minion/AttackingTarget(atom/attacked_target)
if(!can_act)
return FALSE
if(!client)
if(ishuman(target))
var/mob/living/carbon/human/H = target
if(ishuman(attacked_target))
var/mob/living/carbon/human/H = attacked_target
/* Dont jab those standing
still for their picture.
Death is not our goal */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,12 @@
hired = FALSE
return ..()

/mob/living/simple_animal/hostile/abnormality/blue_shepherd/AttackingTarget()
/mob/living/simple_animal/hostile/abnormality/blue_shepherd/AttackingTarget(atom/attacked_target)
. = ..()
if(client)
switch(chosen_attack)
if(1)
if(isliving(target))
if(isliving(attacked_target))
slash_current-=1
return OpenFire()
if(2)
Expand All @@ -215,7 +215,7 @@
slashing = TRUE
slash()
if(awakened_buddy)
awakened_buddy.GiveTarget(target)
awakened_buddy.GiveTarget(attacked_target)

/mob/living/simple_animal/hostile/abnormality/blue_shepherd/OpenFire()
if(slash_current == 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@
..()

/mob/living/simple_animal/hostile/abnormality/drifting_fox/AttackingTarget(atom/attacked_target)
if(ishuman(target))
var/mob/living/carbon/human/H = target
if(ishuman(attacked_target))
var/mob/living/carbon/human/H = attacked_target
H.apply_status_effect(STATUS_EFFECT_FALSEKIND)
return ..()

Expand Down
6 changes: 3 additions & 3 deletions code/modules/mob/living/simple_animal/abnormality/he/eris.dm
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@
return FALSE

/mob/living/simple_animal/hostile/abnormality/eris/AttackingTarget(atom/attacked_target)
if(ishuman(target))
var/mob/living/H = target
if(ishuman(attacked_target))
var/mob/living/H = attacked_target
if(H.stat >= SOFT_CRIT)
Dine(target)
Dine(attacked_target)
return
..()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,26 +283,26 @@
is_maggot = TRUE
SpeedChange(-1)

/mob/living/simple_animal/hostile/abnormality/golden_apple/AttackingTarget()//regular attacks or AOE. Determines the outcome for both players and the AI behavior
/mob/living/simple_animal/hostile/abnormality/golden_apple/AttackingTarget(atom/attacked_target)//regular attacks or AOE. Determines the outcome for both players and the AI behavior
if(!can_act)
return FALSE
if(!is_maggot)//Is it still in the first form? Start building sheen pulses
if(pulse_count < pulse_maximum)
if(isliving(target))
var/mob/living/hit = target
if(isliving(attacked_target))
var/mob/living/hit = attacked_target
if((hit.stat == DEAD) ||!ishuman(hit))//if the target is dead or not human
return ..()
pulse_count += 1
return ..()
if(client && smash_cooldown < world.time)//playable behavior is nested under here
switch(chosen_attack)
if(1)
Smash(target)
Smash(attacked_target)
if(2)
Smash(target, wide = FALSE)
Smash(attacked_target, wide = FALSE)
return
if(prob(50) && (smash_cooldown < world.time))//AI behavior goes here
Smash(target, wide = pick(TRUE, FALSE))
Smash(attacked_target, wide = pick(TRUE, FALSE))
return
return ..()

Expand Down
Loading

0 comments on commit 8bdced2

Please sign in to comment.