public void logVote(VoteIssue issue) { if (World.logging) { string line = " " + issue.ToString() + " for soc " + issue.society.getName(); log.takeLine(line); foreach (VoteOption opt in issue.options) { line = " " + opt.fixedLenInfo(); line += " U " + Eleven.toFixedLen(issue.computeUtility(this, opt, new List <ReasonMsg>()), 12); log.takeLine(line); } } }
public VoteOption getVote(VoteSession voteSession) { if (World.logging) { this.log.takeLine("Voting on " + voteSession.issue); } double highestWeight = 0; VoteOption bestChoice = null; foreach (VoteOption option in voteSession.issue.options) { List <ReasonMsg> msgs = new List <ReasonMsg>(); double u = voteSession.issue.computeUtility(this, option, msgs); if (forcedVoteSession == voteSession && option == forcedVoteOption) { ReasonMsg msg = new ReasonMsg("Obligated to vote for this option", 0); msgs.Add(msg); } if (u > highestWeight || bestChoice == null) { bestChoice = option; highestWeight = u; } if (World.logging) { log.takeLine(" " + option.fixedLenInfo() + " " + u); foreach (ReasonMsg msg in msgs) { log.takeLine(" " + Eleven.toFixedLen(msg.value, 5) + msg.msg); } } } if (this.forcedVoteSession == voteSession) { World.log("Forced voting"); return(forcedVoteOption); } return(bestChoice); }
public void showLocationInfo() { if (GraphicalMap.selectedHex == null || GraphicalMap.selectedHex.location == null) { locInfoTitle.text = "No location selected"; locInfoBody.text = "No location selected"; locNumsBody.text = ""; locNumsNumbers.text = ""; locFlavour.text = ""; infiltrationText.text = "No Infiltration Possible"; infiltrationVals.text = ""; securityDescText.text = ""; personShadowAndEvidenceVals.text = ""; } else { Map map = World.staticMap; Location loc = GraphicalMap.selectedHex.location; locInfoTitle.text = loc.getName(); string bodyText = ""; double hab = loc.hex.getHabilitability() - map.param.mapGen_minHabitabilityForHumans; hab *= 1d / (1 - map.param.mapGen_minHabitabilityForHumans); string valuesBody = ""; string valuesNumbers = ""; infiltrationText.text = "No Infiltration Possible"; securityDescText.text = ""; Hex hex = loc.hex; bodyText += "\nProvince: " + hex.province.name; foreach (EconTrait t in hex.province.econTraits) { bodyText += "\nIndustry: " + t.name; } if (hex.location != null) { if (hex.location.settlement != null) { if (hex.location.settlement.title != null) { if (hex.location.settlement.title.heldBy != null) { bodyText += "\nTitle held by: " + hex.location.settlement.title.heldBy.getFullName(); } else { bodyText += "\nTitle currently unheld"; } } valuesBody += "\nPrestige:"; valuesNumbers += "\n" + Eleven.toMaxLen(hex.location.settlement.getPrestige(), 4); valuesBody += "\nBase Prestige:"; valuesNumbers += "\n" + Eleven.toMaxLen(hex.location.settlement.basePrestige, 4); valuesBody += "\nMilitary Cap Add:"; valuesNumbers += "\n" + hex.location.settlement.getMilitaryCap(); valuesBody += "\nMilitary Regen"; valuesNumbers += "\n" + hex.location.settlement.militaryRegenAdd; } } if (loc.settlement != null) { if (loc.soc != null && loc.soc is Society) { List <ReasonMsg> reasons = new List <ReasonMsg>(); int sec = loc.settlement.getSecurity(reasons); infiltrationText.text = "Infiltration:\nSecurity Level:"; infiltrationVals.text = "" + (int)(100 * loc.settlement.infiltration) + "%\n" + (int)(sec); securityDescText.text = "Security Level: " + sec; foreach (ReasonMsg msg in reasons) { string sign = "+"; if (msg.value < 0) { sign = ""; } securityDescText.text += "\n" + sign + (int)(msg.value) + " from " + msg.msg; } } locFlavour.text = loc.settlement.getFlavour(); if (loc.settlement is SettlementHuman) { valuesBody += "\n" + ((SettlementHuman)loc.settlement).getStatsDesc(); valuesNumbers += "\n" + ((SettlementHuman)loc.settlement).getStatsValues(); } if (hex.location.settlement.embeddedUnit != null) { bodyText += "\nARMY IN GARRISON (Strength " + hex.location.settlement.embeddedUnit.hp + ")"; } } valuesBody += "\nTemperature "; valuesNumbers += "\n" + (int)(loc.hex.getTemperature() * 100) + "%"; valuesBody += "\nHabilitability "; valuesNumbers += "\n" + (int)(hab * 100) + "%"; locNumsBody.text = valuesBody; locNumsNumbers.text = valuesNumbers; locInfoBody.text = bodyText; } }
public void showLocationInfo() { if (GraphicalMap.selectedHex == null || GraphicalMap.selectedHex.location == null) { locInfoTitle.text = "No location selected"; locInfoBody.text = "No location selected"; locNumsBody.text = ""; locNumsNumbers.text = ""; locFlavour.text = ""; } else { Map map = World.staticMap; Location loc = GraphicalMap.selectedHex.location; locInfoTitle.text = loc.getName(); string bodyText = ""; double hab = loc.hex.getHabilitability() - map.param.mapGen_minHabitabilityForHumans; hab *= 1d / (1 - map.param.mapGen_minHabitabilityForHumans); string valuesBody = ""; string valuesNumbers = ""; Hex hex = loc.hex; bodyText += "\nProvince: " + hex.province.name; foreach (EconTrait t in hex.province.econTraits) { bodyText += "\nIndustry: " + t.name; } if (hex.location != null) { if (hex.location.settlement != null) { if (hex.location.settlement.title != null) { if (hex.location.settlement.title.heldBy != null) { bodyText += "\nTitle held by: " + hex.location.settlement.title.heldBy.getFullName(); } else { bodyText += "\nTitle currently unheld"; } } valuesBody += "\nPrestige:"; valuesNumbers += "\n" + Eleven.toMaxLen(hex.location.settlement.getPrestige(), 4); valuesBody += "\nBase Prestige:"; valuesNumbers += "\n" + Eleven.toMaxLen(hex.location.settlement.basePrestige, 4); valuesBody += "\nMilitary Cap Add:"; valuesNumbers += "\n" + hex.location.settlement.getMilitaryCap(); valuesBody += "\nMilitary Regen"; valuesNumbers += "\n" + hex.location.settlement.militaryRegenAdd; } } if (loc.settlement != null) { locFlavour.text = loc.settlement.getFlavour(); if (loc.settlement is Set_City) { valuesBody += "\n" + ((Set_City)loc.settlement).getStatsDesc(); valuesNumbers += "\n" + ((Set_City)loc.settlement).getStatsValues(); } } valuesBody += "\nTemperature "; valuesNumbers += "\n" + (int)(loc.hex.getTemperature() * 100) + "%"; valuesBody += "\nHabilitability "; valuesNumbers += "\n" + (int)(hab * 100) + "%"; locNumsBody.text = valuesBody; locNumsNumbers.text = valuesNumbers; locInfoBody.text = bodyText; } }