function modifications_undo($stats)
{
	if($_POST['unseenfury']>0) $stats["attackpower"][0] -= $stats["attackpower"][0]/100 * $_POST['unseenfury']*3;
	if($_POST['goodhealth']>0) $stats["health"][0] -= $stats["health"][0]/100 * 2 * $_POST['goodhealth'];
	if($_POST['enduring']>0) $stats["health"][0] -= $stats["health"][0]/100 * $_POST['enduring'];
	$stats = stats_derive_remove($stats);
	if($_POST['combatexpertise']>0) $stats["hit"][0] = $stats["hit"][0] - 5 * $_POST['combatexpertise'];
	return $stats;
}
Example #2
0
function score($stats,$slot)
{
	// perform scoring of stats without thresholds according to implementation in $class_settings.php
	// since some derived stats are not thresholded, add them so they can be scored as well
	$stats = stats_derive($stats);
	$score = score_stats($stats,$slot);
	$stats = stats_derive_remove($stats);

	// perform scoring of stats with thresholds
	foreach($stats as $stat) {
              if($stat[5]) // if stat can have threshold
		{
			$target = $_POST[$stat[1].'target'];

			// update stats with new item
			$stats = talents_calculate($stats);
			$stats = buffs_calculate($stats);
			// derived stats disabled for now, since this causes some scores to be higher then they should
			//$stats = stats_derive($stats);
			$stats = talents_calculate_derived($stats);
			$stats = buffs_calculate_derived($stats);

			if($target>0) // if a threshold has been set in browser
			{
				if($stats[$stat[1]][0]>$target) { // if stat goes over the set threshold
					$surplus = $stats[$stat[1]][0]-$target;
					$score += $target * $_POST[$stat[1].'weight'];
					$score += $surplus * $_POST[$stat[1].'aboveweight'];
				}
				else // stat is under threshold
				{
					$score += $stats[$stat[1]][0] * $_POST[$stat[1].'weight'];
				}
			}
			else // no threshold was set
			{
				$score += $stats[$stat[1]][0] * $_POST[$stat[1].'weight'];
			}
		
			// revert stats to their unmodified state
			$stats = stats_derive($stats);
			$stats = modifications_undo($stats);
		}
	}
	return $score;
}
function modifications_undo($stats)
{
	// derived buffs
	if($_POST['drakefilet']) { $stats["spellpower"][0] -= 10; }
	if($_POST['burningpowerstone']) { $stats["spellpower"][0] -= 200; }
	// derived talents
	$stats = stats_derive_remove($stats);
	// base buffs
	if($_POST['fanfareknowledge']) { $stats["wisdom"][0] -= 52; $stats["intelligence"][0] -= 52; }
	if($_POST['vitalitystone']) { $stats["wisdom"][0] -= 52; $stats["intelligence"][0] -= 52; }
	if($_POST['mightybrightsurge']) { $stats["wisdom"][0] -= 35; $stats["intelligence"][0] -= 35; }
	if($_POST['heroicbrightsurge']) { $stats["wisdom"][0] -= 40; $stats["intelligence"][0] -= 40; }
	if($_POST['ancienttablet']) $stats["wisdom"][0] -= 17;
	if($_POST['eldertablet']) $stats["wisdom"][0] -= 19;
	if($_POST['resonance']) { $stats["wisdom"][0] = $stats["wisdom"][0] * 0.95; $stats["intelligence"][0] = $stats["intelligence"][0] * 0.95;  }
	// base talents
	if($_POST['tempest']>0) $_POST['spellcritweight'] -= $stats["spellcritweight"][0]/100 * $_POST['tempest']*10;
	if($_POST['naturalawareness']>0) $stats["intelligence"][0] = $stats["intelligence"][0] / (1 + $_POST['naturalawareness']*0.05);
	if($_POST['acumen']>0) $stats["intelligence"][0] = $stats["intelligence"][0] / (1 + $_POST['acumen']*0.02);

	return $stats;
}