Beispiel #1
0
HitParams getHitParams(const ItemGroupList &armor_groups,
		const ToolCapabilities *tp, float time_from_last_punch)
{
	s16 damage = 0;
	float full_punch_interval = tp->full_punch_interval;

	for(std::map<std::string, s16>::const_iterator
			i = tp->damageGroups.begin(); i != tp->damageGroups.end(); i++){
		s16 armor = itemgroup_get(armor_groups, i->first);
		damage += i->second * rangelim(time_from_last_punch * full_punch_interval, 0.0, 1.0)
				* armor / 100.0;
	}

	return HitParams(damage, 0);
}
Beispiel #2
0
HitParams getHitParams(const ItemGroupList &groups,
		const ToolCapabilities *tp, float time_from_last_punch)
{
	DigParams digprop = getDigParams(groups, tp,
			time_from_last_punch);
	
	if(time_from_last_punch > tp->full_punch_interval)
		time_from_last_punch = tp->full_punch_interval;
	// Damage in hp is equivalent to nodes dug in time_from_last_punch
	s16 hp = 0;
	if(digprop.diggable)
		hp = time_from_last_punch / digprop.time;
	// Wear is the same as for digging a single node
	s16 wear = (float)digprop.wear;

	return HitParams(hp, wear, digprop.main_group);
}