2022-05-05 08:09:15 +02:00
|
|
|
package com.unciv.uniques
|
|
|
|
|
|
|
|
import com.badlogic.gdx.math.Vector2
|
|
|
|
import com.unciv.testing.GdxTestRunner
|
2023-01-23 00:42:45 +02:00
|
|
|
import com.unciv.ui.worldscreen.unit.actions.UnitActions
|
2022-05-05 08:09:15 +02:00
|
|
|
import org.junit.Assert.assertNotNull
|
|
|
|
import org.junit.Before
|
|
|
|
import org.junit.Test
|
|
|
|
import org.junit.runner.RunWith
|
|
|
|
|
|
|
|
@RunWith(GdxTestRunner::class)
|
|
|
|
class UnitUniquesTests {
|
|
|
|
private lateinit var game: TestGame
|
|
|
|
|
|
|
|
@Before
|
|
|
|
fun initTheWorld() {
|
|
|
|
game = TestGame()
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
fun `Sweden can gift Great Persons to City States`() {
|
|
|
|
// when
|
2022-05-17 15:42:27 +02:00
|
|
|
game.makeHexagonalMap(1)
|
2022-11-21 20:30:52 +02:00
|
|
|
val cityState = game.addCiv(cityStateType = "Cultured")
|
2022-05-17 15:42:27 +02:00
|
|
|
val cityStateCapitalTile = game.getTile(Vector2(0f, 0f))
|
2022-05-05 08:09:15 +02:00
|
|
|
val cityStateCapital = game.addCity(cityState, cityStateCapitalTile)
|
|
|
|
|
2022-05-22 18:51:05 +02:00
|
|
|
val mainCiv = game.addCiv("Gain [90] Influence with a [Great Person] gift to a City-State",
|
2022-05-05 08:09:15 +02:00
|
|
|
isPlayer = true
|
|
|
|
)
|
|
|
|
|
2022-05-17 15:42:27 +02:00
|
|
|
val unitTile = game.getTile(Vector2(1f, 0f))
|
2022-05-05 08:09:15 +02:00
|
|
|
cityStateCapital.expansion.takeOwnership(unitTile)
|
|
|
|
|
|
|
|
val greatPerson = game.addUnit("Great Scientist", mainCiv, unitTile)
|
|
|
|
|
|
|
|
// then
|
|
|
|
val giftAction = UnitActions.getGiftAction(greatPerson, unitTile)
|
|
|
|
|
|
|
|
assertNotNull("Great Person should have a gift action", giftAction)
|
|
|
|
}
|
2022-05-22 18:51:05 +02:00
|
|
|
}
|