Health/Mana/Exp load values from save file #815 (#886)

* Return errors for #790

* Fixing lint issues

* Returning nil instead of empty struct pointer

* Removed new hero stat calls as new player requires stats to be passed in. These were using defaults regardless of the save file.

* Removed override on the default to health/mana/experience. These should now result is proper values.

* Removed new hero stat calls as new player requires stats to be passed in. These were using defaults regardless of the save file.

* Removed override on the default to health/mana/experience. These should now result is proper values.
This commit is contained in:
Stephen Horan 2020-10-31 23:59:24 -04:00 committed by GitHub
parent 2c6c54acce
commit 4dd69e7709
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 8 deletions

View File

@ -55,10 +55,5 @@ func (f *HeroStateFactory) CreateHeroStatsState(heroClass d2enum.Hero, classStat
result.Health = result.MaxHealth
result.Stamina = float64(result.MaxStamina)
// https://github.com/OpenDiablo2/OpenDiablo2/issues/815
result.Health = 50
result.Mana = 30
result.Experience = 166
return &result
}

View File

@ -86,9 +86,7 @@ func (f *MapEntityFactory) NewPlayer(id, name string, x, y, direction int, heroT
stats.NextLevelExp = f.asset.Records.GetExperienceBreakpoint(heroType, stats.Level)
stats.Stamina = float64(stats.MaxStamina)
defaultCharStats := f.asset.Records.Character.Stats[heroType]
statsState := f.HeroStateFactory.CreateHeroStatsState(heroType, defaultCharStats)
heroState, _ := f.CreateHeroState(name, heroType, statsState)
heroState, _ := f.CreateHeroState(name, heroType, stats)
result := &Player{
mapEntity: newMapEntity(x, y),