znmud-0.0.1/benchmark/
znmud-0.0.1/cmd/
znmud-0.0.1/cmd/emotes/
znmud-0.0.1/cmd/objects/
znmud-0.0.1/cmd/tiny/
znmud-0.0.1/doc/
znmud-0.0.1/farts/
znmud-0.0.1/lib/
znmud-0.0.1/lib/combat/
znmud-0.0.1/lib/core/bodytypes/
znmud-0.0.1/lib/engine/
znmud-0.0.1/lib/farts/
znmud-0.0.1/logs/
#
# file::    cmd_bash.rb

# 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.
#

module Cmd

  bindtextdomain("cmd")

  # Skill: Bashes things, like doors
  def cmd_bash(args)
	case args
	when "", nil
		sendto _("Bash what?")
	else
		# Check if exit direction has a door
		door = nil
		loc = get_object(location)
		loc.exits.each do |exid|
			ex = get_object(exid)
			door = ex if ex.name =~/#{args}/i
		end
		if door
			if stats[:mp] - 2 > 0
				stats[:mp] -= 2 if not world.is_builder? id
			else
				sendto _("You are too exhausted.")
				return
			end
			if door.door_state == Exit::DOOR_CLOSED or door.door_state == Exit::DOOR_LOCKED
				chance = get_skill(:bash) * 10
				chance = 0 if door.has_attribute? :no_bash
				chance = 100 if world.is_admin? id
				if rand(100) < chance
					door.door_state = Exit::DOOR_OPEN
					get_object(door.linked_exit).door_state = Exit::DOOR_OPEN
					sendto _("You bash open the %{door}!!" % {:door => door.door_name})
					msg = Msg.new _("^p1 bashes open the %{door}!!" % {:door => door.door_name})
					msg.p1 = name
					sendroom(msg)
					msg = _("The %{door} bashes in!!" % {:door => door.door_name})
					get_object(door.to_room).say(msg)
					add_exp(2)
				else
					sendto _("You bash on the %{door}!" % {:door => door.door_name})
					msg = Msg.new _("^p1 bashes against the %{door}!" % {:door => door.door_name})
					msg.p1 = name
					sendroom(msg)
					msg = _("You hear banging on the %{door}" % {:door => door.door_name})
					get_object(door.to_room).say(msg)
				end
			else
				sendto _("Bashing that will do no good.")
			end
		else
			sendto _("Exit not found.")
		end
		
	end
  end

end