Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Personality Behaviors Template #11165

Merged
merged 11 commits into from
May 21, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ class ConstructionAutomation(val cityConstructions: CityConstructions) {
modifier = 5f // there's a settler just sitting here, doing nothing - BAD

if (!civInfo.isAIOrAutoPlaying()) modifier /= 2 // Players prefer to make their own unit choices usually
modifier *= personality.scaledFocus(PersonalityValue.Military)
modifier *= personality.scaledFocus(PersonalityValue.Aggressive)
addChoice(relativeCostEffectiveness, militaryUnit, modifier)
}

Expand Down Expand Up @@ -310,7 +310,7 @@ class ConstructionAutomation(val cityConstructions: CityConstructions) {
if (isAtWar) modifier *= 2
if (civInfo.wantsToFocusOn(Victory.Focus.Military))
modifier *= 1.3f
modifier *= personality.scaledFocus(PersonalityValue.Military)
modifier *= personality.scaledFocus(PersonalityValue.Aggressive)
addChoice(relativeCostEffectiveness, unitTrainingBuilding.name, modifier)
}
}
Expand Down
24 changes: 20 additions & 4 deletions core/src/com/unciv/models/ruleset/nation/Personality.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,21 @@ import kotlin.reflect.KMutableProperty0
* Type of Personality focus. Typically ranges from 0 (no focus) to 10 (double focus)
*/
enum class PersonalityValue {
// Stat focused personalities
Production,
Food,
Gold,
Science,
Culture,
Happiness,
Faith,
Military,
WarMongering,;
// Behaviour focused personalities
Military, // Building a military but not nessesarily using it
Aggressive, // Declaring war determines expanding or defending
Commerce, // Trading frequency, open borders and liberating city-states, less negative diplomacy impact
Diplomacy, // Likelyhood of signing friendship, defensive pact, peace treaty and other diplomatic actions
Loyal, // Likelyhood to make a long lasting aliance with another civ and join wars with them
Expansion; // Founding/capturing new cities, oposite of a cultural victory

companion object {
operator fun get(stat: Stat): PersonalityValue {
Expand All @@ -43,8 +49,14 @@ class Personality: RulesetObject() {
var culture: Float = 5f
var happiness: Float = 5f
var faith: Float = 5f

var military: Float = 5f
var warMongering: Float = 5f // Todo: Look into where this should be inserted
var aggressive: Float = 5f
var commerce: Float = 5f
var diplomacy: Float = 5f
var loyal: Float = 5f
var expansion: Float = 5f

var priorities = LinkedHashMap<String, Int>()
var preferredVictoryType: String = Constants.neutralVictoryType
var isNeutralPersonality: Boolean = false
Expand All @@ -59,7 +71,11 @@ class Personality: RulesetObject() {
PersonalityValue.Happiness -> ::happiness
PersonalityValue.Faith -> ::faith
PersonalityValue.Military -> ::military
PersonalityValue.WarMongering -> ::warMongering
PersonalityValue.Aggressive -> ::aggressive
PersonalityValue.Commerce -> ::commerce
PersonalityValue.Diplomacy -> ::diplomacy
PersonalityValue.Loyal -> ::loyal
PersonalityValue.Expansion -> ::expansion
}
}

Expand Down
Loading
Loading