Stamina / Implants (#485)

* removing stamina update business logic from the Player class

* I really need to sort this out

* implant changes: deactivate when changing armor or loadouts and when zoning; extra details for state management when being jammed or fatigued upon loading

* merge with master

* pull rebase on master; moved implant learning/forgetting to PlayerControl, but not yet completely tested

* unhandled case of no implant in a slot during avatar setup

* complete implant deactivation optional?

* moved reference to player control agency for matters concerning stamina updates on damage taken

* - > +

* crouching makes nothing better

* PlayerControl now handles stamina regeneration; handling a case where being fatigued because activation charge is too much leaves the drain timer running

* no more stamina drain message; moving functionality into the class (out of the object) for expediency; handling implant uninitialization differently upon death

* test repairs; redundant messages in player damage and player death logic

* no jumping; riders get a free pass

* making the code uglier
This commit is contained in:
Fate-JH 2020-06-10 09:27:12 -04:00 committed by GitHub
parent 3ea51d404e
commit 181fdb9c84
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 737 additions and 536 deletions

View file

@ -89,27 +89,27 @@ class CreateShortcutMessageTest extends Specification {
}
"presets" in {
Shortcut.AUDIO_AMPLIFIER.get.purpose mustEqual 2
Shortcut.AUDIO_AMPLIFIER.get.tile mustEqual "audio_amplifier"
Shortcut.DARKLIGHT_VISION.get.purpose mustEqual 2
Shortcut.DARKLIGHT_VISION.get.tile mustEqual "darklight_vision"
Shortcut.ENHANCED_TARGETING.get.purpose mustEqual 2
Shortcut.ENHANCED_TARGETING.get.tile mustEqual "targeting"
Shortcut.MEDKIT.get.purpose mustEqual 0
Shortcut.MEDKIT.get.tile mustEqual "medkit"
Shortcut.MELEE_BOOSTER.get.purpose mustEqual 2
Shortcut.MELEE_BOOSTER.get.tile mustEqual "melee_booster"
Shortcut.PERSONAL_SHIELD.get.purpose mustEqual 2
Shortcut.PERSONAL_SHIELD.get.tile mustEqual "personal_shield"
Shortcut.RANGE_MAGNIFIER.get.purpose mustEqual 2
Shortcut.RANGE_MAGNIFIER.get.tile mustEqual "range_magnifier"
Shortcut.REGENERATION.get.purpose mustEqual 2
Shortcut.REGENERATION.get.tile mustEqual "advanced_regen"
Shortcut.SECOND_WIND.get.purpose mustEqual 2
Shortcut.SECOND_WIND.get.tile mustEqual "second_wind"
Shortcut.SENSOR_SHIELD.get.purpose mustEqual 2
Shortcut.SENSOR_SHIELD.get.tile mustEqual "silent_run"
Shortcut.SURGE.get.purpose mustEqual 2
Shortcut.SURGE.get.tile mustEqual "surge"
Shortcut.AudioAmplifier.get.purpose mustEqual 2
Shortcut.AudioAmplifier.get.tile mustEqual "audio_amplifier"
Shortcut.DartklightVision.get.purpose mustEqual 2
Shortcut.DartklightVision.get.tile mustEqual "darklight_vision"
Shortcut.EnhancedTargeting.get.purpose mustEqual 2
Shortcut.EnhancedTargeting.get.tile mustEqual "targeting"
Shortcut.Medkit.get.purpose mustEqual 0
Shortcut.Medkit.get.tile mustEqual "medkit"
Shortcut.MeleeBooster.get.purpose mustEqual 2
Shortcut.MeleeBooster.get.tile mustEqual "melee_booster"
Shortcut.PersonalShield.get.purpose mustEqual 2
Shortcut.PersonalShield.get.tile mustEqual "personal_shield"
Shortcut.RangeMagnifier.get.purpose mustEqual 2
Shortcut.RangeMagnifier.get.tile mustEqual "range_magnifier"
Shortcut.Regeneration.get.purpose mustEqual 2
Shortcut.Regeneration.get.tile mustEqual "advanced_regen"
Shortcut.SecondWind.get.purpose mustEqual 2
Shortcut.SecondWind.get.tile mustEqual "second_wind"
Shortcut.SensorShield.get.purpose mustEqual 2
Shortcut.SensorShield.get.tile mustEqual "silent_run"
Shortcut.Surge.get.purpose mustEqual 2
Shortcut.Surge.get.tile mustEqual "surge"
}
}

View file

