# Author: Craig Smith # # This source code copyright (C) 2009 Craig Smith # All rights reserved. # # Released under the terms of the TeensyMUD Public License # See LICENSE file for additional information. # require 'gettext' require 'combat/attackmsgs' # These are the damage tables. Once it has been determined that damage # has been done. The type of damage of the details are determined by # these charts. Initialize the appropriate chart and use deal() with a # random number from 1-100 # Critical Miss Chart class CriticalMiss < AttackMsgs include GetText bindtextdomain("core") def initialize(attacker, defender, damagetype, hitlocationid, weaponid) @a = attacker @d = defender @damagetype = damagetype @hitlocationid = hitlocationid @weaponid = weaponid super(@a, @d, damagetype, hitlocationid, weaponid) end def deal(roll) roll2 = rand(100)+1 msg2a = nil msg2d = nil msg2r = nil head = _("head") torso = _("torso") case @damagetype when :zombie # A zombies critical miss is basically a special "rot" event bpid = @a.body.bodyparts[rand(@a.body.bodyparts.size)] part = get_object(bpid) if part.crippled case part.name when /#{head}/ self.msg2a = _("[color Red]Part of your brain leeks out of your empty eye socket![/color]") self.msg2d = _("Some of ^p1's brains leak out of their empty eye socket!") self.msg2r = msg2d @a.body.damage(part.id, 8) when /#{torso}/ self.msg2a = _("[color Red]Your guts spill out onto the floor![/color]") self.msg2d = _("^p1's guts spill out onto the floor!") self.msg2r = msg2d @a.body.damage(part.id, 4) else self.msg2a = _("[color Red]Part of your %{loc} falls off![/color]" % {loc => part.name}) self.msg2d = _("Part of ^p1's %{loc} falls off!" % {:loc => part.name}) self.msg2r = msg2d @a.body.damage(part.id, 2) end else case part.name when /#{head}/ self.msg2a = _("[color Red]You feel your eyes fall out of your skull![/color]") self.msg2d = _("^p1's eyes drip out of their head!") self.msg2r = msg2d @a.body.damage(part.id, 4) when /#{torso}/ self.msg2a = _("[color Red]Your guts spill out onto the floor![/color]") self.msg2d = _("^p1's guts spill out onto the floor!") self.msg2r = msg2d @a.body.damage(part.id, 2) else self.msg2a = _("[color Red]Part of your %{loc} falls off![/color]" % {:loc => part.name}) self.msg2d = _("Part of ^p1's %{loc} falls off!" % {:loc => part.name}) self.msg2r = msg2d @a.body.damage(part.id, 1) end part.crippled = true end sendmsgs when :melee, :biting, :clawing case roll2 when 0..2 feet = @a.body.getbodyid(_("feet")) footid = feet[rand(feet.size)] foot = get_object(footid) if foot.crippled self.msg2a = _("[color Red]You trip over your crippled %{foot}[/color]" % {:foot => foot.name}) self.msg2d = _("^p1 trips over thier crippled %{foot}" % {:foot => foot.name}) self.msg2r = msg2d @a.body.damage(footid, 1) else self.msg2a = _("[color Red]You twist your ankle in the battle![/color]") self.msg2d = _("^p1 twists their ankle and is limping badly!") self.msg2r = msg2d foot.crippled = true @a.body.damage(footid, 2) end when 3..4 hands = @a.body.getbodyid(_("hands")) handid = hands[rand(hands.size)] hand = get_object(handid) if hand.crippled self.msg2a = _("[color Red] You smash your already busted %{hand}[\color]" % {:hand => hand.name}) self.msg2d = _("^p1 smashes their already busted %{hand}" % {:hand => hand.name}) self.msg2r = msg2d @a.body.damage(handid, 1) else self.msg2a = _("[color Red]You bust open your %{hand} trying to punch ^p2[/color]" % {:hand => hand.name}) self.msg2d = _("^p1 busts open their %{hand} tying to hit you!" % {:hand => hand.name}) self.msg2r = _("^p1 busts open their %{hand} trying to hit ^p2" % {:hand => hand.name}) hand.crippled = true @a.body.damage(handid, 2) end when 5..25 self.msg2a = _("You stumble and fall flat on your face!") self.msg2d = _("^p1 stumbles and falls flat on their face!") self.msg2r = msg2d @a.body.damage("head",1) @a.add_attribute :stunned else end else end sendmsgs end end