void Disorder::Impl::generateMugger(PlayerCityPtr city, HousePtr house )
{
  int taxesThisYear = city->treasury().getIssueValue( econ::Issue::taxIncome );
  int maxMoneyStolen = city->states().population / 10;

  if( taxesThisYear > minCityTax4mugger )
  {
    int moneyStolen = taxesThisYear / 4;

    if( moneyStolen > maxMoneyStolen )
      moneyStolen = math::random( maxMoneyStolen );

    GameEventPtr e = ShowInfobox::create( "##money_stolen_title##", "##money_stolen_text##",
                                          ShowInfobox::send2scribe, "mugging" );
    e->dispatch();

    city->treasury().resolveIssue( econ::Issue( econ::Issue::moneyStolen, -moneyStolen ) );
  }

  crime.level.current++;
  crime.muggers.thisYear++;
  //house->appendServiceValue( Service::crime, -crime::defaultValue / 2 );
  changeCrimeLevel( city, -crime::muggerCost );
}
Esempio n. 2
0
void Forum::Impl::removeMoney(PlayerCityPtr city)
{
  SenatePtr senate;
  SenateList senates = city::statistic::getObjects<Senate>( city, object::senate );
  if( !senates.empty() )
    senate = senates.front();

  int maxMoney = city->treasury().money();
  if( maxMoney > 0 )
  {
    ForumList forums = city::statistic::getObjects<Forum>( city );

    if( senate.isValid() )
      maxMoney /= 2;

    maxMoney /= forums.size();

    events::GameEventPtr e = events::Payment::create( econ::Issue::moneyStolen, -maxMoney );
    e->dispatch();
  }
}