Resolved #931 - added Barbarian Brute as a replacement to the Warrior

This commit is contained in:
Yair Morgenstern 2019-07-21 22:49:04 +03:00
parent d1936cacd3
commit e73ad76227
6 changed files with 509 additions and 501 deletions

View File

@ -20,6 +20,7 @@ Unless otherwise specified, all the following are from [the Noun Project](https:
* [Flag](https://thenounproject.com/search/?q=Flag&i=50114) By Melvin Poppelaars for Settler
* [Eagle](https://thenounproject.com/search/?q=Eagle&i=1619932) By anggun for Scout
* [Axe](https://thenounproject.com/search/?q=Axe&i=1688143) By ehab.abdullah for Warrior
* [Spiked Club](https://thenounproject.com/search/?q=spiked%20club&i=831793) by Hamish
* [Bow And Arrow](https://thenounproject.com/search/?q=Bow%20and%20Arrow&i=338261) By Viktor Ostrovsky for Archer
* [Bow](https://thenounproject.com/search/?q=bow&i=101736) By Arthur Shlain for Bowman
* [Fishing Vessel](https://thenounproject.com/term/fishing-vessel/23815/) By Luis Prado for Work Boats

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 MiB

After

Width:  |  Height:  |  Size: 1022 KiB

View File

@ -70,10 +70,11 @@
attackSound:"nonmetalhit"
//Polynesian unique unit. All nearby enemy Units have -10% strenght
},
*/
{
name:"Brute",
unitType:"Melee",
uniqueTo:"Barbarian",
uniqueTo:"Barbarians",
replaces:"Warrior",
movement:2,
strength:8,
@ -83,7 +84,6 @@
attackSound:"nonmetalhit"
//Barbarian unique unit
},
*/
{
name:"Archer",
unitType:"Ranged",

View File

@ -147,17 +147,17 @@ class GameInfo {
for (civ in civilizations.filter { !it.isBarbarianCivilization() && !it.isDefeated() }) {
allResearchedTechs.retainAll(civ.tech.techsResearched)
}
val barbarianCiv = getBarbarianCivilization()
barbarianCiv.tech.techsResearched = allResearchedTechs.toHashSet()
val unitList = GameBasics.Units.values
.filter { !it.unitType.isCivilian() && it.uniqueTo == null }
.filter{ (it.requiredTech==null || allResearchedTechs.contains(it.requiredTech!!))
&& (it.obsoleteTech == null || !allResearchedTechs.contains(it.obsoleteTech!!)) }
.filter { !it.unitType.isCivilian()}
.filter { it.isBuildable(barbarianCiv) }
val landUnits = unitList.filter { it.unitType.isLandUnit() }
val waterUnits = unitList.filter { it.unitType.isWaterUnit() }
val unit:String
if (unitList.isEmpty()) unit="Warrior"
else if(waterUnits.isNotEmpty() && tileToPlace.neighbors.any{ it.baseTerrain==Constants.coast } && Random().nextBoolean())
if(waterUnits.isNotEmpty() && tileToPlace.neighbors.any{ it.baseTerrain==Constants.coast } && Random().nextBoolean())
unit=waterUnits.random().name
else unit = landUnits.random().name