synchronizing change ammo

This commit is contained in:
FateJH 2018-01-09 20:28:36 -05:00
parent b292739b54
commit 9e51e33246
10 changed files with 407 additions and 68 deletions

View file

@ -277,7 +277,8 @@ class ConverterTest extends Specification {
fury_def.TrunkSize = InventoryTile(11, 11)
fury_def.TrunkOffset = 30
val hellfire_ammo_box = AmmoBox(PlanetSideGUID(432), hellfire_ammo)
val hellfire_ammo_box = AmmoBox(hellfire_ammo)
hellfire_ammo_box.GUID = PlanetSideGUID(432)
val fury = Vehicle(fury_def)
fury.GUID = PlanetSideGUID(413)

View file

@ -65,6 +65,41 @@ class EquipmentTest extends Specification {
obj.Capacity = 65536
obj.Capacity mustEqual 65535
}
"split (0)" in {
val obj = AmmoBox(bullet_9mm)
obj.Capacity = 0
val list = AmmoBox.Split(obj)
list.size mustEqual 0
}
"split (1)" in {
val obj = AmmoBox(bullet_9mm)
obj.Capacity = 50
val list = AmmoBox.Split(obj)
list.size mustEqual 1
list.head.Capacity mustEqual 50
}
"split (2)" in {
val obj = AmmoBox(bullet_9mm)
obj.Capacity = 75
val list = AmmoBox.Split(obj)
list.size mustEqual 2
list.head.Capacity mustEqual 50
list(1).Capacity mustEqual 25
}
"split (4)" in {
val obj = AmmoBox(bullet_9mm)
obj.Capacity = 165
val list = AmmoBox.Split(obj)
list.size mustEqual 4
list.head.Capacity mustEqual 50
list(1).Capacity mustEqual 50
list(2).Capacity mustEqual 50
list(3).Capacity mustEqual 15
}
}
"Tool" should {

View file

@ -12,8 +12,12 @@ import scala.collection.mutable.ListBuffer
import scala.util.Success
class InventoryTest extends Specification {
val bullet9mmBox1 = AmmoBox(PlanetSideGUID(1), bullet_9mm)
val bullet9mmBox2 = AmmoBox(PlanetSideGUID(2), bullet_9mm)
val
bullet9mmBox1 = AmmoBox(bullet_9mm)
bullet9mmBox1.GUID = PlanetSideGUID(1)
val
bullet9mmBox2 = AmmoBox(bullet_9mm)
bullet9mmBox2.GUID = PlanetSideGUID(2)
"GridInventory" should {
"construct" in {