()
| 1358 | } |
| 1359 | |
| 1360 | func (c *Character) LevelUp() (bool, stats.Statistics) { |
| 1361 | |
| 1362 | if c.XPTNL() > c.Experience { |
| 1363 | return false, stats.Statistics{} |
| 1364 | } |
| 1365 | |
| 1366 | var statsBefore stats.Statistics = c.Stats |
| 1367 | |
| 1368 | c.Level++ |
| 1369 | |
| 1370 | cfgProg := configs.GetProgressionConfig() |
| 1371 | if int(cfgProg.TrainingPointsEveryNLevels) <= 1 || c.Level%int(cfgProg.TrainingPointsEveryNLevels) == 0 { |
| 1372 | c.TrainingPoints += int(cfgProg.TrainingPointsPerLevel) |
| 1373 | } |
| 1374 | if int(cfgProg.StatPointsEveryNLevels) <= 1 || c.Level%int(cfgProg.StatPointsEveryNLevels) == 0 { |
| 1375 | c.StatPoints += int(cfgProg.StatPointsPerLevel) |
| 1376 | } |
| 1377 | |
| 1378 | c.Validate() |
| 1379 | |
| 1380 | var statsDelta stats.Statistics = c.Stats |
| 1381 | |
| 1382 | statsDelta.Strength.Value -= statsBefore.Strength.Value |
| 1383 | statsDelta.Speed.Value -= statsBefore.Speed.Value |
| 1384 | statsDelta.Smarts.Value -= statsBefore.Smarts.Value |
| 1385 | statsDelta.Vitality.Value -= statsBefore.Vitality.Value |
| 1386 | statsDelta.Mysticism.Value -= statsBefore.Mysticism.Value |
| 1387 | statsDelta.Perception.Value -= statsBefore.Perception.Value |
| 1388 | |
| 1389 | c.Health = c.HealthMax.Value |
| 1390 | c.Mana = c.ManaMax.Value |
| 1391 | |
| 1392 | return true, statsDelta |
| 1393 | } |
| 1394 | |
| 1395 | func (c *Character) Heal(hp int, mana int) (int, int) { |
| 1396 | startHP := c.Health |
no test coverage detected