* Fixed "Can move immediately once bought" unique

* Spectators no longer can adopt policies
Close button is no longer disabled when player has free policy but has no adoptable policies
FreePolicies are being spent properly in scenario editor mode

* redundant
This commit is contained in:
HadeanLake
2020-08-19 15:25:17 +03:00
committed by GitHub
parent a12c1ada26
commit cd72926a60
3 changed files with 5 additions and 4 deletions

View File

@ -109,9 +109,9 @@ class PolicyManager {
fun adopt(policy: Policy, branchCompletion: Boolean = false) {
if (!branchCompletion && !civInfo.gameInfo.gameParameters.godMode) {
if (!branchCompletion) {
if (freePolicies > 0) freePolicies--
else {
else if (!civInfo.gameInfo.gameParameters.godMode) {
val cultureNeededForNextPolicy = getCultureNeededForNextPolicy()
if (cultureNeededForNextPolicy > storedCulture)
throw Exception("How is this possible??????")

View File

@ -154,7 +154,7 @@ class BaseUnit : INamed, IConstruction {
if (unit == null) return false // couldn't place the unit, so there's actually no unit =(
//movement penalty
if (wasBought && !unit.hasUnique("Can move directly once bought") && !civInfo.gameInfo.gameParameters.godMode)
if (wasBought && !unit.hasUnique("Can move immediately once bought") && !civInfo.gameInfo.gameParameters.godMode)
unit.currentMovement = 0f
if (this.unitType.isCivilian()) return true // tiny optimization makes save files a few bytes smaller

View File

@ -28,7 +28,7 @@ class PolicyPickerScreen(val worldScreen: WorldScreen, civInfo: CivilizationInfo
setDefaultCloseAction()
if (policies.freePolicies > 0) {
rightSideButton.setText("Adopt free policy".tr())
closeButton.disable()
if (policies.canAdoptPolicy()) closeButton.disable()
}
else onBackButtonClicked { UncivGame.Current.setWorldScreen() }
@ -82,6 +82,7 @@ class PolicyPickerScreen(val worldScreen: WorldScreen, civInfo: CivilizationInfo
private fun pickPolicy(policy: Policy) {
if (!worldScreen.isPlayersTurn
|| worldScreen.viewingCiv.isSpectator() // viewingCiv var points to selectedCiv in case of spectator
|| viewingCiv.isDefeated()
|| viewingCiv.policies.isAdopted(policy.name)
|| policy.name.endsWith("Complete")