public Trait(TraitData data) { name = data.name; type = data.type; secrecy = data.secrecy; description = data.description; //set effect in derived class' constructor }
public static Trait Load(TraitData data) { switch (data.type) { case "Weakness": return(new WeaknessTrait(data)); case "TrueForm": return(new TrueFormTrait(data)); case "Prison": return(new PrisonTrait(data)); case "Prisoner": return(new PrisonerTrait(data)); default: return(null); } }