fix: new encumbrance limit was not applied AT ALL

This commit is contained in:
minjaesong
2024-02-01 16:17:58 +09:00
parent 55bb33b4ce
commit 6e1ad9f768
3 changed files with 15 additions and 3 deletions

View File

@@ -163,7 +163,7 @@ internal object SavegameMigrator {
}
@AppliedVersion("0.3.99999")
@AppliedVersion("0.4.0")
fun updatePlayerEncumbrance(actor: Actor) {
if (actor is IngamePlayer && actor.actorValue.getAsInt("encumbrance") == 1000) {
actor.actorValue.set("encumbrance", 50000)

View File

@@ -25,6 +25,18 @@ class ActorInventory() : FixtureInventory() {
this.capacityMode = capacityMode
}
override var maxCapacity: Long = 0
get() = when (capacityMode) {
CAPACITY_MODE_COUNT -> field
CAPACITY_MODE_WEIGHT -> actor.actorValue.getAsInt(AVKey.ENCUMBRANCE)?.toLong() ?: field
CAPACITY_MODE_NO_ENCUMBER -> 0x7FFFFFFFFFFFFFFFL
else -> throw IllegalArgumentException()
}
set(value) {
if (capacityMode == CAPACITY_MODE_COUNT)
field = value
}
/**
* List of all equipped items (tools, armours, rings, necklaces, etc.)
*

View File

@@ -18,8 +18,8 @@ import java.math.BigInteger
open class FixtureInventory() {
var maxCapacity = 100L
var capacityMode = CAPACITY_MODE_COUNT
open var maxCapacity = 100L
open var capacityMode = CAPACITY_MODE_COUNT
constructor(maxCapacity: Long, capacityMode: Int) : this() {
this.maxCapacity = maxCapacity