Skip to content

Commit

Permalink
Hostile AI changes
Browse files Browse the repository at this point in the history
squashed
  • Loading branch information
Halonexus committed Dec 16, 2024
1 parent 1464348 commit 788ceb6
Show file tree
Hide file tree
Showing 73 changed files with 497 additions and 369 deletions.
4 changes: 4 additions & 0 deletions ModularTegustation/ego_weapons/melee/aleph.dm
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,10 @@

attacking = TRUE //ALWAYS blocking ranged attacks

/obj/item/ego_weapon/shield/distortion/Initialize()
. = ..()
aggro_on_block *= 4

/obj/item/ego_weapon/shield/distortion/EgoAttackInfo(mob/user)
return span_notice("It deals [force * 4] red, white, black and pale damage combined.")

Expand Down
6 changes: 6 additions & 0 deletions ModularTegustation/ego_weapons/melee/subtype/shield.dm
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
var/block_sound_volume = 50
var/projectile_timer
var/parry_timer
var/aggro_on_block

/obj/item/ego_weapon/shield/Initialize()
. = ..()
Expand All @@ -56,6 +57,7 @@
resistances_list += list("BLACK" = reductions[3])
if(reductions[4] != 0)
resistances_list += list("PALE" = reductions[4])
aggro_on_block = force * 3

//Allows the user to deflect projectiles for however long recovery time is set to on a hit
/obj/item/ego_weapon/shield/melee_attack_chain(mob/user, atom/target, params)
Expand Down Expand Up @@ -96,6 +98,10 @@
shield_user.physiology.black_mod *= max(0.001, (1 - ((reductions[3]) / 100)))
shield_user.physiology.pale_mod *= max(0.001, (1 - ((reductions[4]) / 100)))
RegisterSignal(user, COMSIG_MOB_APPLY_DAMGE, PROC_REF(AnnounceBlock))
for(var/mob/living/simple_animal/hostile/H in hearers(3, user))
if(H.stat != CONSCIOUS || H.AIStatus == AI_OFF || H.client)
continue
H.RegisterAggroValue(user, aggro_on_block, AGGRO_DAMAGE)
if(QDELING(src))
DisableBlock(shield_user)
else
Expand Down
16 changes: 8 additions & 8 deletions ModularTegustation/tegu_mobs/lc13_corrosions.dm
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,12 @@
return FALSE
..()

/mob/living/simple_animal/hostile/ordeal/snake_corrosion/AttackingTarget()
/mob/living/simple_animal/hostile/ordeal/snake_corrosion/AttackingTarget(atom/attacked_target)
if(!can_act)
return FALSE
..()
if(isliving(target))
var/mob/living/H = target
. = ..()
if(isliving(attacked_target))
var/mob/living/H = attacked_target
H.apply_venom(applied_venom)

/mob/living/simple_animal/hostile/ordeal/snake_corrosion/OpenFire()
Expand Down Expand Up @@ -409,16 +409,16 @@
return
..()

/mob/living/simple_animal/hostile/ordeal/dog_corrosion/AttackingTarget()
/mob/living/simple_animal/hostile/ordeal/dog_corrosion/AttackingTarget(atom/attacked_target)
if(charging)
return
if(dash_cooldown <= world.time && !client && charge_ready)
PrepCharge(target)
PrepCharge(attacked_target)
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.health < 0)
H.gib()
playsound(src, "sound/abnormalities/clouded_monk/eat.ogg", 75, 1)
Expand Down
8 changes: 4 additions & 4 deletions ModularTegustation/tegu_mobs/lc13_humanoids.dm
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,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 @@ -653,8 +653,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)
TripleDash()

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 @@ -52,10 +52,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 Down Expand Up @@ -87,10 +87,10 @@
return
return ..()

/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 @@ -735,11 +735,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 @@ -1039,8 +1039,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 @@ -1053,7 +1053,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
2 changes: 2 additions & 0 deletions code/__DEFINES/combat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
#define BLACK_DAMAGE "black"
/// Deals brute damage in percents.
#define PALE_DAMAGE "pale"
/// Fake damage used for hostile ai targetting
#define AGGRO_DAMAGE "aggro"

//bitflag damage defines used for suicide_act
#define BRUTELOSS (1<<0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,24 +262,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 @@ -508,7 +508,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 @@ -116,15 +116,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 @@ -100,26 +100,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 @@ -326,10 +326,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 @@ -120,16 +120,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 @@ -625,8 +625,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 @@ -348,8 +348,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 @@ -77,10 +77,10 @@
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.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,16 +310,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 @@ -218,7 +218,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 @@ -159,11 +159,11 @@
density = TRUE
mouse_opacity = MOUSE_OPACITY_ICON

/mob/living/simple_animal/hostile/abnormality/basilisoup/AttackingTarget()
/mob/living/simple_animal/hostile/abnormality/basilisoup/AttackingTarget(atom/attacked_target)
if(!can_act)
return
if(ishuman(target))
var/mob/living/carbon/human/H = target
if(ishuman(attacked_target))
var/mob/living/carbon/human/H = attacked_target
if(H.nutrition >= NUTRITION_LEVEL_FAT)
playsound(get_turf(src), 'sound/abnormalities/bigbird/bite.ogg', 50, 1, 2)
H.gib()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,12 +203,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
Loading

0 comments on commit 788ceb6

Please sign in to comment.