Skip to content

Commit

Permalink
closes #232
Browse files Browse the repository at this point in the history
  • Loading branch information
Nashet committed Jul 20, 2017
1 parent ccd8d92 commit 2457328
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 58 deletions.
Binary file modified Assets/ES-base.unity
Binary file not shown.
5 changes: 3 additions & 2 deletions Assets/code/Logic/Game.cs
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,8 @@ static void makeHelloMessage()
+ " \n\tbasic reforms (population can vote for reforms)"
+ "\n\tpopulation demotion \\ promotion to other classes \n\tmigration \\ immigration \\ assimilation"
+ "\n\tpolitical \\ culture \\ core map mode"
+ "\n\nYou play as " + Game.Player.getDescription() + " country yet there is no much gameplay for now. You can try to growth economy or conquer the world."
+ "\n\nYou play as " + Game.Player.getDescription() + " yet there is no much gameplay for now. You can try to growth economy or conquer the world."
+ "\nOr, You can give control to AI and watch it"
+ "\n\nTry arrows or WASD for scrolling map and mouse wheel for scale"
+ "\n'Enter' key to close top window, space - to pause \\ unpause"
, "Ok");
Expand Down Expand Up @@ -705,7 +706,7 @@ internal static void simulate()

pop.calcLoyalty();

