mirror of
https://github.com/nolen777/eagle0.git
synced 2026-07-29 01:35:42 +00:00
Use inside in fulfill quests fixtures (#7395)
This commit is contained in:
+86
-80
@@ -25,6 +25,7 @@ import net.eagle0.eagle.model.state.unaffiliated_hero.concrete.UnaffiliatedHeroC
|
||||
import org.scalatest.flatspec.AnyFlatSpec
|
||||
import org.scalatest.matchers.should.Matchers
|
||||
import org.scalatest.BeforeAndAfterEach
|
||||
import org.scalatest.Inside.inside
|
||||
|
||||
class FulfillQuestsCommandSelectorTest extends AnyFlatSpec with Matchers with BeforeAndAfterEach {
|
||||
|
||||
@@ -280,21 +281,22 @@ class FulfillQuestsCommandSelectorTest extends AnyFlatSpec with Matchers with Be
|
||||
val availableCommands =
|
||||
Vector[AvailableCommand](restCommand, truceCommand, travelCommand)
|
||||
|
||||
val actingFaction = inside(gameState.factions(actingFactionId)) {
|
||||
case faction: FactionC =>
|
||||
faction
|
||||
}
|
||||
val lowTrustGameState = gameState.copy(
|
||||
factions = gameState.factions.updated(
|
||||
actingFactionId,
|
||||
gameState
|
||||
.factions(actingFactionId)
|
||||
.asInstanceOf[FactionC]
|
||||
.copy(
|
||||
factionRelationships = Vector(
|
||||
FactionRelationship(
|
||||
targetFactionId = 103,
|
||||
relationshipLevel = Hostile,
|
||||
trustValue = -5
|
||||
)
|
||||
actingFaction.copy(
|
||||
factionRelationships = Vector(
|
||||
FactionRelationship(
|
||||
targetFactionId = 103,
|
||||
relationshipLevel = Hostile,
|
||||
trustValue = -5
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -373,6 +375,10 @@ class FulfillQuestsCommandSelectorTest extends AnyFlatSpec with Matchers with Be
|
||||
)
|
||||
)
|
||||
)
|
||||
val actingFaction = inside(gameState.factions(actingFactionId)) {
|
||||
case faction: FactionC =>
|
||||
faction
|
||||
}
|
||||
val gameStateWithTruceCountQuest = gameState.copy(
|
||||
provinces = gameState.provinces.updated(
|
||||
16,
|
||||
@@ -380,28 +386,25 @@ class FulfillQuestsCommandSelectorTest extends AnyFlatSpec with Matchers with Be
|
||||
),
|
||||
factions = gameState.factions.updated(
|
||||
actingFactionId,
|
||||
gameState
|
||||
.factions(actingFactionId)
|
||||
.asInstanceOf[FactionC]
|
||||
.copy(
|
||||
factionRelationships = Vector(
|
||||
FactionRelationship(
|
||||
targetFactionId = 103,
|
||||
relationshipLevel = Hostile,
|
||||
trustValue = 19
|
||||
),
|
||||
FactionRelationship(
|
||||
targetFactionId = 105,
|
||||
relationshipLevel = Hostile,
|
||||
trustValue = 85
|
||||
),
|
||||
FactionRelationship(
|
||||
targetFactionId = 107,
|
||||
relationshipLevel = Hostile,
|
||||
trustValue = -4
|
||||
)
|
||||
actingFaction.copy(
|
||||
factionRelationships = Vector(
|
||||
FactionRelationship(
|
||||
targetFactionId = 103,
|
||||
relationshipLevel = Hostile,
|
||||
trustValue = 19
|
||||
),
|
||||
FactionRelationship(
|
||||
targetFactionId = 105,
|
||||
relationshipLevel = Hostile,
|
||||
trustValue = 85
|
||||
),
|
||||
FactionRelationship(
|
||||
targetFactionId = 107,
|
||||
relationshipLevel = Hostile,
|
||||
trustValue = -4
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -451,6 +454,10 @@ class FulfillQuestsCommandSelectorTest extends AnyFlatSpec with Matchers with Be
|
||||
)
|
||||
)
|
||||
)
|
||||
val actingFaction = inside(gameState.factions(actingFactionId)) {
|
||||
case faction: FactionC =>
|
||||
faction
|
||||
}
|
||||
val gameStateWithTruceCountQuest = gameState.copy(
|
||||
provinces = gameState.provinces.updated(
|
||||
16,
|
||||
@@ -458,28 +465,25 @@ class FulfillQuestsCommandSelectorTest extends AnyFlatSpec with Matchers with Be
|
||||
),
|
||||
factions = gameState.factions.updated(
|
||||
actingFactionId,
|
||||
gameState
|
||||
.factions(actingFactionId)
|
||||
.asInstanceOf[FactionC]
|
||||
.copy(
|
||||
factionRelationships = Vector(
|
||||
FactionRelationship(
|
||||
targetFactionId = 103,
|
||||
relationshipLevel = Hostile,
|
||||
trustValue = -19
|
||||
),
|
||||
FactionRelationship(
|
||||
targetFactionId = 105,
|
||||
relationshipLevel = Hostile,
|
||||
trustValue = -5
|
||||
),
|
||||
FactionRelationship(
|
||||
targetFactionId = 107,
|
||||
relationshipLevel = Hostile,
|
||||
trustValue = -6
|
||||
)
|
||||
actingFaction.copy(
|
||||
factionRelationships = Vector(
|
||||
FactionRelationship(
|
||||
targetFactionId = 103,
|
||||
relationshipLevel = Hostile,
|
||||
trustValue = -19
|
||||
),
|
||||
FactionRelationship(
|
||||
targetFactionId = 105,
|
||||
relationshipLevel = Hostile,
|
||||
trustValue = -5
|
||||
),
|
||||
FactionRelationship(
|
||||
targetFactionId = 107,
|
||||
relationshipLevel = Hostile,
|
||||
trustValue = -6
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -517,6 +521,14 @@ class FulfillQuestsCommandSelectorTest extends AnyFlatSpec with Matchers with Be
|
||||
)
|
||||
)
|
||||
)
|
||||
val actingFaction = inside(gameState.factions(actingFactionId)) {
|
||||
case faction: FactionC =>
|
||||
faction
|
||||
}
|
||||
val truceFaction = inside(gameState.factions(105)) {
|
||||
case faction: FactionC =>
|
||||
faction
|
||||
}
|
||||
val gameStateWithTruceCountQuest = gameState.copy(
|
||||
provinces = gameState.provinces.updated(
|
||||
16,
|
||||
@@ -525,43 +537,37 @@ class FulfillQuestsCommandSelectorTest extends AnyFlatSpec with Matchers with Be
|
||||
factions = gameState.factions
|
||||
.updated(
|
||||
actingFactionId,
|
||||
gameState
|
||||
.factions(actingFactionId)
|
||||
.asInstanceOf[FactionC]
|
||||
.copy(
|
||||
factionRelationships = Vector(
|
||||
FactionRelationship(
|
||||
targetFactionId = 103,
|
||||
relationshipLevel = Hostile,
|
||||
trustValue = 60
|
||||
),
|
||||
FactionRelationship(
|
||||
targetFactionId = 105,
|
||||
relationshipLevel = Truce,
|
||||
trustValue = 85
|
||||
),
|
||||
FactionRelationship(
|
||||
targetFactionId = 107,
|
||||
relationshipLevel = Hostile,
|
||||
trustValue = 70
|
||||
)
|
||||
actingFaction.copy(
|
||||
factionRelationships = Vector(
|
||||
FactionRelationship(
|
||||
targetFactionId = 103,
|
||||
relationshipLevel = Hostile,
|
||||
trustValue = 60
|
||||
),
|
||||
FactionRelationship(
|
||||
targetFactionId = 105,
|
||||
relationshipLevel = Truce,
|
||||
trustValue = 85
|
||||
),
|
||||
FactionRelationship(
|
||||
targetFactionId = 107,
|
||||
relationshipLevel = Hostile,
|
||||
trustValue = 70
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
.updated(
|
||||
105,
|
||||
gameState
|
||||
.factions(105)
|
||||
.asInstanceOf[FactionC]
|
||||
.copy(
|
||||
factionRelationships = Vector(
|
||||
FactionRelationship(
|
||||
targetFactionId = actingFactionId,
|
||||
relationshipLevel = Truce,
|
||||
trustValue = 85
|
||||
)
|
||||
truceFaction.copy(
|
||||
factionRelationships = Vector(
|
||||
FactionRelationship(
|
||||
targetFactionId = actingFactionId,
|
||||
relationshipLevel = Truce,
|
||||
trustValue = 85
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user