Unify XP progression and enable ability ranks
This commit is contained in:
@@ -59,7 +59,7 @@ func (w *World) restorePowers(c *Character) error {
|
||||
return errors.New("invalid learned power history")
|
||||
}
|
||||
for id, v := range c.View.Powers {
|
||||
if id != v.Definition.ID || v.XP < 0 || v.XP > 1000000000000 || !finiteCraft(v.ReadyAt) || v.Definition.BaseXP < 1 || v.Definition.XPPerLevel < 1 || v.Definition.MaxLevel < 1 || v.Definition.MaxLevel > 1000 {
|
||||
if id != v.Definition.ID || v.XP < 0 || v.XP > 10000000000000 || !finiteCraft(v.ReadyAt) || v.Definition.BaseXP < 1 || v.Definition.XPPerLevel < 1 || v.Definition.MaxLevel < 1 || v.Definition.MaxLevel > 1000 {
|
||||
return errors.New("invalid learned spell")
|
||||
}
|
||||
d := v.Definition
|
||||
@@ -76,7 +76,7 @@ func (w *World) restorePowers(c *Character) error {
|
||||
}
|
||||
}
|
||||
for _, v := range c.View.Weapons {
|
||||
if v.XP < 0 || v.XP > 1000000000000 {
|
||||
if v.XP < 0 || v.XP > 10000000000000 {
|
||||
return errors.New("invalid weapon XP")
|
||||
}
|
||||
}
|
||||
@@ -116,10 +116,13 @@ func (w *World) powerRequirements(c *Character, d p.PowerDefinition) bool {
|
||||
return true
|
||||
}
|
||||
func (w *World) acquirePower(c *Character, d content.PowerDefinition) {
|
||||
if d.Kind == "ability" && d.MaxLevel == 1 {
|
||||
d.MaxLevel = 1000
|
||||
}
|
||||
var definition p.PowerDefinition
|
||||
raw, _ := json.Marshal(d)
|
||||
_ = json.Unmarshal(raw, &definition)
|
||||
v := p.LearnedPower{Definition: definition, Level: 1, XPToNextLevel: d.BaseXP}
|
||||
v := p.LearnedPower{Definition: definition, Level: 1, XPToNextLevel: content.XPForLevel(2)}
|
||||
for _, a := range w.Balance.Combat.Attacks {
|
||||
if a.ID == d.AttackID {
|
||||
v.Attack = protocolAttack(a)
|
||||
@@ -215,15 +218,15 @@ func (w *World) awardCombatCredit(shot Projectile) {
|
||||
credit.Rewarded = true
|
||||
if credit.Power != "" {
|
||||
v, ok := c.View.Powers[credit.Power]
|
||||
if ok && v.Definition.Kind == "spell" {
|
||||
v.XP = min(int64(1000000000000), v.XP+w.Balance.Powers.SpellXP)
|
||||
if ok {
|
||||
v.XP = min(int64(10000000000000), v.XP+w.Balance.Powers.SpellXP)
|
||||
c.View.Powers[credit.Power] = v
|
||||
}
|
||||
}
|
||||
if credit.Weapon != "" {
|
||||
v, ok := c.View.Weapons[credit.Weapon]
|
||||
if ok {
|
||||
v.XP = min(int64(1000000000000), v.XP+w.Balance.Powers.WeaponXP)
|
||||
v.XP = min(int64(10000000000000), v.XP+w.Balance.Powers.WeaponXP)
|
||||
c.View.Weapons[credit.Weapon] = v
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user