mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 22:06:05 -04:00
Once a unit has gained more than 30 XP it won't gain XP from barbarians
AI units now always unfortify/unsetup after moving
This commit is contained in:
parent
1227a47ea2
commit
2605ce6b71
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Before Width: | Height: | Size: 627 KiB After Width: | Height: | Size: 630 KiB |
@ -21,8 +21,8 @@ android {
|
|||||||
applicationId "com.unciv.game"
|
applicationId "com.unciv.game"
|
||||||
minSdkVersion 14
|
minSdkVersion 14
|
||||||
targetSdkVersion 26
|
targetSdkVersion 26
|
||||||
versionCode 132
|
versionCode 133
|
||||||
versionName "2.8.0"
|
versionName "2.8.1"
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
|
@ -87,16 +87,23 @@ class Battle(val gameInfo:GameInfo) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// XP!
|
// XP!
|
||||||
|
fun addXp(thisCombatant:ICombatant, amount:Int, otherCombatant:ICombatant){
|
||||||
|
if(thisCombatant !is MapUnitCombatant) return
|
||||||
|
if(thisCombatant.unit.promotions.totalXpProduced() >= 30 && otherCombatant.getCivilization().isBarbarianCivilization())
|
||||||
|
return
|
||||||
|
thisCombatant.unit.promotions.XP += amount
|
||||||
|
}
|
||||||
|
|
||||||
if(attacker.isMelee()){
|
if(attacker.isMelee()){
|
||||||
if(defender.getUnitType()!=UnitType.Civilian) // unit was not captured but actually attacked
|
if(defender.getUnitType()!=UnitType.Civilian) // unit was not captured but actually attacked
|
||||||
{
|
{
|
||||||
if (attacker is MapUnitCombatant) attacker.unit.promotions.XP += 5
|
addXp(attacker,5,defender)
|
||||||
if (defender is MapUnitCombatant) defender.unit.promotions.XP += 4
|
addXp(defender,4,attacker)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{ // ranged attack
|
else{ // ranged attack
|
||||||
if(attacker is MapUnitCombatant) attacker.unit.promotions.XP += 2
|
addXp(attacker,2,defender)
|
||||||
if(defender is MapUnitCombatant) defender.unit.promotions.XP += 2
|
addXp(defender,2,attacker)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(attacker is MapUnitCombatant && attacker.unit.action!=null && attacker.unit.action!!.startsWith("moveTo"))
|
if(attacker is MapUnitCombatant && attacker.unit.action!=null && attacker.unit.action!!.startsWith("moveTo"))
|
||||||
|
@ -209,6 +209,7 @@ class MapUnit {
|
|||||||
|
|
||||||
currentMovement -= distanceToTiles[otherTile]!!
|
currentMovement -= distanceToTiles[otherTile]!!
|
||||||
if (currentMovement < 0.1) currentMovement = 0f // silly floats which are "almost zero"
|
if (currentMovement < 0.1) currentMovement = 0f // silly floats which are "almost zero"
|
||||||
|
if(isFortified() || action=="Set Up") action=null // unfortify/setup after moving
|
||||||
removeFromTile()
|
removeFromTile()
|
||||||
putInTile(otherTile)
|
putInTile(otherTile)
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,10 @@ class UnitPromotions{
|
|||||||
@Transient lateinit var unit:MapUnit
|
@Transient lateinit var unit:MapUnit
|
||||||
var XP=0
|
var XP=0
|
||||||
var promotions = HashSet<String>()
|
var promotions = HashSet<String>()
|
||||||
var numberOfPromotions = 0 // The number of times this unit has been promoted - some promotions don't come from being promoted but from other things!
|
// The number of times this unit has been promoted
|
||||||
|
// some promotions don't come from being promoted but from other things,
|
||||||
|
// like from being constructed in a specific city etc.
|
||||||
|
var numberOfPromotions = 0
|
||||||
|
|
||||||
fun xpForNextPromotion() = (numberOfPromotions+1)*10
|
fun xpForNextPromotion() = (numberOfPromotions+1)*10
|
||||||
fun canBePromoted() = XP >= xpForNextPromotion()
|
fun canBePromoted() = XP >= xpForNextPromotion()
|
||||||
@ -31,4 +34,11 @@ class UnitPromotions{
|
|||||||
toReturn.numberOfPromotions=numberOfPromotions
|
toReturn.numberOfPromotions=numberOfPromotions
|
||||||
return toReturn
|
return toReturn
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun totalXpProduced(): Int {
|
||||||
|
var sum = XP
|
||||||
|
for(i in 1..numberOfPromotions) sum += 10*i
|
||||||
|
return sum
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -2,20 +2,22 @@ package com.unciv.game.desktop;
|
|||||||
|
|
||||||
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
|
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
|
||||||
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
|
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
|
||||||
|
import com.badlogic.gdx.graphics.Texture;
|
||||||
|
import com.badlogic.gdx.tools.texturepacker.TexturePacker;
|
||||||
import com.unciv.UnCivGame;
|
import com.unciv.UnCivGame;
|
||||||
|
|
||||||
class DesktopLauncher {
|
class DesktopLauncher {
|
||||||
public static void main (String[] arg) {
|
public static void main (String[] arg) {
|
||||||
|
|
||||||
// TexturePacker.Settings settings = new TexturePacker.Settings();
|
TexturePacker.Settings settings = new TexturePacker.Settings();
|
||||||
// settings.maxWidth = 2048;
|
settings.maxWidth = 2048;
|
||||||
// settings.maxHeight = 2048;
|
settings.maxHeight = 2048;
|
||||||
// settings.combineSubdirectories=true;
|
settings.combineSubdirectories=true;
|
||||||
//
|
|
||||||
// // This is so they don't look all pixelated
|
// This is so they don't look all pixelated
|
||||||
// settings.filterMag = Texture.TextureFilter.MipMapLinearLinear;
|
settings.filterMag = Texture.TextureFilter.MipMapLinearLinear;
|
||||||
// settings.filterMin = Texture.TextureFilter.MipMapLinearLinear;
|
settings.filterMin = Texture.TextureFilter.MipMapLinearLinear;
|
||||||
// TexturePacker.process(settings, "../images", ".", "game");
|
TexturePacker.process(settings, "../images", ".", "game");
|
||||||
|
|
||||||
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
|
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
|
||||||
new LwjglApplication(new UnCivGame(), config);
|
new LwjglApplication(new UnCivGame(), config);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user