Skip to content

Commit

Permalink
Weighted random slashes for AI
Browse files Browse the repository at this point in the history
  • Loading branch information
morrowwolf committed Nov 3, 2023
1 parent 2141fcb commit a6cc6f6
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 14 deletions.
9 changes: 0 additions & 9 deletions code/modules/mob/living/carbon/xenomorph/ai/xeno_ai.dm
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,6 @@
QDEL_NULL(ai_movement_handler)
return ..()

GLOBAL_LIST_INIT(ai_target_limbs, list(
"head",
"chest",
"l_leg",
"r_leg",
"l_arm",
"r_arm"
))

/mob/living/carbon/xenomorph/proc/init_movement_handler()
return new /datum/xeno_ai_movement(src)

Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/xenomorph/attack_alien.dm
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@

M.flick_attack_overlay(src, "slash")
var/obj/limb/affecting
affecting = get_limb(rand_zone(M.zone_selected, 70))
affecting = get_limb(M.mob_flags & AI_CONTROLLED ? rand_zone() : rand_zone(M.zone_selected, 70))
if(!affecting) //No organ, just get a random one
affecting = get_limb(rand_zone(null, 0))
if(!affecting) //Still nothing??
Expand Down
1 change: 0 additions & 1 deletion code/modules/mob/living/carbon/xenomorph/castes/Lurker.dm
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@
/mob/living/carbon/xenomorph/lurker/process_ai(delta_time)
if(get_active_hand())
swap_hand()
zone_selected = pick(GLOB.ai_target_limbs)
return ..()

/datum/behavior_delegate/lurker_base
Expand Down
1 change: 0 additions & 1 deletion code/modules/mob/living/carbon/xenomorph/castes/Runner.dm
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@
/mob/living/carbon/xenomorph/runner/process_ai(delta_time)
if(get_active_hand())
swap_hand()
zone_selected = pick(GLOB.ai_target_limbs)
return ..()

/datum/behavior_delegate/runner_base
Expand Down
4 changes: 2 additions & 2 deletions code/modules/mob/mob_helpers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ var/list/global/base_miss_chance = list(
//Used to weight organs when an organ is hit randomly (i.e. not a directed, aimed attack).
//Also used to weight the protection value that armor provides for covering that body part when calculating protection from full-body effects.
var/list/global/organ_rel_size = list(
"head" = 15,
"head" = 20,
"chest" = 70,
"groin" = 30,
"l_leg" = 25,
Expand All @@ -60,7 +60,7 @@ var/list/global/organ_rel_size = list(
"l_foot" = 10,
"r_foot" = 10,
"eyes" = 5,
"mouth" = 15,
"mouth" = 5,
)

// This is much faster than a string comparison
Expand Down

0 comments on commit a6cc6f6

Please sign in to comment.