if (Game.Random.Next(10) == 1)
//if (Game.Random.Next(10) == 1)
{
pop.calcGrowth();
pop.calcPromotions();
Expand Down
6 changes: 4 additions & 2 deletions Assets/code/Logic/Options.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ public static class Options
public static readonly Procent PopDemotionSpeed = new Procent(0.01f);
///<summary> promotion - when popUnit has chance to get better place in hierarchy</summary>
public static readonly Procent PopPromotionSpeed = new Procent(0.01f);
public static readonly Procent PopAssimilationSpeed = new Procent(0.001f);
public static readonly Procent PopAssimilationSpeed = new Procent(0.002f);
public static readonly Procent PopAssimilationSpeedWithEquality = new Procent(0.001f);

public static readonly Procent PopMigrationSpeed = new Procent(0.01f);
public static readonly Procent PopImmigrationSpeed = new Procent(0.01f);

Expand All @@ -67,7 +69,7 @@ public static class Options

public static readonly int PopSizeConsolidationLimit = 100;
/// <summary> Time before which pop wouldn't be wipe out by Pop change methods like promote\ assimilate\migrate</summary>
public static readonly int PopAgeLimitToWipeOut = 250;
public static readonly int PopAgeLimitToWipeOut = 50; //250;

internal static readonly float MaxMoralChangePerTic = 0.05f;
internal static readonly int PopRichStrataVotePower = 5;
Expand Down
12 changes: 8 additions & 4 deletions Assets/code/Logic/PopUnit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1168,13 +1168,17 @@ private void assimilate(Culture toWhom, int assimilationSize)

public int getAssimilationSize()
{
if (province.isCoreFor(this) || getCountry().minorityPolicy.getValue() == MinorityPolicy.Equality)
if (province.isCoreFor(this))
return 0;
else
{
int result = (int)(this.getPopulation() * Options.PopAssimilationSpeed.get());
if (result > 0)
return result;
int assimilationSpeed;
if (getCountry().minorityPolicy.getValue() == MinorityPolicy.Equality)
assimilationSpeed = (int)(this.getPopulation() * Options.PopAssimilationSpeedWithEquality.get() );
else
assimilationSpeed = (int)(this.getPopulation() * Options.PopAssimilationSpeed.get());
if (assimilationSpeed > 0)
return assimilationSpeed;
else
{
if (getAge() > Options.PopAgeLimitToWipeOut)
Expand Down
4 changes: 2 additions & 2 deletions Assets/code/Logic/Reform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1113,10 +1113,10 @@ protected override Procent howIsItGoodForPop(PopUnit pop)
public MinorityPolicy(Country country) : base("Minority Policy", "- Minority Policy", country)
{
if (Equality == null)
Equality = new ReformValue("Equality for minorities", "- All cultures have same rights, assimilation is off", 2,
Equality = new ReformValue("Equality for minorities", "- All cultures have same rights, assimilation is slower", 2,
new ConditionsList(new List<Condition>() { Invention.IndividualRightsInvented }));
if (Residency == null)
Residency = new ReformValue("Restricted rights for minorities", "- Only state culture can vote, assimilation is on except alien cores", 1, new ConditionsList());
Residency = new ReformValue("Restricted rights for minorities", "- Only state culture can vote, assimilation is on except foreign core provinces", 1, new ConditionsList());

status = Residency;
//IsResidencyPop = new Condition(x => (x as PopUnit).province.getOwner().minorityPolicy.status == MinorityPolicy.Residency,
Expand Down
78 changes: 34 additions & 44 deletions Assets/code/Panels/PopUnitPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,43 +29,6 @@ public void refresh()
if (pop != null)
{
var sb = new StringBuilder();
efficiencyText.text = "Efficiency: " + PopUnit.modEfficiency.getModifier(pop, out efficiencyText.GetComponentInChildren<ToolTipHandler>().tooltip);

issues.GetComponentInChildren<ToolTipHandler>().setDynamicString(() => pop.getIssues().getString(" willing ", "\n"));

string demotionText;
var target = pop.getRichestDemotionTarget();
if (pop.wantsToDemote() && target != null && pop.getDemotionSize() > 0)
demotionText = target + " " + pop.getDemotionSize();
else
demotionText = "none";

string promotionText;
var targetPro = pop.getRichestPromotionTarget();
if (pop.wantsToPromote() && targetPro != null && pop.getPromotionSize() > 0)
promotionText = targetPro + " " + pop.getPromotionSize();
else
promotionText = "none";

string migrationText;
var targetM = pop.getRichestMigrationTarget();
if (pop.wantsToMigrate() && targetM != null && pop.getMigrationSize() > 0)
migrationText = targetM + " " + pop.getMigrationSize();
else
migrationText = "none";

string immigrationText;
var targetIM = pop.getRichestImmigrationTarget();
if (pop.wantsToImmigrate() && targetIM != null && pop.getImmigrationSize() > 0)
immigrationText = targetIM + " (" + targetIM.getCountry() + ") " + pop.getImmigrationSize();
else
immigrationText = "none";

string assimilationText;
if (pop.culture != pop.province.getCountry().getCulture() && pop.getAssimilationSize() > 0)
assimilationText = pop.province.getCountry().getCulture() + " " + pop.getAssimilationSize();
else
assimilationText = "none";

sb.Append(pop);
sb.Append("\nPopulation: ").Append(pop.getPopulation());
Expand All @@ -75,11 +38,18 @@ public void refresh()
sb.Append("\nGain goods: ").Append(pop.gainGoodsThisTurn.ToString());
sb.Append("\nSent to market: ").Append(pop.sentToMarket); // hide it

sb.Append("\nDemotion: ").Append(demotionText);
sb.Append("\nPromotion: ").Append(promotionText);
sb.Append("\nMigration: ").Append(migrationText);
sb.Append("\nImmigration: ").Append(immigrationText);
sb.Append("\nAssimilation: ").Append(assimilationText);
makeLine(sb, pop.getRichestDemotionTarget(), pop.getDemotionSize(), "Demotion: ", pop.wantsToDemote());
makeLine(sb, pop.getRichestPromotionTarget(), pop.getPromotionSize(), "Promotion: ", pop.wantsToPromote());

makeLine(sb, pop.getRichestMigrationTarget(), pop.getMigrationSize(), "Migration: ", pop.wantsToMigrate());
makeLine(sb, pop.getRichestImmigrationTarget(), pop.getImmigrationSize(), "Immigration: ", pop.wantsToImmigrate());

sb.Append("\nAssimilation: ");
if (pop.culture != pop.province.getCountry().getCulture() && pop.getAssimilationSize() > 0)
sb.Append(pop.province.getCountry().getCulture()).Append(" ").Append(pop.getAssimilationSize());
else
sb.Append("none");

sb.Append("\nGrowth: ").Append(pop.getGrowthSize());
sb.Append("\nUnemployment: ").Append(pop.getUnemployedProcent());
sb.Append("\nLoyalty: ").Append(pop.loyalty);
Expand All @@ -89,8 +59,6 @@ public void refresh()
if (pop.deposits.get() > 0f)
sb.Append("\nDeposit: ").Append(pop.deposits.ToString());// hide it



sb.Append("\nAge: ").Append(pop.getAge());
sb.Append("\nMobilized: ").Append(pop.getMobilized());
if (pop.getMovement() != null)
Expand Down Expand Up @@ -124,8 +92,30 @@ public void refresh()
money.GetComponentInChildren<ToolTipHandler>().setDynamicString(() => "Money income: " + pop.moneyIncomethisTurn
+ "\nIncome tax: " + pop.incomeTaxPayed
+ "\nConsumed cost: " + Game.market.getCost(pop.consumedTotal));

efficiencyText.text = "Efficiency: " + PopUnit.modEfficiency.getModifier(pop, out efficiencyText.GetComponentInChildren<ToolTipHandler>().tooltip);
issues.GetComponentInChildren<ToolTipHandler>().setDynamicString(() => pop.getIssues().getString(" willing ", "\n"));
}
}
private void makeLine(StringBuilder sb, PopType target, int size, string header, bool boolCheck)
{
//sb.Clear();
sb.Append("\n").Append(header);

if (boolCheck && target != null && size > 0)
sb.Append(target).Append(" ").Append(size);
else
sb.Append("none");
}
private void makeLine(StringBuilder sb, Province target, int size, string header, bool boolCheck)
{
//sb.Clear();
sb.Append("\n").Append(header);
if (boolCheck && target != null && size > 0)
sb.Append(target).Append(" ").Append(size);
else
sb.Append("none");
}
public void show(PopUnit ipopUnit)
{
gameObject.SetActive(true);
Expand Down
7 changes: 3 additions & 4 deletions Assets/code/Panels/TopPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ void Start()
btnStep.onClick.AddListener(() => onbtnStepClick(btnPlay));
btnPlay.image.color = Color.grey;
MainCamera.topPanel = this;
hide();

hide();
}
public void hide()
{
Expand All @@ -28,9 +27,9 @@ public void show()
}
public void refresh()
{
generalText.text = "Economic Simulation v0.12.2 Date: " + Game.date.ToShortDateString() + " Country: " + Game.Player.getName()
generalText.text = "Economic Simulation v0.13.0 Date: " + Game.date.ToShortDateString() + " Country: " + Game.Player.getName()
+ "\nMoney: " + Game.Player.cash
+ " Science points: " + Game.Player.sciencePoints
+ " Science points: " + Game.Player.sciencePoints.get().ToString("N0")
+ " Men: " + Game.Player.getMenPopulation()
+ " avg. loyalty: " + Game.Player.getAverageLoyalty();
}
Expand Down

0 comments on commit 2457328

Please sign in to comment.