All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.softwaremagico.tm.random.predefined.profile.RandomProfileFactory Maven / Gradle / Ivy

There is a newer version: 0.10.5
Show newest version
package com.softwaremagico.tm.random.predefined.profile;

/*-
 * #%L
 * Think Machine (Random Generator)
 * %%
 * Copyright (C) 2017 - 2021 Softwaremagico
 * %%
 * This software is designed by Jorge Hortelano Otero. Jorge Hortelano Otero
 *  Valencia (Spain).
 *
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation; either version 2 of the License, or (at your option) any later
 * version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program; If not, see .
 * #L%
 */

import com.softwaremagico.tm.cache.ProfileFactoryCacheLoader;
import com.softwaremagico.tm.character.benefices.AvailableBenefice;
import com.softwaremagico.tm.character.benefices.BeneficeDefinition;
import com.softwaremagico.tm.character.blessings.Blessing;
import com.softwaremagico.tm.character.characteristics.Characteristic;
import com.softwaremagico.tm.character.factions.Faction;
import com.softwaremagico.tm.character.occultism.OccultismPath;
import com.softwaremagico.tm.character.races.Race;
import com.softwaremagico.tm.character.skills.AvailableSkill;
import com.softwaremagico.tm.json.factories.cache.FactoryCacheLoader;
import com.softwaremagico.tm.random.predefined.RandomPredefinedFactory;
import com.softwaremagico.tm.random.selectors.IRandomPreference;

import java.util.Set;

public class RandomProfileFactory extends RandomPredefinedFactory {
    private static final String TRANSLATOR_FILE = "profiles.xml";

    private ProfileFactoryCacheLoader profileFactoryCacheLoader;

    private static class RandomProfileFactoryInit {
        public static final RandomProfileFactory INSTANCE = new RandomProfileFactory();
    }

    public static RandomProfileFactory getInstance() {
        return RandomProfileFactoryInit.INSTANCE;
    }

    @Override
    public String getTranslatorFile() {
        return TRANSLATOR_FILE;
    }

    @Override
    public FactoryCacheLoader getFactoryCacheLoader() {
        if (profileFactoryCacheLoader == null) {
            profileFactoryCacheLoader = new ProfileFactoryCacheLoader();
        }
        return profileFactoryCacheLoader;
    }

    @Override
    protected RandomProfile createNew(String id, String name, String description, String language, String moduleName,
                                      Set> randomPreferences, Set characteristicsMinimumValues,
                                      Set requiredSkills, Set suggestedSkills,
                                      Set mandatoryBlessings, Set suggestedBlessings,
                                      Set mandatoryBenefices, Set suggestedBenefices,
                                      Set mandatoryBeneficeSpecializations, Set suggestedBeneficeSpecializations,
                                      Set mandatoryOccultismPaths, Faction faction, Race race, String group) {
        return new RandomProfile(id, name, description, language, moduleName, randomPreferences, characteristicsMinimumValues,
                requiredSkills, suggestedSkills, mandatoryBlessings, suggestedBlessings, mandatoryBenefices, suggestedBenefices,
                mandatoryBeneficeSpecializations, suggestedBeneficeSpecializations, mandatoryOccultismPaths, faction, race, group);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy