mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-03-20 12:30:40 +00:00
Spud Gun (#572)
* initial spiker logic for charging mechanic; it's functional but doesn't work exactly by the numbers say it should * no damage degrade for radial damage; charge mode features, including damage on the projectile and fire mode on the weapon; the Spiker's damage output is pretty close to accurate * ammunition drain timer works correctly; no need for the progress completion function; new formatting sucks * dial back on fire mode changes; stop excessive weapon discharge case; comments * master merge; test fix (when did it change?) * test repair; fixed unintentional side-effect of instantiation of StanDamProf
This commit is contained in:
parent
b573530b25
commit
78f970a4ac
15 changed files with 552 additions and 167 deletions
|
|
@ -3,12 +3,7 @@ package objects
|
|||
|
||||
import net.psforever.objects.definition.ToolDefinition
|
||||
import net.psforever.objects.{GlobalDefinitions, Tool}
|
||||
import net.psforever.objects.equipment.{
|
||||
EquipmentSize,
|
||||
FireModeDefinition,
|
||||
InfiniteFireModeDefinition,
|
||||
PelletFireModeDefinition
|
||||
}
|
||||
import net.psforever.objects.equipment._
|
||||
import org.specs2.mutable._
|
||||
|
||||
class FireModeTest extends Specification {
|
||||
|
|
@ -129,4 +124,32 @@ class FireModeTest extends Specification {
|
|||
obj.Magazine mustEqual 1
|
||||
}
|
||||
}
|
||||
|
||||
"ChargeFireModeDefinition" should {
|
||||
"construct" in {
|
||||
val obj = new ChargeFireModeDefinition(1000, 500)
|
||||
obj.AmmoTypeIndices mustEqual Nil
|
||||
obj.AmmoSlotIndex mustEqual 0
|
||||
obj.Magazine mustEqual 1
|
||||
obj.RoundsPerShot mustEqual 1
|
||||
obj.Chamber mustEqual 1
|
||||
obj.Time mustEqual 1000L
|
||||
obj.DrainInterval mustEqual 500L
|
||||
}
|
||||
|
||||
"discharge" in {
|
||||
val obj = Tool(GlobalDefinitions.spiker)
|
||||
obj.FireMode.isInstanceOf[ChargeFireModeDefinition] mustEqual true
|
||||
obj.Magazine mustEqual 25
|
||||
obj.FireMode.RoundsPerShot mustEqual 1
|
||||
obj.FireMode.Chamber mustEqual 1
|
||||
|
||||
obj.Magazine mustEqual 25
|
||||
obj.Discharge()
|
||||
obj.Magazine mustEqual 24
|
||||
obj.Discharge()
|
||||
obj.Discharge()
|
||||
obj.Magazine mustEqual 22
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class ProjectileTest extends Specification {
|
|||
obj.InitialVelocity mustEqual 1
|
||||
obj.Lifespan mustEqual 1f
|
||||
obj.DamageAtEdge mustEqual 1f
|
||||
obj.DamageRadius mustEqual 1f
|
||||
obj.DamageRadius mustEqual 0f
|
||||
obj.UseDamage1Subtract mustEqual false
|
||||
}
|
||||
|
||||
|
|
@ -269,7 +269,7 @@ class ProjectileTest extends Specification {
|
|||
obj.attribute_to mustEqual obj.tool_def.ObjectId
|
||||
obj.shot_origin mustEqual Vector3(1.2f, 3.4f, 5.6f)
|
||||
obj.shot_angle mustEqual Vector3(0.2f, 0.4f, 0.6f)
|
||||
obj.fire_time <= System.nanoTime mustEqual true
|
||||
obj.fire_time <= System.currentTimeMillis() mustEqual true
|
||||
obj.isResolved mustEqual false
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue