fix: restore battle entry and character profile initialization
This commit is contained in:
1 parent
cfbbc7b970
commit
5c4d0d4149
16 files changed
+888
-228
No files matched your search
@@ -199,6 +199,23 @@ func (a *AvatarJson) SPMaxVal() uint32 {
|
||||
return 10000
|
||||
}
|
||||
|
||||
// Battle SP is a ratio in ten-thousandths (PearlSR createBattleAvatar).
|
||||
// FreeSR imports may instead carry absolute energy and its capacity; use
|
||||
// their ratio so both absolute and already scaled imports serialize alike.
|
||||
const battleRatioScale uint32 = 10000
|
||||
|
||||
func (a *AvatarJson) BattleSPCur() uint32 {
|
||||
maximum := a.SPMaxVal()
|
||||
if maximum == 0 {
|
||||
return 0
|
||||
}
|
||||
current := a.SPCur()
|
||||
if current > maximum {
|
||||
current = maximum
|
||||
}
|
||||
return uint32(uint64(current) * uint64(battleRatioScale) / uint64(maximum))
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Battle config (freesr-data.json)
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -253,15 +270,16 @@ type RogueMagicScepter struct {
|
||||
}
|
||||
|
||||
type BattleConfig struct {
|
||||
BattleType BattleType `json:"battle_type"`
|
||||
Monsters [][]Monster `json:"monsters"`
|
||||
Blessings []BattleBuffJson `json:"blessings"`
|
||||
StageID uint32 `json:"stage_id"`
|
||||
CycleCount uint32 `json:"cycle_count"`
|
||||
PathResonanceID uint32 `json:"path_resonance_id"`
|
||||
CustomStats []SubAffix `json:"custom_stats"`
|
||||
Scepters []RogueMagicScepter `json:"scepters"`
|
||||
CustomBattleLineup map[uint32]uint32 `json:"custom_battle_lineup"`
|
||||
EnableInvasionSupport bool `json:"enable_invasion_support"`
|
||||
BattleType BattleType `json:"battle_type"`
|
||||
Monsters [][]Monster `json:"monsters"`
|
||||
Blessings []BattleBuffJson `json:"blessings"`
|
||||
StageID uint32 `json:"stage_id"`
|
||||
CycleCount uint32 `json:"cycle_count"`
|
||||
PathResonanceID uint32 `json:"path_resonance_id"`
|
||||
CustomStats []SubAffix `json:"custom_stats"`
|
||||
Scepters []RogueMagicScepter `json:"scepters"`
|
||||
CustomBattleLineup map[uint32]uint32 `json:"custom_battle_lineup"`
|
||||
}
|
||||
|
||||
func DefaultBattleConfig() BattleConfig {
|
||||
|
||||
Reference in new issue
Block a user