/// <summary> /// Constructs a BattleEntityModel based on the character input /// </summary> /// <param name="data"></param> public BattleEntityModel(CharacterModel data) { EntityType = EntityTypeEnum.Character; Id = data.Id; Alive = data.Alive; ExperiencePoints = data.TotalExperience; Level = data.Level; Name = data.Name; Description = data.Description; Speed = data.GetSpeed(); ImageURI = data.ImageURI; CurrentHealth = data.CurrentHealth; MaxHealth = data.MaxHealth; Attack = data.GetAttack(); Defense = data.GetDefense(); Range = data.GetRange(); IconURI = data.IconURI; }
/// <summary> /// Update the BattleEntityModel with new character stats. /// For example, if a character levels up or gets new items that increase speed. /// </summary> /// <param name="data"></param> /// <returns></returns> public bool Update(CharacterModel data) { // should not update a monster entity with a character if (EntityType != EntityTypeEnum.Character) { return(false); } // reflect updates in character stats Alive = data.Alive; ExperiencePoints = data.TotalExperience; Level = data.Level; Name = data.Name; Description = data.Description; Speed = data.GetSpeed(); ImageURI = data.ImageURI; CurrentHealth = data.CurrentHealth; MaxHealth = data.MaxHealth; Attack = data.GetAttack(); Defense = data.GetDefense(); Range = data.GetRange(); return(true); }