// lib/models/attributes.dart /// Representa os atributos de um personagem no jogo. /// Estes valores são cruciais para o progresso e o resultado do jogo. class Attributes { double money; double happiness; double health; double education; double professionalExperience; Attributes({ this.money = 0.0, this.happiness = 0.5, // 0.0 a 1.0, 0.5 é o valor neutro this.health = 0.5, // 0.0 a 1.0 this.education = 0.0, this.professionalExperience = 0.0, }); /// Adiciona os valores de outro objeto Attributes a este. void add(Attributes other) { this.money += other.money; this.health += other.health; this.happiness += other.happiness; this.professionalExperience += other.professionalExperience; this.education += other.education; } /// Construtor de fábrica para criar uma instância a partir de um mapa. factory Attributes.fromMap(Map map) { return Attributes( money: map['money'] as double, happiness: map['happiness'] as double, health: map['health'] as double, education: map['education'] as double, professionalExperience: map['professionalExperience'] as double, ); } /// Converte a instância para um mapa para fácil armazenamento. Map toMap() { return { 'money': money, 'happiness': happiness, 'health': health, 'education': education, 'professionalExperience': professionalExperience, }; } }