if (!AITown.HasStatue(town)) {
if (AITown.IsActionAvailable(town, AITown.TOWN_ACTION_BUILD_STATUE)) {
local perform_action = true;
if (cvgs.IsCompanyValueGSGame() && cvgs.GetCompanyIDRank(AICompany.ResolveCompanyID(AICompany.COMPANY_SELF)) == 1 && cvgs.RankingList().Count() > 1) {
AILog.Info("Cost of perfoming action: " + TestPerformTownAction().TestCost(town, AITown.TOWN_ACTION_BUILD_STATUE) + " ; Value difference to company behind: " + cvgs.GetCompanyIDDiffToNext(AICompany.ResolveCompanyID(AICompany.COMPANY_SELF), false));
if (TestPerformTownAction().TestCost(town, AITown.TOWN_ACTION_BUILD_STATUE) > cvgs.GetCompanyIDDiffToNext(AICompany.ResolveCompanyID(AICompany.COMPANY_SELF), false)) {
perform_action = false;
}
}
if (perform_action && AITown.PerformTownAction(town, AITown.TOWN_ACTION_BUILD_STATUE)) {
AILog.Warning("Built a statue in " + AITown.GetName(town) + ".");
}
}