help with Combat.lua and checkHit() required

All development conversation and discussion takes place here

Moderator: Moderator

Post Reply
Message
Author
jenx
Sher'Tul Godslayer
Posts: 2263
Joined: Mon Feb 14, 2011 11:16 pm

help with Combat.lua and checkHit() required

#1 Post by jenx »

I'm working on Combat.lua and the checkHit function:

Code: Select all

--New, simpler checkHit that relies on rescaleCombatStats() being used elsewhere
function _M:checkHit(atk, def, min, max, factor, p)
	if atk < 0 then atk = 0 end
	if def < 0 then def = 0 end
	local min = min or 0
	local max = max or 100
	if game.player:hasQuest("tutorial-combat-stats") then
		min = 0
		max = 100
	end --ensures predictable combat for the tutorial
	print("checkHit", atk, def)
	local hit = math.ceil(50 + 2.5 * (atk - def))
	hit = util.bound(hit, min, max)
	print("=> chance to hit", hit)
	return rng.percent(hit), hit
end
I can't figure out what "factor" and "p" do as they are not referenced in the function itself. Lots of calls to this function however send in values for factor and sometimes p.

DG?
MADNESS rocks

aardvark
Wyrmic
Posts: 200
Joined: Wed Aug 22, 2012 12:16 am

Re: help with Combat.lua and checkHit() required

#2 Post by aardvark »

It doesn't look like they do anything. Probably vestigial from an earlier version of the function.

darkgod
Master of Eyal
Posts: 10750
Joined: Wed Jul 24, 2002 9:26 pm
Location: Angolwen
Contact:

Re: help with Combat.lua and checkHit() required

#3 Post by darkgod »

yup indeed
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)

jenx
Sher'Tul Godslayer
Posts: 2263
Joined: Mon Feb 14, 2011 11:16 pm

Re: help with Combat.lua and checkHit() required

#4 Post by jenx »

Ok
MADNESS rocks

Post Reply