mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-15 13:04:05 +09:00
inventory encumberment now takes player scale into account
This commit is contained in:
@@ -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.)
|
||||
*
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user