void LightsaberCrystalComponentImplementation::updateCraftingValues(CraftingValues* values, bool firstUpdate) {

	int colorMax = values->getMaxValue("color");
	int color = values->getCurrentValue("color"); 

	setMaxCondition(values->getCurrentValue("hitpoints"));

	if (colorMax != 31) {
		int finalColor = MIN(color, 11);
		setColor(finalColor);
		updateCrystal(finalColor);
	} 
	else {
		setColor(31);
		updateCrystal(31);
	}

	if (color == 31){
		setQuality(values->getCurrentValue("quality"));
		setAttackSpeed(Math::getPrecision(values->getCurrentValue("attackspeed"), 2));
		setMinimumDamage(MIN(values->getCurrentValue("mindamage"), 50));
		setMaximumDamage(MIN(values->getCurrentValue("maxdamage"), 50));
		setWoundChance(values->getCurrentValue("woundchance"));

		// Following are incoming positive values in script (Due to loot modifier.)
		// Switch to negative number.
		setSacHealth(MIN(values->getCurrentValue("attackhealthcost"), 9) * -1);
		setSacAction(MIN(values->getCurrentValue("attackactioncost"), 9) * -1);
		setSacMind(MIN(values->getCurrentValue("attackmindcost"), 9) * -1);
		setForceCost(MIN(values->getCurrentValue("forcecost"), 9) * -1);
	}

	ComponentImplementation::updateCraftingValues(values, firstUpdate);
}
void LightsaberCrystalComponentImplementation::updateCraftingValues(CraftingValues* values, bool firstUpdate) {
	int colorMax = values->getMaxValue("color");
	int color = values->getCurrentValue("color");

	if (colorMax != 31) {
		int finalColor = Math::min(color, 11);
		setColor(finalColor);
		updateCrystal(finalColor);
	} else {
		setColor(31);
		updateCrystal(31);
	}

	generateCrystalStats();

	ComponentImplementation::updateCraftingValues(values, firstUpdate);
}