private double ComputeWarRatio() { double peaceCounter = 0f; double warCounter = 0f; foreach (EmpireData empire in GlobalData.world.empires) { EmpireStanding standings = Diplomacy.FindStandings(m_empireData, empire); if (standings == null) { continue; } if ((Diplomacy.EmpireType)empire.empireType == Diplomacy.EmpireType.TRUE_HOSTILE) { continue; } if (standings.atWar) { warCounter += 1.0f; } else { peaceCounter += 1.0f; } } return(warCounter / (warCounter + peaceCounter)); }
public void TakeStandingsHit(EmpireData aggressorEmpire) { if (m_nextStandingsChange > GlobalData.world.currentTick) { return; } m_nextStandingsChange = GlobalData.world.currentTick + Tick.Seconds(STANDINGS_DEBOUCE_SEC); EmpireData.EmpireStanding standings = Diplomacy.FindStandings(m_data, aggressorEmpire); if (standings == null) { return; } standings.reputation--; if (standings.atWar) { return; } Diplomacy.CallPolice(m_data, aggressorEmpire); if (standings.reputation < 0) { Diplomacy.DeclareWar(m_data, aggressorEmpire); } }