update merc
This commit is contained in:
@@ -30,6 +30,7 @@ type Data struct {
|
||||
Corpse Corpse
|
||||
Monsters Monsters
|
||||
Corpses Monsters
|
||||
Mercenary OwnMercenary
|
||||
Game OnlineGame
|
||||
PlayerUnit PlayerUnit
|
||||
NPCs NPCs
|
||||
@@ -100,19 +101,21 @@ func (r Room) IsInside(p Position) bool {
|
||||
}
|
||||
|
||||
func (d Data) MercHPPercent() int {
|
||||
for _, m := range d.Monsters {
|
||||
if m.IsMerc() {
|
||||
// Hacky thing to read merc life properly
|
||||
maxLife := m.Stats[stat.MaxLife] >> 8
|
||||
life := float64(m.Stats[stat.Life] >> 8)
|
||||
if m.Stats[stat.Life] <= 32768 {
|
||||
life = float64(m.Stats[stat.Life]) / 32768.0 * float64(maxLife)
|
||||
}
|
||||
// for _, m := range d.Monsters {
|
||||
// if m.IsMerc() {
|
||||
// // Hacky thing to read merc life properly
|
||||
// maxLife := m.Stats[stat.MaxLife] >> 8
|
||||
// life := float64(m.Stats[stat.Life] >> 8)
|
||||
// if m.Stats[stat.Life] <= 32768 {
|
||||
// life = float64(m.Stats[stat.Life]) / 32768.0 * float64(maxLife)
|
||||
// }
|
||||
|
||||
return int(life / float64(maxLife) * 100)
|
||||
}
|
||||
// return int(life / float64(maxLife) * 100)
|
||||
// }
|
||||
// }
|
||||
if d.Mercenary.Found {
|
||||
return d.Mercenary.HPPercent
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user