Add great general unit.

This commit is contained in:
Duan Tao 2018-12-26 18:06:36 +08:00
parent c967d058d2
commit c3e8563bf2
4 changed files with 18 additions and 2 deletions

View file

@ -70,7 +70,7 @@ All the following are from [the Noun Project](https://thenounproject.com) licenc
* [Pallet](https://thenounproject.com/search/?q=Pallet&i=6862) By James Keuning for Great Artist
* [Gear](https://thenounproject.com/search/?q=Gear&i=17369) By Melvin Salas for Great Engineer
* [Beaker](https://thenounproject.com/search/?q=Beaker&i=621510) By Delwar Hossain for Great Scientist
* [General](https://thenounproject.com/search/?q=general&i=933566) By anbileru adaleru for Great General
## Resources
@ -413,4 +413,4 @@ Sounds are from FreeSound.org and are either Creative Commons or Public Domain
* [klick_anlauf](https://freesound.org/people/jascha/sounds/16576/) By jascha as 'metalhit' for metal melee sounds
* [Horse Neigh 2](https://freesound.org/people/GoodListener/sounds/322450/) By GoodListener as 'horse' for cavalry attack sounds
* [machine gun 001 - loop](https://freesound.org/people/pgi/sounds/212602/) By pgi as 'machinegun' for machine gun attack sound
* [uzzi_full_single](https://freesound.org/people/Deganoth/sounds/348685/) By Deganoth as 'shot' for bullet attacks
* [uzzi_full_single](https://freesound.org/people/Deganoth/sounds/348685/) By Deganoth as 'shot' for bullet attacks

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

View file

@ -575,5 +575,12 @@
uniques:["Can speed up construction of a wonder","Can build improvement: Manufactory"]
movement:2
},
{
name:"Great General",
unbuildable:true,
unitType:"Civilian",
uniques:["Can start an 8-turn golden age","Bonus for landunits in 2 radius 15%"] //to do : should be able to build mega-fort
movement:2
},
]

View file

@ -5,7 +5,9 @@ import com.unciv.models.stats.Stats
class GreatPersonManager {
var pointsForNextGreatPerson = 100
var pointsForNextGreatGeneral = 30
var greatPersonPoints = Stats()
var greatGeneralPoints = 0
var freeGreatPeople=0
val statToGreatPersonMapping = HashMap<Stat,String>().apply {
@ -25,6 +27,13 @@ class GreatPersonManager {
fun getNewGreatPerson(): String? {
val greatPerson: String? = null
if (greatGeneralPoints > pointsForNextGreatGeneral) {
greatGeneralPoints -= pointsForNextGreatGeneral
pointsForNextGreatGeneral += 50
return "Great General"
}
val greatPersonPointsHashmap = greatPersonPoints.toHashMap()
for(entry in statToGreatPersonMapping){
if(greatPersonPointsHashmap[entry.key]!!>pointsForNextGreatPerson){