You can slash yourself in KoA. You can also slash while sitting and while blind. In events/weapon_combat, change the slash function to:
def slash(event, player, room)
return unless Combat.balanced? player
weapon = get_weapon(player, :slash)
if weapon.nil?
player.output "You are not wielding a weapon you can slash with."
return
end
if player.prone?
player.output('You must stand up first.')
return
end
if player.blind?
player.output('You are blind and cannot see your target.')
return
end
target = (event.target && room.find(event.target)) || room.find(player.last_target)
if target == player
player.output "You cannot slash yourself."
return
end
if target.nil?
player.output "Who are you trying to attack?"
return
else
return unless Combat.valid_target? player, target
end
player.last_target = target.goid
event.target = target
event[:to_other] = "#{weapon.name} flashes as #{player.name} swings it at #{target.name}."
event[:to_target] = "#{weapon.name} flashes as #{player.name} swings it towards you."
event[:to_player] = "#{weapon.name} flashes as you swing it towards #{target.name}."
event[:attack_weapon] = weapon
event[:blockable] = true
player.balance = false
player.info.in_combat = true
target.info.in_combat = true
room.out_event event
event[:action] = :weapon_hit
event[:combat_action] = :slash
event[:to_other] = "#{player.name} slashes across #{target.name}'s torso with #{weapon.name}."
event[:to_target] = "#{player.name} slashes across your torso with #{weapon.name}."
event[:to_player] = "You slash across #{target.name}'s torso with #{weapon.name}."
Combat.future_event event
end
You can also block while blind. Add this code:
if player.blind?
player.output('You are blind and cannot see your target.')
return
end
above this line:
target = (event.target && room.find(event.target)) || room.find(player.last_target)
Martial combat has the same problems. Change the kick and punch functions to:
def kick(event, player, room)
return unless Combat.balanced? player
if player.prone?
player.output('You must stand up first.')
return
end
if player.blind?
player.output('You are blind and cannot see your target.')
return
end
target = (event.target && room.find(event.target)) || room.find(player.last_target)
if target == player
player.output "You cannot kick yourself."
return
end
if target.nil?
player.output "Who are you trying to attack?"
return
else
return unless Combat.valid_target? player, target
end
player.last_target = target.goid
event.target = target
event[:to_other] = "#{player.name} kicks #{player.pronoun(:possessive)} foot out at #{target.name}."
event[:to_target] = "#{player.name} kicks #{player.pronoun(:possessive)} foot at you."
event[:to_player] = "You balance carefully and kick your foot out towards #{target.name}."
event[:blockable] = true
player.balance = false
player.info.in_combat = true
target.info.in_combat = true
room.out_event event
event[:action] = :martial_hit
event[:combat_action] = :kick
event[:to_other] = "#{player.name} kicks #{target.name} with considerable violence."
event[:to_target] = "#{player.name} kicks you rather violently."
event[:to_player] = "Your kick makes good contact with #{target.name}."
Combat.future_event event
end
def punch(event, player, room)
return unless Combat.balanced? player
if player.prone?
player.output('You must stand up first.')
return
end
if player.blind?
player.output('You are blind and cannot see your target.')
return
end
target = (event.target && room.find(event.target)) || room.find(player.last_target)
if target == player
player.output "You cannot punch yourself."
return
end
if target.nil?
player.output "Who are you trying to attack?"
return
else
return unless Combat.valid_target? player, target
end
player.last_target = target.goid
event.target = target
event[:to_other] = "#{player.name} swings #{player.pronoun(:possessive)} clenched fist at #{target.name}."
event[:to_target] = "#{player.name} swings #{player.pronoun(:possessive)} fist straight towards your face."
event[:to_player] = "You clench your hand into a fist and swing it at #{target.name}."
event[:blockable] = true
player.balance = false
player.info.in_combat = true
target.info.in_combat = true
room.out_event event
event[:action] = :martial_hit
event[:combat_action] = :punch
event[:to_other] = "#{player.name} punches #{target.name} directly in the face."
event[:to_target] = "You stagger slightly as #{player.name} punches you in the face."
event[:to_player] = "Your fist lands squarely in #{target.name}'s face."
Combat.future_event event
end
And add the following to the simple_dodge function, above this line:
target = (event.target && room.find(event.target)) || room.find(player.last_target)
if player.prone?
player.output('You must stand up first.')
return
end