diff --git a/code/modules/mob/living/simple_animal/simple_animal_vr.dm b/code/modules/mob/living/simple_animal/simple_animal_vr.dm index 718dfee55b..3750e4fdd7 100644 --- a/code/modules/mob/living/simple_animal/simple_animal_vr.dm +++ b/code/modules/mob/living/simple_animal/simple_animal_vr.dm @@ -12,6 +12,10 @@ var/vore_bump_chance = 0 // Chance of trying to eat anyone that bumps into them, regardless of hostility var/vore_bump_emote = "grabs hold of" // Allow messages for bumpnom mobs to have a flavorful bumpnom var/vore_pounce_chance = 5 // Chance of this mob knocking down an opponent + var/vore_pounce_cooldown = 0 // Cooldown timer - if it fails a pounce it won't pounce again for a while + var/vore_pounce_successrate = 100 // Chance of a pounce succeeding against a theoretical 0-health opponent + var/vore_pounce_falloff = 1 // Success rate falloff per %health of target mob. + var/vore_pounce_maxhealth = 80 // Mob will not attempt to pounce targets above this %health var/vore_standing_too = 0 // Can also eat non-stunned mobs var/vore_ignores_undigestable = 1 // Refuse to eat mobs who are undigestable by the prefs toggle. var/swallowsound = null // What noise plays when you succeed in eating the mob. @@ -92,21 +96,39 @@ /mob/living/simple_animal/PunchTarget() ai_log("vr/PunchTarget() [target_mob]", 3) - // For things we don't want to eat, call the sideways "parent" to do normal punching - if(!vore_active || !will_eat(target_mob)) + // If we're not hungry, call the sideways "parent" to do normal punching + if(!vore_active) return ..() - // If target is standing we might pounce and eat them - if(target_mob.canmove && prob(vore_pounce_chance)) - target_mob.Weaken(5) - target_mob.visible_message("\the [src] pounces on \the [target_mob]!!") + // If target is standing we might pounce and knock them down instead of attacking + if(target_mob.canmove && prob(vore_pounce_chance) && !issilicon(target_mob) && (world.time > vore_pounce_cooldown)) //pouncing is worth doing, we want to pounce and are not in cooldown. So attempt a pounce! + if(vore_standing_too) //creatures that can eat you on the spot don't care how healthy you are and get an autohit + return PounceTarget() - // If they're down or we can eat standing, do it - if(!target_mob.canmove || vore_standing_too) + var/TargetHealthPercent = (target_mob.health/target_mob.maxHealth)*100 + if (TargetHealthPercent <= vore_pounce_maxhealth) //check they're weak enough to bother pouncing + if(prob(vore_pounce_successrate - (vore_pounce_falloff * TargetHealthPercent))) // pounce success! + return PounceTarget() + else // pounce misses! + target_mob.visible_message("\the [src] attempts to pounce \the [target_mob] but misses!!") + playsound(loc, 'sound/weapons/punchmiss.ogg', 25, 1, -1) + vore_pounce_cooldown = world.time + 20 SECONDS // don't attempt another pounce for a while + return // no you don't get to attack as well, you missed your chance + + // We're not attempting a pounce, if they're down or we can eat standing, do it as long as they're edible. Otherwise, hit normally. + if(will_eat(target_mob) && (!target_mob.canmove || vore_standing_too)) return EatTarget() else return ..() +/mob/living/simple_animal/proc/PounceTarget() + target_mob.Weaken(5) + target_mob.visible_message("\the [src] pounces on \the [target_mob]!!") + if(will_eat(target_mob)) //if they're edible then eat them too + return EatTarget() + else + return //just leave them on the ground + // Attempt to eat target // TODO - Review this. Could be some issues here /mob/living/simple_animal/proc/EatTarget() @@ -117,7 +139,7 @@ . = animal_nom(target_mob) playsound(src, swallowsound, 50, 1) update_icon() - + if(.) // If we succesfully ate them, lose the target LoseTarget() diff --git a/code/modules/mob/living/simple_animal/vore/zz_vore_overrides.dm b/code/modules/mob/living/simple_animal/vore/zz_vore_overrides.dm index 3b4074e455..fb4d74d360 100644 --- a/code/modules/mob/living/simple_animal/vore/zz_vore_overrides.dm +++ b/code/modules/mob/living/simple_animal/vore/zz_vore_overrides.dm @@ -162,6 +162,7 @@ vore_pounce_chance = 100 vore_digest_chance = 0 // just use the toggle vore_default_mode = DM_HOLD //can use the toggle if you wanna be catfood + vore_standing_too = TRUE //gonna get pounced /mob/living/simple_animal/cat/fluff/EatTarget() var/mob/living/TM = target_mob @@ -201,6 +202,7 @@ vore_pounce_chance = 100 vore_digest_chance = 0 // just use the toggle vore_default_mode = DM_HOLD //can use the toggle if you wanna be foxfood + vore_standing_too = TRUE // gonna get pounced /mob/living/simple_animal/fox/fluff/EatTarget() var/mob/living/TM = target_mob