inventory encumberment now takes player scale into account

This commit is contained in:
minjaesong
2024-02-20 15:49:11 +09:00
parent a5953b8c87
commit 063483cfda
14 changed files with 68 additions and 29 deletions

View File

@@ -8,6 +8,7 @@ import net.torvald.terrarum.gameactors.Actor
import net.torvald.terrarum.gameitems.GameItem
import net.torvald.terrarum.gameitems.ItemID
import net.torvald.terrarum.modulebasegame.ui.UIQuickslotBar
import net.torvald.terrarum.sqr
/**
* Created by minjaesong on 2016-03-15.
@@ -38,6 +39,21 @@ class ActorInventory() : FixtureInventory() {
field = value
}
val maxCapacityByActor: Double
get() = maxCapacity * ((actor.actorValue.getAsDouble(AVKey.SCALE) ?: 1.0) * (actor.actorValue.getAsDouble(AVKey.SCALEBUFF) ?: 1.0)).sqr()
/**
* How encumbered the actor is. 1.0 if weight of the items are exactly same as the capacity limit, >1.0 if encumbered.
*/
override val encumberment: Double
get() = if (capacityMode == CAPACITY_MODE_NO_ENCUMBER)
0.0
else if (capacityMode == CAPACITY_MODE_WEIGHT)
capacity / maxCapacityByActor
else
0.0
/**
* List of all equipped items (tools, armours, rings, necklaces, etc.)
*

View File

@@ -254,7 +254,7 @@ open class FixtureInventory() {
/**
* How encumbered the actor is. 1.0 if weight of the items are exactly same as the capacity limit, >1.0 if encumbered.
*/
val encumberment: Double
open val encumberment: Double
get() = if (capacityMode == CAPACITY_MODE_NO_ENCUMBER)
0.0
else if (capacityMode == CAPACITY_MODE_WEIGHT)