void GeneticLabratory::experimentRow(CraftingValues* craftingValues,int rowEffected, int pointsAttempted, float failure, int experimentationResult) { float modifier, newValue, valA, valB; String title, subtitle, subtitlesTitle; title = craftingValues->getVisibleExperimentalPropertyTitle(rowEffected); modifier = calculateExperimentationValueModifier(experimentationResult,pointsAttempted); for (int i = 0; i < craftingValues->getExperimentalPropertySubtitleSize(); ++i) { subtitlesTitle = craftingValues->getExperimentalPropertySubtitlesTitle(i); if (subtitlesTitle == title) { subtitle = craftingValues->getExperimentalPropertySubtitle(i); modifier = calculateExperimentationValueModifier(experimentationResult,pointsAttempted); newValue = craftingValues->getCurrentPercentage(subtitle) + modifier; if (newValue >= craftingValues->getMaxPercentage(subtitle)) newValue = craftingValues->getMaxPercentage(subtitle); if (newValue <= 0) newValue = 0; craftingValues->setCurrentPercentage(subtitle, newValue); } } // bump the resists up if (craftingValues->getMaxValue("dna_comp_armor_kinetic") > 0) craftingValues->setCurrentPercentage("dna_comp_armor_kinetic",craftingValues->getCurrentPercentage("dna_comp_armor_kinetic") + modifier); if (craftingValues->getMaxValue("dna_comp_armor_blast") > 0) craftingValues->setCurrentPercentage("dna_comp_armor_blast",craftingValues->getCurrentPercentage("dna_comp_armor_blast") + modifier); if (craftingValues->getMaxValue("dna_comp_armor_energy") > 0) craftingValues->setCurrentPercentage("dna_comp_armor_energy",craftingValues->getCurrentPercentage("dna_comp_armor_energy") + modifier); if (craftingValues->getMaxValue("dna_comp_armor_heat") > 0) craftingValues->setCurrentPercentage("dna_comp_armor_heat",craftingValues->getCurrentPercentage("dna_comp_armor_heat") + modifier); if (craftingValues->getMaxValue("dna_comp_armor_cold") > 0) craftingValues->setCurrentPercentage("dna_comp_armor_cold",craftingValues->getCurrentPercentage("dna_comp_armor_cold") + modifier); if (craftingValues->getMaxValue("dna_comp_armor_electric") > 0) craftingValues->setCurrentPercentage("dna_comp_armor_electric",craftingValues->getCurrentPercentage("dna_comp_armor_electric") + modifier); if (craftingValues->getMaxValue("dna_comp_armor_acid") > 0) craftingValues->setCurrentPercentage("dna_comp_armor_acid",craftingValues->getCurrentPercentage("dna_comp_armor_acid") + modifier); if (craftingValues->getMaxValue("dna_comp_armor_stun") > 0) craftingValues->setCurrentPercentage("dna_comp_armor_stun",craftingValues->getCurrentPercentage("dna_comp_armor_stun") + modifier); if (craftingValues->getMaxValue("dna_comp_armor_saber") > 0) craftingValues->setCurrentPercentage("dna_comp_armor_saber",craftingValues->getCurrentPercentage("dna_comp_armor_saber") + modifier); }
void ResourceLabratory::experimentRow(CraftingValues* craftingValues,int rowEffected, int pointsAttempted, float failure, int experimentationResult){ float modifier, newValue; String title, subtitle, subtitlesTitle; title = craftingValues->getVisibleExperimentalPropertyTitle(rowEffected); for (int i = 0; i < craftingValues->getExperimentalPropertySubtitleSize(); ++i) { subtitlesTitle = craftingValues->getExperimentalPropertySubtitlesTitle(i); if (subtitlesTitle == title) { subtitle = craftingValues->getExperimentalPropertySubtitle(i); modifier = calculateExperimentationValueModifier(experimentationResult,pointsAttempted); newValue = craftingValues->getCurrentPercentage(subtitle) + modifier; if (newValue > craftingValues->getMaxPercentage(subtitle)) newValue = craftingValues->getMaxPercentage(subtitle); if (newValue < 0) newValue = 0; craftingValues->setCurrentPercentage(subtitle, newValue); } } }