@ -343,17 +343,23 @@ class PlayerControlDamageTest extends ActorTest {
assert(player2.Health == player2.Definition.DefaultHealth)
assert(player2.Armor == player2.MaxArmor)
player2.Actor ! Vitality.Damage(applyDamageTo)
val msg_avatar = avatarProbe.receiveN(3, 500 milliseconds)
val msg_avatar = avatarProbe.receiveN(4, 500 milliseconds)
val msg_activity = activityProbe.receiveOne(200 milliseconds)
assert(
msg_avatar.head match {
case AvatarServiceMessage("test", AvatarAction.PlanetsideAttributeToAll(PlanetSideGUID(2), 0, _)) => true
case AvatarServiceMessage("test", AvatarAction.PlanetsideAttributeToAll(PlanetSideGUID(2), 4, _)) => true
case _ => false
}
)
assert(
msg_avatar(1) match {
case AvatarServiceMessage("test", AvatarAction.PlanetsideAttributeToAll(PlanetSideGUID(2), 4, _)) => true
case AvatarServiceMessage("test", AvatarAction.PlanetsideAttributeToAll(PlanetSideGUID(2), 0, _)) => true
case _ => false
}
)
assert(
msg_avatar(2) match {
case AvatarServiceMessage("TestCharacter2", AvatarAction.PlanetsideAttributeToAll(PlanetSideGUID(2), 2, _)) => true
case _ => false
}
)
@ -367,7 +373,7 @@ class PlayerControlDamageTest extends ActorTest {
}
)
assert(
msg_avatar(2) match {
msg_avatar(3) match {
case AvatarServiceMessage("TestCharacter2", AvatarAction.SendResponse(Service.defaultPlayerGUID, DamageWithPositionMessage(10, Vector3(2, 0, 0)))) => true
case _ => false
}
@ -440,19 +446,19 @@ class PlayerControlDeathStandingTest extends ActorTest {
)
assert(
msg_avatar(1) match {
case AvatarServiceMessage("TestCharacter2", AvatarAction.Killed(PlanetSideGUID(2), None)) => true
case AvatarServiceMessage("TestCharacter2", AvatarAction.PlanetsideAttributeToAll(PlanetSideGUID(2), 2, _)) => true
case _ => false
}
)
assert(
msg_avatar(2) match {
case AvatarServiceMessage("test", AvatarAction.PlanetsideAttributeToAll(PlanetSideGUID(2), 0, _)) => true
case AvatarServiceMessage("TestCharacter2", AvatarAction.Killed(PlanetSideGUID(2), None)) => true
case _ => false
}
)
assert(
msg_avatar(3) match {
case AvatarServiceMessage("TestCharacter2", AvatarAction.PlanetsideAttributeToAll(PlanetSideGUID(2), 2, _)) => true
case AvatarServiceMessage("test", AvatarAction.PlanetsideAttributeToAll(PlanetSideGUID(2), 0, _)) => true
case _ => false
}
)
@ -546,12 +552,18 @@ class PlayerControlDeathSeatedTest extends ActorTest {
activityProbe.expectNoMessage(200 milliseconds)
assert(
msg_avatar.head match {
case AvatarServiceMessage("TestCharacter2", AvatarAction.Killed(PlanetSideGUID(2), Some(PlanetSideGUID(5)))) => true
case AvatarServiceMessage("TestCharacter2", AvatarAction.PlanetsideAttributeToAll(PlanetSideGUID(2), 2, _)) => true
case _ => false
}
)
assert(
msg_avatar(1) match {
case AvatarServiceMessage("TestCharacter2", AvatarAction.Killed(PlanetSideGUID(2), Some(PlanetSideGUID(5)))) => true
case _ => false
}
)
assert(
msg_avatar(2) match {
case AvatarServiceMessage("TestCharacter2", AvatarAction.SendResponse(_,
ObjectDetachMessage(PlanetSideGUID(5), PlanetSideGUID(2), _, _, _, _))
) => true
@ -559,26 +571,20 @@ class PlayerControlDeathSeatedTest extends ActorTest {
}
)
assert(
msg_avatar(2) match {
msg_avatar(3) match {
case AvatarServiceMessage("TestCharacter2", AvatarAction.PlanetsideAttributeToAll(PlanetSideGUID(2), 29, 1)) => true
case _ => false
}
)
assert(
msg_avatar(3) match {
msg_avatar(4) match {
case AvatarServiceMessage("test", AvatarAction.ObjectDelete(PlanetSideGUID(2), PlanetSideGUID(2), _)) => true
case _ => false
}
)
assert(
msg_avatar(4) match {
case AvatarServiceMessage("test", AvatarAction.PlanetsideAttributeToAll(PlanetSideGUID(2), 0, _)) => true
case _ => false
}
)
assert(
msg_avatar(5) match {
case AvatarServiceMessage("TestCharacter2", AvatarAction.PlanetsideAttributeToAll(PlanetSideGUID(2), 2, _)) => true
case AvatarServiceMessage("test", AvatarAction.PlanetsideAttributeToAll(PlanetSideGUID(2), 0, _)) => true
case _ => false
}
)