Esempio n. 1
0
def hitCheck(target, factors):
	accuracy = random.gauss(factors['accuracy'], factors['accuracy'] * RANDOMNESS)
	
	evasion = random.gauss(factors['evasion'], factors['evasion'] * RANDOMNESS)
	evasion /= 3
	
	# Succeed w chance a/(a+e)
	rand = random.uniform(0, accuracy + evasion)
	hit = rand <= accuracy
	
	# Store result 'miss'
	if not hit:
		space = target['position']
		storeResult.storeText(space, 'miss')
	
	return hit
Esempio n. 2
0
def addObjects(*units):
	for i in range(0, len(units)):
		unit = units[i]

		# Change its position before adding
		unit['position'] = logic.globalDict['commandSpecialSpaces'][i]

		# Add game object
		unitControl.object.add(unit)

		# Remove unit from inactive units list, if it's in there
		inactiveUnits = logic.globalDict['inactiveUnits']
		for i in range(0, len(inactiveUnits)):
			if unit == inactiveUnits[i]:
				# TODO(kgeffen) In version 0.3, as scaffolding, generic units are created instead of
				# specific characters. Once specific characters exist, uncomment deletion
				#del inactiveUnits[i]
				break

		storeResult.storeText(unit['position'], 'Poof!')
Esempio n. 3
0
def addTrait(unit, trait):
	if trait not in unit['traits']:
		unit['traits'].append(trait)

		storeResult.storeText(unit['position'], trait)