<commit_before>game = require '../game'
items = require '../definitions/items'

{MapItem} = require '../entities'

exports.asMapItem = (x, y, item) ->
	new MapItem null, x, y, item

exports.generatePeculiarObject = ->
	new items.PeculiarObject

exports.generateGun = (type, name) ->
	type ?= game.random.sample ['handgun', 'shotgun']
	name ?= type

	gun = new items.Gun
	gun.name = name
	gun.gunType = type

	gun.range = game.random.range 5, 12

	if type is 'shotgun'
		angle = game.random.range 15, 60
		gun.spread = (angle / 180 * Math.PI)

	gun

exports.generateStartingGun = ->
	type = 'handgun'

	exports.generateGun type, "trusty handgun"<commit_msg>Refactor gun generation, shotguns range change<commit_after>game = require '../game'
items = require '../definitions/items'

{MapItem} = require '../entities'

exports.asMapItem = (x, y, item) ->
	new MapItem null, x, y, item

exports.generatePeculiarObject = ->
	new items.PeculiarObject

exports.generateGun = (type, name) ->
	type ?= game.random.sample ['handgun', 'shotgun']
	name ?= type

	gun = new items.Gun
	gun.name = name
	gun.gunType = type

	switch type
		when 'handgun'
			gun.range = game.random.range 5, 12

		when 'shotgun'
			gun.range = game.random.range 3, 9
			angle = game.random.range 15, 60
			gun.spread = (angle / 180 * Math.PI)

	gun

exports.generateStartingGun = ->
	type = 'handgun'

	exports.generateGun type, "trusty handgun"
{'fraction_non_alphanumeric': 0.14022662889518414, 'fraction_numerical': 0.015580736543909348, 'mean_word_length': 3.5434083601286175, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5973550', 'n_tokens_mistral': 549, 'n_tokens_neox': 489, 'n_words': 134}