--[[
Automatically generated via export from C:/Users/charlie\DaVE_local\TW/branches/rome2/patch12/rome2/raw_data/db
Edit manually at your own risk
--]]

module(..., package.seeall)

events = require "data.lua_scripts.events"
require "data.lua_scripts.lib_export_triggers"

-- Trigger declarations













--[[ SSS ]]--

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if conditions.FactionIsHuman(context) and char_is_general(context:character()) and not (context:character():has_trait("r2_cig_trait_suebi_ariovistus")) and not (context:character():has_trait("r2_sp_trait_roman_victor")) then
		effect.trait("r2_sp_trait_all_mad", "agent", 6, 100, context)
		return true
	end
	return false
end

--[[ SSS ]]--

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if conditions.FactionIsHuman(context) and char_is_general(context:character()) and (not (context:character():has_trait("r2_cig_trait_suebi_ariovistus")) or not (context:character():has_trait("r2_sp_trait_roman_victor"))) then
		effect.trait("r2_cig_trait_suebi_ariovistus", "agent", 6, 100, context)
		effect.trait("r2_sp_trait_roman_victor", "agent", 1, 100, context)
		return true
	end
	return false
end






--[[ SSS ]]--

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if conditions.FactionIsHuman(context) and char_is_general(context:character()) and not (context:character():has_trait("r2_cig_trait_suebi_ariovistus")) and not (context:character():has_trait("r2_sp_trait_roman_victor")) then
		effect.trait("r2_sp_trait_all_mad", "agent", 6, 100, context)
		return true
	end
	return false
end

--[[ SSS ]]--

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if conditions.FactionIsHuman(context) and char_is_general(context:character()) and (not (context:character():has_trait("r2_cig_trait_suebi_ariovistus")) or not (context:character():has_trait("r2_sp_trait_roman_victor"))) then
		effect.trait("r2_cig_trait_suebi_ariovistus", "agent", 6, 100, context)
		effect.trait("r2_sp_trait_roman_victor", "agent", 1, 100, context)
		return true
	end
	return false
end

--[[ SSS ]]--

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if conditions.FactionIsHuman(context) and char_is_general(context:character()) then
		effect.add_agent_experience("Trigger_general_Attacking_Victory",5, context)
		return true
	end
	return false
end

--[[ SSS ]]--

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if conditions.FactionIsHuman(context) then
		effect.add_military_force_experience("Trigger_Force_Attacking_Victory", 2, context)
		return true
	end
	return false
end

--[[ SSS ]]--

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if conditions.FactionIsHuman(context) then
		effect.add_military_force_experience("Trigger_Force_Attacking_Victory", 2, context)
		return true
	end
	return false
end




































--[[ r2_cig_trait_arverni_vercingetorix_trigger ]]--

function r2_cig_trait_arverni_vercingetorix_trigger_impl (context)
		return char_is_general_with_army(context:character()) and context:character():faction():name() == "gaul_arverni" and context:character():is_faction_leader() and context:character():model():campaign_name("main_gaul")
end 

events.CharacterRankUp[#events.CharacterRankUp+1] =
function (context)
	if r2_cig_trait_arverni_vercingetorix_trigger_impl(context) then
		effect.trait("r2_cig_trait_arverni_vercingetorix", "agent", 1, 100, context)
		return true
	end
	return false
end

--[[ r2_cig_trait_caesar_trigger ]]--

function r2_cig_trait_caesar_trigger_impl (context)
		return char_is_general_with_army(context:character()) and context:character():faction():name() == "gaul_rome" and context:character():is_faction_leader() and context:character():model():campaign_name("main_gaul")
end 

events.CharacterRankUp[#events.CharacterRankUp+1] =
function (context)
	if r2_cig_trait_caesar_trigger_impl(context) then
		effect.trait("r2_cig_trait_caesar", "agent", 1, 100, context)
		return true
	end
	return false
end

--[[ r2_cig_trait_nervii_boduognatus_trigger ]]--

function r2_cig_trait_nervii_boduognatus_trigger_impl (context)
		return char_is_general_with_army(context:character()) and context:character():faction():name() == "gaul_nervii" and context:character():is_faction_leader() and context:character():model():campaign_name("main_gaul")
end 

events.CharacterRankUp[#events.CharacterRankUp+1] =
function (context)
	if r2_cig_trait_nervii_boduognatus_trigger_impl(context) then
		effect.trait("r2_cig_trait_nervii_boduognatus", "agent", 1, 100, context)
		return true
	end
	return false
end

--[[ r2_cig_trait_suebi_ariovistus_trigger ]]--

function r2_cig_trait_suebi_ariovistus_trigger_impl (context)
		return char_is_general_with_army(context:character()) and context:character():faction():name() == "gaul_suebi" and context:character():is_faction_leader() and context:character():model():campaign_name("main_gaul")
end 

events.CharacterRankUp[#events.CharacterRankUp+1] =
function (context)
	if r2_cig_trait_suebi_ariovistus_trigger_impl(context) then
		effect.trait("r2_cig_trait_suebi_ariovistus", "agent", 1, 100, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_admin_good_success_trigger ]]--

function r2_sp_trait_all_admin_good_success_trigger_impl (context)
		return context:character():character_type("dignitary") and context:character():is_embedded_in_military_force() and context:character():is_male()
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_all_admin_good_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_admin_good", "agent", 1, 30, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_army_assault_unit_extraordinary_success_trigger ]]--

function r2_sp_trait_all_agent_army_assault_unit_extraordinary_success_trigger_impl (context)
		return context:character():character_type("champion") and context:ability() == "hinder_army" and context:attribute() == "zeal" and context:mission_result_critial_success() 
end 

events.CharacterCharacterTargetAction[#events.CharacterCharacterTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_army_assault_unit_extraordinary_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_army_assault_unit", "agent", 2, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_army_assault_unit_success_trigger ]]--

function r2_sp_trait_all_agent_army_assault_unit_success_trigger_impl (context)
		return context:character():character_type("champion") and context:ability() == "hinder_army" and context:attribute() == "zeal" and context:mission_result_success()
end 

events.CharacterCharacterTargetAction[#events.CharacterCharacterTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_army_assault_unit_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_army_assault_unit", "agent", 1, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_army_foreign_harass_guerrilla_success_trigger ]]--

function r2_sp_trait_all_agent_army_foreign_harass_guerrilla_success_trigger_impl (context)
		return context:character():character_type("champion") and context:character():has_region() and context:character():is_deployed() and not char_in_owned_region(context:character())
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_all_agent_army_foreign_harass_guerrilla_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_army_foreign_harass_guerrilla", "agent", 1, 30, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_army_friendly_reconaissance_success_trigger ]]--

function r2_sp_trait_all_agent_army_friendly_reconaissance_success_trigger_impl (context)
		return context:character():character_type("spy") and context:character():is_embedded_in_military_force() 
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_all_agent_army_friendly_reconaissance_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_army_friendly_reconaissance", "agent", 1, 30, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_army_instructor_success_trigger ]]--

function r2_sp_trait_all_agent_army_instructor_success_trigger_impl (context)
		return context:character():character_type("champion") and context:character():is_embedded_in_military_force() 
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_all_agent_army_instructor_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_army_instructor", "agent", 1, 30, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_army_intercept_orders_extraordinary_success_trigger ]]--

function r2_sp_trait_all_agent_army_intercept_orders_extraordinary_success_trigger_impl (context)
		return context:character():character_type("spy") and context:ability() == "hinder_army" and context:attribute() == "authority" and context:mission_result_critial_success() 
end 

events.CharacterCharacterTargetAction[#events.CharacterCharacterTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_army_intercept_orders_extraordinary_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_army_intercept_orders", "agent", 2, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_army_intercept_orders_success_trigger ]]--

function r2_sp_trait_all_agent_army_intercept_orders_success_trigger_impl (context)
		return context:character():character_type("spy") and context:ability() == "hinder_army" and context:attribute() == "authority" and context:mission_result_success()
end 

events.CharacterCharacterTargetAction[#events.CharacterCharacterTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_army_intercept_orders_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_army_intercept_orders", "agent", 1, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_army_mislead_command_extraordinary_success_trigger ]]--

function r2_sp_trait_all_agent_army_mislead_command_extraordinary_success_trigger_impl (context)
		return context:character():character_type("dignitary") and context:ability() == "hinder_army" and context:attribute() == "subterfuge" and context:mission_result_critial_success() 
end 

events.CharacterCharacterTargetAction[#events.CharacterCharacterTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_army_mislead_command_extraordinary_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_army_mislead_command", "agent", 2, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_army_mislead_command_success_trigger ]]--

function r2_sp_trait_all_agent_army_mislead_command_success_trigger_impl (context)
		return context:character():character_type("dignitary") and context:ability() == "hinder_army" and context:attribute() == "subterfuge" and context:mission_result_success()
end 

events.CharacterCharacterTargetAction[#events.CharacterCharacterTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_army_mislead_command_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_army_mislead_command", "agent", 1, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_army_poison_provisions_extraordinary_success_trigger ]]--

function r2_sp_trait_all_agent_army_poison_provisions_extraordinary_success_trigger_impl (context)
		return context:character():character_type("spy") and context:ability() == "hinder_army" and context:attribute() == "subterfuge" and context:mission_result_critial_success() 
end 

events.CharacterCharacterTargetAction[#events.CharacterCharacterTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_army_poison_provisions_extraordinary_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_army_poison_provisions", "agent", 2, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_army_poison_provisions_success_trigger ]]--

function r2_sp_trait_all_agent_army_poison_provisions_success_trigger_impl (context)
		return context:character():character_type("spy") and context:ability() == "hinder_army" and context:attribute() == "subterfuge" and context:mission_result_success()
end 

events.CharacterCharacterTargetAction[#events.CharacterCharacterTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_army_poison_provisions_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_army_poison_provisions", "agent", 1, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_army_show_force_extraordinary_success_trigger ]]--

function r2_sp_trait_all_agent_army_show_force_extraordinary_success_trigger_impl (context)
		return context:character():character_type("champion") and context:ability() == "hinder_army" and context:attribute() == "authority" and context:character():is_male() and context:mission_result_critial_success() 
end 

events.CharacterCharacterTargetAction[#events.CharacterCharacterTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_army_show_force_extraordinary_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_army_show_force", "agent", 2, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_army_show_force_success_trigger ]]--

function r2_sp_trait_all_agent_army_show_force_success_trigger_impl (context)
		return context:character():character_type("champion") and context:ability() == "hinder_army" and context:attribute() == "authority" and context:mission_result_success() and context:character():is_male()
end 

events.CharacterCharacterTargetAction[#events.CharacterCharacterTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_army_show_force_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_army_show_force", "agent", 1, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_army_threaten_extraordinary_success_trigger ]]--

function r2_sp_trait_all_agent_army_threaten_extraordinary_success_trigger_impl (context)
		return context:character():character_type("dignitary") and context:ability() == "hinder_army" and context:attribute() == "zeal" and context:mission_result_success() and context:mission_result_critial_success() 
end 

events.CharacterCharacterTargetAction[#events.CharacterCharacterTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_army_threaten_extraordinary_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_army_threaten", "agent", 2, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_army_threaten_success_trigger ]]--

function r2_sp_trait_all_agent_army_threaten_success_trigger_impl (context)
		return context:character():character_type("dignitary") and context:ability() == "hinder_army" and context:attribute() == "zeal" and context:mission_result_success()
end 

events.CharacterCharacterTargetAction[#events.CharacterCharacterTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_army_threaten_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_army_threaten", "agent", 1, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_army_undermine_authority_extraordinary_success_trigger ]]--

function r2_sp_trait_all_agent_army_undermine_authority_extraordinary_success_trigger_impl (context)
		return context:character():character_type("dignitary") and context:ability() == "hinder_army" and context:attribute() == "authority" and context:mission_result_critial_success() 
end 

events.CharacterCharacterTargetAction[#events.CharacterCharacterTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_army_undermine_authority_extraordinary_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_army_undermine_authority", "agent", 2, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_army_undermine_authority_success_trigger ]]--

function r2_sp_trait_all_agent_army_undermine_authority_success_trigger_impl (context)
		return context:character():character_type("dignitary") and context:ability() == "hinder_army" and context:attribute() == "authority" and context:mission_result_success()
end 

events.CharacterCharacterTargetAction[#events.CharacterCharacterTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_army_undermine_authority_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_army_undermine_authority", "agent", 1, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_army_wreck_supplies_extraordinary_success_trigger ]]--

function r2_sp_trait_all_agent_army_wreck_supplies_extraordinary_success_trigger_impl (context)
		return context:character():character_type("spy") and context:ability() == "hinder_army" and context:attribute() == "zeal" and context:mission_result_critial_success() 
end 

events.CharacterCharacterTargetAction[#events.CharacterCharacterTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_army_wreck_supplies_extraordinary_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_army_wreck_supplies", "agent", 2, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_army_wreck_supplies_success_trigger ]]--

function r2_sp_trait_all_agent_army_wreck_supplies_success_trigger_impl (context)
		return context:character():character_type("spy") and context:ability() == "hinder_army" and context:attribute() == "zeal" and context:mission_result_success()
end 

events.CharacterCharacterTargetAction[#events.CharacterCharacterTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_army_wreck_supplies_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_army_wreck_supplies", "agent", 1, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_character_assassin_trigger ]]--

function r2_sp_trait_all_agent_character_assassin_trigger_impl (context)
		return true
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_all_agent_character_assassin_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_character_assassin", "agent", 1, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_character_kill_betrayal_extraordinary_success_trigger ]]--

function r2_sp_trait_all_agent_character_kill_betrayal_extraordinary_success_trigger_impl (context)
		return context:character():character_type("dignitary") and context:ability() == "hinder_character" and context:attribute() == "subterfuge" and context:mission_result_critial_success() 
end 

events.CharacterCharacterTargetAction[#events.CharacterCharacterTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_character_kill_betrayal_extraordinary_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_character_kill_betrayal", "agent", 2, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_character_kill_betrayal_success_trigger ]]--

function r2_sp_trait_all_agent_character_kill_betrayal_success_trigger_impl (context)
		return context:character():character_type("dignitary") and context:ability() == "hinder_character" and context:attribute() == "subterfuge" and context:mission_result_success()
end 

events.CharacterCharacterTargetAction[#events.CharacterCharacterTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_character_kill_betrayal_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_character_kill_betrayal", "agent", 1, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_character_kill_concealed_blade_extraordinary_success_trigger ]]--

function r2_sp_trait_all_agent_character_kill_concealed_blade_extraordinary_success_trigger_impl (context)
		return context:character():character_type("spy") and context:ability() == "hinder_character" and context:attribute() == "zeal" and context:mission_result_critial_success() 
end 

events.CharacterCharacterTargetAction[#events.CharacterCharacterTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_character_kill_concealed_blade_extraordinary_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_character_kill_concealed_blade", "agent", 2, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_character_kill_concealed_blade_success_trigger ]]--

function r2_sp_trait_all_agent_character_kill_concealed_blade_success_trigger_impl (context)
		return context:character():character_type("spy") and context:ability() == "hinder_character" and context:attribute() == "zeal" and context:mission_result_success()
end 

events.CharacterCharacterTargetAction[#events.CharacterCharacterTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_character_kill_concealed_blade_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_character_kill_concealed_blade", "agent", 1, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_character_kill_hire_assassins_success_trigger ]]--

function r2_sp_trait_all_agent_character_kill_hire_assassins_success_trigger_impl (context)
		return context:character():character_type("dignitary") and context:ability() == "hinder_character" and context:attribute() == "authority" and context:mission_result_success()
end 

events.CharacterCharacterTargetAction[#events.CharacterCharacterTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_character_kill_hire_assassins_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_character_kill_hire_assassins", "agent", 1, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_character_kill_marksmanship_extraordinary_success_trigger ]]--

function r2_sp_trait_all_agent_character_kill_marksmanship_extraordinary_success_trigger_impl (context)
		return context:character():character_type("champion") and context:ability() == "hinder_character" and context:attribute() == "subterfuge" and context:mission_result_critial_success() 
end 

events.CharacterCharacterTargetAction[#events.CharacterCharacterTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_character_kill_marksmanship_extraordinary_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_character_kill_marksmanship", "agent", 2, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_character_kill_marksmanship_success_trigger ]]--

function r2_sp_trait_all_agent_character_kill_marksmanship_success_trigger_impl (context)
		return context:character():character_type("champion") and context:ability() == "hinder_character" and context:attribute() == "subterfuge" and context:mission_result_success()
end 

events.CharacterCharacterTargetAction[#events.CharacterCharacterTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_character_kill_marksmanship_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_character_kill_marksmanship", "agent", 1, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_character_kill_poison_extraordinary_success_trigger ]]--

function r2_sp_trait_all_agent_character_kill_poison_extraordinary_success_trigger_impl (context)
		return context:character():character_type("spy") and context:ability() == "hinder_character" and context:attribute() == "subterfuge" and context:mission_result_critial_success() and context:character():is_male()
end 

events.CharacterCharacterTargetAction[#events.CharacterCharacterTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_character_kill_poison_extraordinary_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_character_kill_poison", "agent", 2, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_character_kill_poison_success_trigger ]]--

function r2_sp_trait_all_agent_character_kill_poison_success_trigger_impl (context)
		return context:character():character_type("spy") and context:ability() == "hinder_character" and context:attribute() == "subterfuge" and context:mission_result_success() and context:character():is_male()
end 

events.CharacterCharacterTargetAction[#events.CharacterCharacterTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_character_kill_poison_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_character_kill_poison", "agent", 1, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_character_kill_provocation_extraordinary_success_trigger ]]--

function r2_sp_trait_all_agent_character_kill_provocation_extraordinary_success_trigger_impl (context)
		return context:character():character_type("dignitary") and context:ability() == "hinder_character" and context:attribute() == "zeal" and context:mission_result_critial_success() 
end 

events.CharacterCharacterTargetAction[#events.CharacterCharacterTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_character_kill_provocation_extraordinary_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_character_kill_provocation", "agent", 2, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_character_kill_provocation_success_trigger ]]--

function r2_sp_trait_all_agent_character_kill_provocation_success_trigger_impl (context)
		return context:character():character_type("dignitary") and context:ability() == "hinder_character" and context:attribute() == "zeal" and context:mission_result_success()
end 

events.CharacterCharacterTargetAction[#events.CharacterCharacterTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_character_kill_provocation_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_character_kill_provocation", "agent", 1, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_character_kill_single_combat_extraordinary_success_trigger ]]--

function r2_sp_trait_all_agent_character_kill_single_combat_extraordinary_success_trigger_impl (context)
		return context:character():character_type("champion") and context:ability() == "hinder_character" and context:attribute() == "authority" and context:mission_result_critial_success() and context:character():is_male()
end 

events.CharacterCharacterTargetAction[#events.CharacterCharacterTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_character_kill_single_combat_extraordinary_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_character_kill_single_combat", "agent", 2, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_character_kill_single_combat_success_trigger ]]--

function r2_sp_trait_all_agent_character_kill_single_combat_success_trigger_impl (context)
		return context:character():character_type("champion") and context:ability() == "hinder_character" and context:attribute() == "authority" and context:mission_result_success() and context:character():is_male()
end 

events.CharacterCharacterTargetAction[#events.CharacterCharacterTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_character_kill_single_combat_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_character_kill_single_combat", "agent", 1, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_character_kill_slaughter_extraordinary_success_trigger ]]--

function r2_sp_trait_all_agent_character_kill_slaughter_extraordinary_success_trigger_impl (context)
		return context:character():character_type("champion") and context:ability() == "hinder_character" and context:attribute() == "zeal" and context:mission_result_critial_success() 
end 

events.CharacterCharacterTargetAction[#events.CharacterCharacterTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_character_kill_slaughter_extraordinary_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_character_kill_slaughter", "agent", 2, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_character_kill_slaughter_success_trigger ]]--

function r2_sp_trait_all_agent_character_kill_slaughter_success_trigger_impl (context)
		return context:character():character_type("champion") and context:ability() == "hinder_character" and context:attribute() == "zeal" and context:mission_result_success()
end 

events.CharacterCharacterTargetAction[#events.CharacterCharacterTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_character_kill_slaughter_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_character_kill_slaughter", "agent", 1, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_character_kill_solicit_traitor_success_trigger ]]--

function r2_sp_trait_all_agent_character_kill_solicit_traitor_success_trigger_impl (context)
		return context:character():character_type("spy") and context:ability() == "hinder_character" and context:attribute() == "authority" and context:mission_result_critial_success() and context:character():is_male()
end 

events.CharacterCharacterTargetAction[#events.CharacterCharacterTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_character_kill_solicit_traitor_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_character_kill_solicit_traitor", "agent", 1, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_character_seduce_persuasion_extraordinary_success_trigger ]]--

function r2_sp_trait_all_agent_character_seduce_persuasion_extraordinary_success_trigger_impl (context)
		return (context:character():character_type("spy") or context:character():character_type("dignitary") or context:character():character_type("champion")) and (context:attribute() == "authority" and context:ability() == "hinder_agent" and context:mission_result_critial_success())
end 

events.CharacterCharacterTargetAction[#events.CharacterCharacterTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_character_seduce_persuasion_extraordinary_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_character_seduce_persuasion", "agent", 2, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_character_seduce_persuasion_success_trigger ]]--

function r2_sp_trait_all_agent_character_seduce_persuasion_success_trigger_impl (context)
		return (context:character():character_type("spy") or context:character():character_type("dignitary") or context:character():character_type("champion")) and (context:attribute() == "authority" and context:ability() == "hinder_agent" and context:mission_result_success())
end 

events.CharacterCharacterTargetAction[#events.CharacterCharacterTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_character_seduce_persuasion_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_character_seduce_persuasion", "agent", 1, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_character_seduce_temptation_extraordinary_success_trigger ]]--

function r2_sp_trait_all_agent_character_seduce_temptation_extraordinary_success_trigger_impl (context)
		return (context:character():character_type("spy") or context:character():character_type("dignitary") or context:character():character_type("champion")) and (context:attribute() == "subterfuge" and context:ability() == "hinder_agent" and context:mission_result_critial_success())
end 

events.CharacterCharacterTargetAction[#events.CharacterCharacterTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_character_seduce_temptation_extraordinary_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_character_seduce_temptation", "agent", 2, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_character_seduce_temptation_success_trigger ]]--

function r2_sp_trait_all_agent_character_seduce_temptation_success_trigger_impl (context)
		return (context:character():character_type("spy") or context:character():character_type("dignitary") or context:character():character_type("champion")) and (context:attribute() == "subterfuge" and context:ability() == "hinder_agent" and context:mission_result_success())
end 

events.CharacterCharacterTargetAction[#events.CharacterCharacterTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_character_seduce_temptation_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_character_seduce_temptation", "agent", 1, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_deployed_foreign_corrupt_success_trigger ]]--

function r2_sp_trait_all_agent_deployed_foreign_corrupt_success_trigger_impl (context)
		return context:character():character_type("dignitary") and context:character():has_region() and context:character():is_deployed() and not char_in_owned_region(context:character()) and context:character():is_male()
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_all_agent_deployed_foreign_corrupt_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_deployed_foreign_corrupt", "agent", 1, 30, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_deployed_foreign_infiltrate_success_trigger ]]--

function r2_sp_trait_all_agent_deployed_foreign_infiltrate_success_trigger_impl (context)
		return context:character():character_type("spy") and context:character():has_region() and not (context:character():region():owning_faction():name() == context:character():faction():name()) and (context:character():is_hidden(context:character():region():owning_faction():name()))
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_all_agent_deployed_foreign_infiltrate_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_deployed_foreign_infiltrate", "agent", 1, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_deployed_friendly_counterspy_success_trigger ]]--

function r2_sp_trait_all_agent_deployed_friendly_counterspy_success_trigger_impl (context)
		return context:character():character_type("spy") and context:character():has_region() and context:character():is_deployed() and char_in_owned_region(context:character()) and (context:character():is_male())
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_all_agent_deployed_friendly_counterspy_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_deployed_friendly_counterspy", "agent", 1, 30, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_passive_adventurer_success_trigger ]]--

function r2_sp_trait_all_agent_passive_adventurer_success_trigger_impl (context)
		return context:character():character_type("champion") and not context:character():is_deployed() and not context:character():is_embedded_in_military_force()
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_all_agent_passive_adventurer_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_passive_adventurer", "agent", 1, 30, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_passive_cultural_proponent_success_trigger ]]--

function r2_sp_trait_all_agent_passive_cultural_proponent_success_trigger_impl (context)
		return context:character():character_type("dignitary") and not context:character():is_deployed() and not context:character():is_embedded_in_military_force()
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_all_agent_passive_cultural_proponent_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_passive_cultural_proponent", "agent", 1, 30, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_passive_spy ]]--

function r2_sp_trait_all_agent_passive_spy_impl (context)
		return true
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_all_agent_passive_spy_impl(context) then
		effect.trait("r2_sp_trait_all_agent_passive_spy", "agent", 1, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_seduce_coercion_1_extraordinary_success_trigger ]]--

function r2_sp_trait_all_agent_seduce_coercion_1_extraordinary_success_trigger_impl (context)
		return (context:character():character_type("spy") or context:character():character_type("dignitary") or context:character():character_type("champion")) and (context:attribute() == "zeal" and context:ability() == "hinder_agent" and context:mission_result_critial_success())
end 

events.CharacterCharacterTargetAction[#events.CharacterCharacterTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_seduce_coercion_1_extraordinary_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_seduce_coercion_1", "agent", 2, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_seduce_coercion_1_success_trigger ]]--

function r2_sp_trait_all_agent_seduce_coercion_1_success_trigger_impl (context)
		return (context:character():character_type("spy") or context:character():character_type("dignitary") or context:character():character_type("champion")) and (context:attribute() == "zeal" and context:ability() == "hinder_agent" and context:mission_result_success())
end 

events.CharacterCharacterTargetAction[#events.CharacterCharacterTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_seduce_coercion_1_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_seduce_coercion_1", "agent", 1, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_settle_assault_garrison_extraordinary_success_trigger ]]--

function r2_sp_trait_all_agent_settle_assault_garrison_extraordinary_success_trigger_impl (context)
		return context:character():character_type("champion") and context:ability() == "hinder_settlement" and context:attribute() == "zeal" and context:mission_result_critial_success() 
end 

events.CharacterGarrisonTargetAction[#events.CharacterGarrisonTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_settle_assault_garrison_extraordinary_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_settle_assault_garrison", "agent", 2, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_settle_assault_garrison_success_trigger ]]--

function r2_sp_trait_all_agent_settle_assault_garrison_success_trigger_impl (context)
		return context:character():character_type("champion") and context:ability() == "hinder_settlement" and context:attribute() == "zeal" and context:mission_result_success()
end 

events.CharacterGarrisonTargetAction[#events.CharacterGarrisonTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_settle_assault_garrison_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_settle_assault_garrison", "agent", 1, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_settle_buy_off_extraordinary_success_trigger ]]--

function r2_sp_trait_all_agent_settle_buy_off_extraordinary_success_trigger_impl (context)
		return context:character():character_type("dignitary") and context:ability() == "hinder_settlement" and context:attribute() == "subterfuge" and context:mission_result_critial_success() 
end 

events.CharacterGarrisonTargetAction[#events.CharacterGarrisonTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_settle_buy_off_extraordinary_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_settle_buy_off", "agent", 2, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_settle_buy_off_success_trigger ]]--

function r2_sp_trait_all_agent_settle_buy_off_success_trigger_impl (context)
		return context:character():character_type("dignitary") and context:ability() == "hinder_settlement" and context:attribute() == "subterfuge" and context:mission_result_success()
end 

events.CharacterGarrisonTargetAction[#events.CharacterGarrisonTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_settle_buy_off_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_settle_buy_off", "agent", 1, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_settle_commit_arson_extraordinary_success_trigger ]]--

function r2_sp_trait_all_agent_settle_commit_arson_extraordinary_success_trigger_impl (context)
		return context:character():character_type("spy") and context:ability() == "hinder_settlement" and context:attribute() == "zeal" and context:mission_result_critial_success() 
end 

events.CharacterGarrisonTargetAction[#events.CharacterGarrisonTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_settle_commit_arson_extraordinary_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_settle_commit_arson", "agent", 2, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_settle_commit_arson_success_trigger ]]--

function r2_sp_trait_all_agent_settle_commit_arson_success_trigger_impl (context)
		return context:character():character_type("spy") and context:ability() == "hinder_settlement" and context:attribute() == "zeal" and context:mission_result_success()
end 

events.CharacterGarrisonTargetAction[#events.CharacterGarrisonTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_settle_commit_arson_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_settle_commit_arson", "agent", 1, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_settle_cultural_propaganda_extraordinary_success_trigger ]]--

function r2_sp_trait_all_agent_settle_cultural_propaganda_extraordinary_success_trigger_impl (context)
		return context:character():character_type("dignitary") and context:ability() == "hinder_settlement" and context:attribute() == "zeal" and context:mission_result_critial_success() 
end 

events.CharacterGarrisonTargetAction[#events.CharacterGarrisonTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_settle_cultural_propaganda_extraordinary_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_settle_cultural_propaganda", "agent", 2, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_settle_cultural_propaganda_success_trigger ]]--

function r2_sp_trait_all_agent_settle_cultural_propaganda_success_trigger_impl (context)
		return context:character():character_type("dignitary") and context:ability() == "hinder_settlement" and context:attribute() == "zeal" and context:mission_result_success()
end 

events.CharacterGarrisonTargetAction[#events.CharacterGarrisonTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_settle_cultural_propaganda_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_settle_cultural_propaganda", "agent", 1, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_settle_incite_unrest_extraordinary_success_trigger ]]--

function r2_sp_trait_all_agent_settle_incite_unrest_extraordinary_success_trigger_impl (context)
		return context:character():character_type("dignitary") and context:ability() == "hinder_settlement" and context:attribute() == "authority" and context:mission_result_critial_success() and context:character():is_male() and context:mission_result_critial_success() 
end 

events.CharacterGarrisonTargetAction[#events.CharacterGarrisonTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_settle_incite_unrest_extraordinary_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_settle_incite_unrest", "agent", 2, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_settle_incite_unrest_success_trigger ]]--

function r2_sp_trait_all_agent_settle_incite_unrest_success_trigger_impl (context)
		return context:character():character_type("dignitary") and context:ability() == "hinder_settlement" and context:attribute() == "authority" and context:mission_result_success() and context:character():is_male()
end 

events.CharacterGarrisonTargetAction[#events.CharacterGarrisonTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_settle_incite_unrest_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_settle_incite_unrest", "agent", 1, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_settle_poison_well_extraordinary_success_trigger ]]--

function r2_sp_trait_all_agent_settle_poison_well_extraordinary_success_trigger_impl (context)
		return context:character():character_type("spy") and context:ability() == "hinder_settlement" and context:attribute() == "subterfuge" and context:mission_result_critial_success() 
end 

events.CharacterGarrisonTargetAction[#events.CharacterGarrisonTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_settle_poison_well_extraordinary_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_settle_poison_well", "agent", 2, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_settle_poison_well_success_trigger ]]--

function r2_sp_trait_all_agent_settle_poison_well_success_trigger_impl (context)
		return context:character():character_type("spy") and context:ability() == "hinder_settlement" and context:attribute() == "subterfuge" and context:mission_result_success()
end 

events.CharacterGarrisonTargetAction[#events.CharacterGarrisonTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_settle_poison_well_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_settle_poison_well", "agent", 1, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_settle_promote_disorder_extraordinary_success_trigger ]]--

function r2_sp_trait_all_agent_settle_promote_disorder_extraordinary_success_trigger_impl (context)
		return context:character():character_type("spy") and context:ability() == "hinder_settlement" and context:attribute() == "authority" and context:mission_result_critial_success() and context:character():is_male()
end 

events.CharacterGarrisonTargetAction[#events.CharacterGarrisonTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_settle_promote_disorder_extraordinary_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_settle_promote_disorder", "agent", 2, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_settle_promote_disorder_success_trigger ]]--

function r2_sp_trait_all_agent_settle_promote_disorder_success_trigger_impl (context)
		return context:character():character_type("spy") and context:ability() == "hinder_settlement" and context:attribute() == "authority" and context:mission_result_success() and context:character():is_male()
end 

events.CharacterGarrisonTargetAction[#events.CharacterGarrisonTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_settle_promote_disorder_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_settle_promote_disorder", "agent", 1, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_settle_raid_extraordinary_success_trigger ]]--

function r2_sp_trait_all_agent_settle_raid_extraordinary_success_trigger_impl (context)
		return context:character():character_type("champion") and context:ability() == "hinder_settlement" and context:attribute() == "subterfuge" and context:mission_result_critial_success() 
end 

events.CharacterGarrisonTargetAction[#events.CharacterGarrisonTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_settle_raid_extraordinary_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_settle_raid", "agent", 2, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_settle_raid_success_trigger ]]--

function r2_sp_trait_all_agent_settle_raid_success_trigger_impl (context)
		return context:character():character_type("champion") and context:ability() == "hinder_settlement" and context:attribute() == "subterfuge" and context:mission_result_success()
end 

events.CharacterGarrisonTargetAction[#events.CharacterGarrisonTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_settle_raid_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_settle_raid", "agent", 1, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_settle_rally_slaves_extraordinary_success_trigger ]]--

function r2_sp_trait_all_agent_settle_rally_slaves_extraordinary_success_trigger_impl (context)
		return context:character():character_type("champion") and context:ability() == "hinder_settlement" and context:attribute() == "authority" and context:mission_result_critial_success() and context:character():is_male()
end 

events.CharacterGarrisonTargetAction[#events.CharacterGarrisonTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_settle_rally_slaves_extraordinary_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_settle_rally_slaves", "agent", 2, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_agent_settle_rally_slaves_success_trigger ]]--

function r2_sp_trait_all_agent_settle_rally_slaves_success_trigger_impl (context)
		return context:character():character_type("champion") and context:ability() == "hinder_settlement" and context:attribute() == "authority" and context:mission_result_success() and context:character():is_male()
end 

events.CharacterGarrisonTargetAction[#events.CharacterGarrisonTargetAction+1] =
function (context)
	if r2_sp_trait_all_agent_settle_rally_slaves_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_agent_settle_rally_slaves", "agent", 1, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_ambusher_bad_trigger ]]--

function r2_sp_trait_all_ambusher_bad_trigger_impl (context)
		return char_is_general_with_army(context:character()) and context:character():model():pending_battle():failed_ambush_battle() and not attacker_victory(context:character():model():pending_battle())
end 

events.CharacterCompletedBattle[#events.CharacterCompletedBattle+1] =
function (context)
	if r2_sp_trait_all_ambusher_bad_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_ambusher_bad", "agent", 1, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_ambusher_good_trigger ]]--

function r2_sp_trait_all_ambusher_good_trigger_impl (context)
		return char_is_general_with_army(context:character()) and (context:character():model():pending_battle():ambush_battle()) 
end 

events.CharacterCompletedBattle[#events.CharacterCompletedBattle+1] =
function (context)
	if r2_sp_trait_all_ambusher_good_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_ambusher_good", "agent", 1, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_attacker_bad_trigger ]]--

function r2_sp_trait_all_attacker_bad_trigger_impl (context)
		return char_is_general_with_army(context:character()) and char_is_attacker(context:character()) and defender_victory(context:character():model():pending_battle()) and (context:character():battles_won() <= (context:character():battles_fought() * 0.6))
end 

events.CharacterCompletedBattle[#events.CharacterCompletedBattle+1] =
function (context)
	if r2_sp_trait_all_attacker_bad_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_attacker_bad", "agent", 1, 30, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_attacker_good_trigger ]]--

function r2_sp_trait_all_attacker_good_trigger_impl (context)
		return char_is_general_with_army(context:character()) and char_is_attacker(context:character()) and attacker_victory(context:character():model():pending_battle()) and (context:character():battles_won() > (context:character():battles_fought() * 0.75)) and context:character():battles_fought() >=5
end 

events.CharacterCompletedBattle[#events.CharacterCompletedBattle+1] =
function (context)
	if r2_sp_trait_all_attacker_good_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_attacker_good", "agent", 1, 30, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_attacker_sea_bad_trigger ]]--

function r2_sp_trait_all_attacker_sea_bad_trigger_impl (context)
		return char_is_general(context:character()) and char_has_navy(context:character()) and char_is_attacker(context:character()) and defender_victory(context:character():model():pending_battle()) 
end 

events.CharacterCompletedBattle[#events.CharacterCompletedBattle+1] =
function (context)
	if r2_sp_trait_all_attacker_sea_bad_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_attacker_sea_bad", "agent", 1, 30, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_attacker_sea_good_trigger ]]--

function r2_sp_trait_all_attacker_sea_good_trigger_impl (context)
		return char_is_general(context:character()) and char_has_navy(context:character()) and char_is_attacker(context:character()) and attacker_victory(context:character():model():pending_battle()) 
end 

events.CharacterCompletedBattle[#events.CharacterCompletedBattle+1] =
function (context)
	if r2_sp_trait_all_attacker_sea_good_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_attacker_sea_good", "agent", 1, 30, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_background_abandoned_trigger ]]--

function r2_sp_trait_all_background_abandoned_trigger_impl (context)
		return (char_is_general(context:character()) or context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and context:character():is_male() and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_all_background_abandoned_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_background_abandoned", "agent", 1, 2, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_background_adept ]]--

function r2_sp_trait_all_background_adept_impl (context)
		return (char_is_general(context:character()) or context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy"))  and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_all_background_adept_impl(context) then
		effect.trait("r2_sp_trait_all_background_adept", "agent", 1, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_background_assassin_trigger ]]--

function r2_sp_trait_all_background_assassin_trigger_impl (context)
		return context:character():number_of_traits() <1
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_all_background_assassin_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_background_assassin", "agent", 1, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_background_beautiful_trigger ]]--

function r2_sp_trait_all_background_beautiful_trigger_impl (context)
		return (char_is_general(context:character()) or context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and not (context:character():is_male()) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_all_background_beautiful_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_background_beautiful", "agent", 1, 2, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_background_bright_trigger ]]--

function r2_sp_trait_all_background_bright_trigger_impl (context)
		return (char_is_general(context:character()) or context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and (context:character():is_male()) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_all_background_bright_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_background_bright", "agent", 1, 2, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_background_command_trigger ]]--

function r2_sp_trait_all_background_command_trigger_impl (context)
		return (char_is_general(context:character()) or context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and (context:character():is_male()) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_all_background_command_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_background_command", "agent", 1, 2, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_background_diplomacy_trigger ]]--

function r2_sp_trait_all_background_diplomacy_trigger_impl (context)
		return (char_is_general(context:character()) or context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and (context:character():is_male()) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_all_background_diplomacy_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_background_diplomacy", "agent", 1, 2, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_background_inbred_trigger ]]--

function r2_sp_trait_all_background_inbred_trigger_impl (context)
		return (char_is_general(context:character()) or context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and (context:character():is_male()) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_all_background_inbred_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_background_inbred", "agent", 1, 1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_background_philosopher_trigger ]]--

function r2_sp_trait_all_background_philosopher_trigger_impl (context)
		return (char_is_general(context:character()) or context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and (context:character():is_male()) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_all_background_philosopher_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_background_philosopher", "agent", 1, 2, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_background_scientist_trigger ]]--

function r2_sp_trait_all_background_scientist_trigger_impl (context)
		return (char_is_general(context:character()) or context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and (context:character():is_male()) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_all_background_scientist_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_background_scientist", "agent", 1, 2, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_background_slave_trigger ]]--

function r2_sp_trait_all_background_slave_trigger_impl (context)
		return (char_is_general(context:character()) or context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and (context:character():is_male()) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_all_background_slave_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_background_slave", "agent", 1, 2, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_background_spy_trigger ]]--

function r2_sp_trait_all_background_spy_trigger_impl (context)
		return (char_is_general(context:character()) or context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and (context:character():is_male()) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_all_background_spy_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_background_spy", "agent", 1, 2, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_battle_scarred_trigger ]]--

function r2_sp_trait_all_battle_scarred_trigger_impl (context)
		return (char_is_general(context:character()) and char_has_army(context:character()) and (char_is_attacker(context:character()))) and ((context:character():model():pending_battle():attacker():body_guard_casulties() >=0.7) or (char_is_defender(context:character()) and (context:character():model():pending_battle():defender():body_guard_casulties() >=0.7)))
end 

events.CharacterCompletedBattle[#events.CharacterCompletedBattle+1] =
function (context)
	if r2_sp_trait_all_battle_scarred_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_battle_scarred", "agent", 1, 30, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_besieger_bad ]]--

function r2_sp_trait_all_besieger_bad_impl (context)
		return char_is_general(context:character()) and char_has_army(context:character()) and char_is_attacker(context:character())  and defender_victory(context:character():model():pending_battle()) and context:character():model():pending_battle():seige_battle() and (context:character():offensive_sieges_won() <= (context:character():offensive_sieges_fought() * 0.4)) 
end 

events.CharacterCompletedBattle[#events.CharacterCompletedBattle+1] =
function (context)
	if r2_sp_trait_all_besieger_bad_impl(context) then
		effect.trait("r2_sp_trait_all_besieger_bad", "agent", 1, 30, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_besieger_good_trigger ]]--

function r2_sp_trait_all_besieger_good_trigger_impl (context)
		return char_is_general(context:character()) and char_has_army(context:character()) and context:character():model():pending_battle():seige_battle() and  (char_is_attacker(context:character())) and (attacker_victory(context:character():model():pending_battle())) and (context:character():offensive_sieges_won() >= (context:character():offensive_sieges_fought() * 0.75)) 
end 

events.CharacterCompletedBattle[#events.CharacterCompletedBattle+1] =
function (context)
	if r2_sp_trait_all_besieger_good_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_besieger_good", "agent", 1, 30, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_defender_bad_trigger ]]--

function r2_sp_trait_all_defender_bad_trigger_impl (context)
		return (char_is_general(context:character())) and (char_has_army(context:character())) and (char_is_defender(context:character())) and not (defender_victory(context:character():model():pending_battle()))  and (context:character():defensive_battles_won() <= (context:character():defensive_battles_fought() * 0.3)) 
end 

events.CharacterCompletedBattle[#events.CharacterCompletedBattle+1] =
function (context)
	if r2_sp_trait_all_defender_bad_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_defender_bad", "agent", 1, 30, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_defender_good_trigger ]]--

function r2_sp_trait_all_defender_good_trigger_impl (context)
		return (char_is_general(context:character())) and (char_has_army(context:character())) and (char_is_defender(context:character())) and (defender_victory(context:character():model():pending_battle()))  and (context:character():defensive_battles_won() >= (context:character():defensive_battles_fought() * 0.75)) 
end 

events.CharacterCompletedBattle[#events.CharacterCompletedBattle+1] =
function (context)
	if r2_sp_trait_all_defender_good_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_defender_good", "agent", 1, 30, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_defender_sea_bad_trigger ]]--

function r2_sp_trait_all_defender_sea_bad_trigger_impl (context)
		return char_is_general(context:character()) and (context:character():model():pending_battle():naval_battle()) and char_is_defender(context:character()) and not defender_victory(context:character():model():pending_battle())  and (context:character():defensive_naval_battles_won() <= (context:character():defensive_naval_battles_fought() * 0.25)) 
end 

events.CharacterCompletedBattle[#events.CharacterCompletedBattle+1] =
function (context)
	if r2_sp_trait_all_defender_sea_bad_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_defender_sea_bad", "agent", 1, 30, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_defender_sea_good_trigger ]]--

function r2_sp_trait_all_defender_sea_good_trigger_impl (context)
		return char_is_general(context:character()) and (context:character():model():pending_battle():naval_battle()) and char_is_defender(context:character()) and not (defender_victory(context:character():model():pending_battle()))  and (context:character():defensive_naval_battles_won() >= (context:character():defensive_naval_battles_fought() * 0.75)) 
end 

events.CharacterCompletedBattle[#events.CharacterCompletedBattle+1] =
function (context)
	if r2_sp_trait_all_defender_sea_good_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_defender_sea_good", "agent", 1, 30, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_disinherited_trigger ]]--

function r2_sp_trait_all_disinherited_trigger_impl (context)
		return true
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_all_disinherited_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_disinherited", "agent", 1, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_energetic_trigger ]]--

function r2_sp_trait_all_energetic_trigger_impl (context)
		return char_is_general_with_army(context:character()) and context:character():action_points_remaining_percent() <= 5 and context:character():performed_action_this_turn()
end 

events.CharacterTurnEnd[#events.CharacterTurnEnd+1] =
function (context)
	if r2_sp_trait_all_energetic_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_energetic", "agent", 1, 10, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_fears_barbarian_trigger ]]--

function r2_sp_trait_all_fears_barbarian_trigger_impl (context)
		return char_is_general_with_army(context:character()) and ((char_is_defender(context:character()) and context:character():model():pending_battle():has_attacker() and context:character():model():pending_battle():attacker():faction():culture() == "rom_Barbarian" and not context:character():model():pending_battle():defender():faction():culture() == "rom_Barbarian" and context:character():model():pending_battle():percentage_of_defender_killed() >= 60 and attacker_victory(context:character():model():pending_battle())) or (char_is_attacker(context:character()) and context:character():model():pending_battle():has_defender() and context:character():model():pending_battle():defender():faction():culture() == "rom_Barbarian"  and not context:character():model():pending_battle():attacker():faction():culture() == "rom_Barbarian" and context:character():model():pending_battle():percentage_of_attacker_killed() >= 60 and defender_victory(context:character():model():pending_battle())))
end 

events.CharacterCompletedBattle[#events.CharacterCompletedBattle+1] =
function (context)
	if r2_sp_trait_all_fears_barbarian_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_fears_barbarians", "agent", 1, 30, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_fears_carthage_trigger ]]--

function r2_sp_trait_all_fears_carthage_trigger_impl (context)
		return char_is_general_with_army(context:character()) and ((char_is_defender(context:character()) and context:character():model():pending_battle():has_attacker() and context:character():model():pending_battle():attacker():faction():subculture() == "sc_rom_carthaginian" and not context:character():model():pending_battle():defender():faction():subculture() == "sc_rom_carthaginian" and context:character():model():pending_battle():percentage_of_defender_killed() >= 60 and attacker_victory(context:character():model():pending_battle())) or (char_is_attacker(context:character()) and context:character():model():pending_battle():has_defender() and context:character():model():pending_battle():defender():faction():subculture() == "sc_rom_carthaginian" and not context:character():model():pending_battle():attacker():faction():subculture() == "sc_rom_carthaginian" and context:character():model():pending_battle():percentage_of_attacker_killed() >= 60 and defender_victory(context:character():model():pending_battle())))
end 

events.CharacterCompletedBattle[#events.CharacterCompletedBattle+1] =
function (context)
	if r2_sp_trait_all_fears_carthage_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_fears_carthage", "agent", 1, 30, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_fears_easterners_trigger ]]--

function r2_sp_trait_all_fears_easterners_trigger_impl (context)
		return char_is_general_with_army(context:character()) and ((char_is_defender(context:character()) and context:character():model():pending_battle():has_attacker() and context:character():model():pending_battle():attacker():faction():culture() == "rom_Eastern" and not context:character():model():pending_battle():defender():faction():culture() == "rom_Eastern" and context:character():model():pending_battle():percentage_of_defender_killed() >= 60 and attacker_victory(context:character():model():pending_battle())) or (char_is_attacker(context:character()) and context:character():model():pending_battle():has_defender() and context:character():model():pending_battle():defender():faction():culture() == "rom_Eastern" and not context:character():model():pending_battle():attacker():faction():culture() == "rom_Eastern" and context:character():model():pending_battle():percentage_of_attacker_killed() >= 60 and defender_victory(context:character():model():pending_battle())))
end 

events.CharacterCompletedBattle[#events.CharacterCompletedBattle+1] =
function (context)
	if r2_sp_trait_all_fears_easterners_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_fears_easterners", "agent", 1, 30, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_fears_egyptians_trigger ]]--

function r2_sp_trait_all_fears_egyptians_trigger_impl (context)
		return char_is_general_with_army(context:character()) and ((char_is_defender(context:character()) and context:character():model():pending_battle():has_attacker() and context:character():model():pending_battle():attacker():faction():subculture() == "sc_rom_egyptian" and not context:character():model():pending_battle():defender():faction():subculture() == "sc_rom_egyptian" and context:character():model():pending_battle():percentage_of_defender_killed() >= 60 and attacker_victory(context:character():model():pending_battle())) or (char_is_attacker(context:character()) and context:character():model():pending_battle():has_defender() and context:character():model():pending_battle():defender():faction():subculture() == "sc_rom_egyptian" and not context:character():model():pending_battle():attacker():faction():subculture() == "sc_rom_egyptian" and context:character():model():pending_battle():percentage_of_attacker_killed() >= 60 and defender_victory(context:character():model():pending_battle())))
end 

events.CharacterCompletedBattle[#events.CharacterCompletedBattle+1] =
function (context)
	if r2_sp_trait_all_fears_egyptians_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_fears_egyptians", "agent", 1, 30, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_fears_greeks_trigger ]]--

function r2_sp_trait_all_fears_greeks_trigger_impl (context)
		return char_is_general_with_army(context:character()) and ((char_is_defender(context:character()) and context:character():model():pending_battle():has_attacker() and is_in_state_list((context:character():model():pending_battle():attacker()), greek_states_factions) and not is_in_state_list((context:character():model():pending_battle():defender()), greek_states_factions) and context:character():model():pending_battle():percentage_of_defender_killed() >= 60 and attacker_victory(context:character():model():pending_battle())) or (char_is_attacker(context:character()) and context:character():model():pending_battle():has_defender() and is_in_state_list((context:character():model():pending_battle():defender()), greek_states_factions) and not is_in_state_list((context:character():model():pending_battle():attacker()), greek_states_factions) and context:character():model():pending_battle():percentage_of_attacker_killed() >= 60 and defender_victory(context:character():model():pending_battle())))
end 

events.CharacterCompletedBattle[#events.CharacterCompletedBattle+1] =
function (context)
	if r2_sp_trait_all_fears_greeks_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_fears_greeks", "agent", 1, 30, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_fears_romans_trigger ]]--

function r2_sp_trait_all_fears_romans_trigger_impl (context)
		return char_is_general_with_army(context:character()) and ((char_is_defender(context:character()) and context:character():model():pending_battle():has_attacker() and context:character():model():pending_battle():attacker():faction():subculture() == "sc_rom_roman" and not context:character():model():pending_battle():defender():faction():subculture() == "sc_rom_roman" and context:character():model():pending_battle():percentage_of_defender_killed() >= 60 and attacker_victory(context:character():model():pending_battle())) or (char_is_attacker(context:character()) and context:character():model():pending_battle():has_defender() and context:character():model():pending_battle():defender():faction():subculture() == "sc_rom_roman" and not context:character():model():pending_battle():attacker():faction():subculture() == "sc_rom_roman" and context:character():model():pending_battle():percentage_of_attacker_killed() >= 60 and defender_victory(context:character():model():pending_battle())))
end 

events.CharacterCompletedBattle[#events.CharacterCompletedBattle+1] =
function (context)
	if r2_sp_trait_all_fears_romans_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_fears_romans", "agent", 1, 30, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_fears_successors_trigger ]]--

function r2_sp_trait_all_fears_successors_trigger_impl (context)
		return char_is_general_with_army(context:character()) and ((char_is_defender(context:character()) and context:character():model():pending_battle():has_attacker() and is_in_state_list((context:character():model():pending_battle():attacker()), successor_states_factions) and not is_in_state_list((context:character():model():pending_battle():defender()), successor_states_factions) and context:character():model():pending_battle():percentage_of_defender_killed() >= 60 and attacker_victory(context:character():model():pending_battle())) or (char_is_attacker(context:character()) and context:character():model():pending_battle():has_defender() and is_in_state_list((context:character():model():pending_battle():defender()), successor_states_factions) and not is_in_state_list((context:character():model():pending_battle():attacker()), successor_states_factions) and context:character():model():pending_battle():percentage_of_attacker_killed() >= 60 and defender_victory(context:character():model():pending_battle())))
end 

events.CharacterCompletedBattle[#events.CharacterCompletedBattle+1] =
function (context)
	if r2_sp_trait_all_fears_successors_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_fears_successors", "agent", 1, 30, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_fertile_trigger ]]--

function r2_sp_trait_all_fertile_trigger_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_all_fertile_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_fertile", "agent", 1, 5, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_fervour ]]--

function r2_sp_trait_all_fervour_impl (context)
		return char_is_general(context:character()) and char_has_army(context:character()) and context:character():model():pending_battle():percentage_of_attacker_killed() >= 70 and context:character():model():pending_battle():percentage_of_defender_killed() >= 70 and ((char_is_attacker(context:character()) and attacker_victory(context:character():model():pending_battle()) and (context:character():model():pending_battle():attacker_commander_fought_in_battle()) and not (context:character():model():pending_battle():attacker():routed_in_battle())) or  ((char_is_defender(context:character())) and (defender_victory(context:character():model():pending_battle())) and (context:character():model():pending_battle():defender_commander_fought_in_battle()) and not (context:character():model():pending_battle():defender():routed_in_battle())))
end 

events.CharacterCompletedBattle[#events.CharacterCompletedBattle+1] =
function (context)
	if r2_sp_trait_all_fervour_impl(context) then
		effect.trait("r2_sp_trait_all_fervour", "agent", 1, 30, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_gambling ]]--

function r2_sp_trait_all_gambling_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and context:character():has_garrison_residence() and (garrison_has_building(context:character():garrison_residence(), "rom_EASTERN_city_slot_entertainment_2") or garrison_has_building(context:character():garrison_residence(), "rom_EASTERN_city_slot_entertainment_3") or garrison_has_building(context:character():garrison_residence(), "rom_EASTERN_city_slot_entertainment_4") or garrison_has_building(context:character():garrison_residence(), "rom_HELLENIC_agora_entertainment_2") or garrison_has_building(context:character():garrison_residence(), "rom_HELLENIC_agora_entertainment_3") or garrison_has_building(context:character():garrison_residence(), "rom_HELLENIC_agora_entertainment_4") or garrison_has_building(context:character():garrison_residence(), "rom_ROMAN_forum_entertainment_2") or garrison_has_building(context:character():garrison_residence(), "rom_ROMAN_forum_entertainment_3") or garrison_has_building(context:character():garrison_residence(), "rom_ROMAN_forum_entertainment_4") or garrison_has_building(context:character():garrison_residence(), "rom_ROMAN_forum_entertainment_circus_5") or garrison_has_building(context:character():garrison_residence(), "rom_ROMAN_forum_entertainment_colosseum_5")) 
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_all_gambling_impl(context) then
		effect.trait("r2_sp_trait_all_gambling", "agent", 1, 10, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_hates_barbarians ]]--

function r2_sp_trait_all_hates_barbarians_impl (context)
		return char_is_general_with_army(context:character()) and ((char_is_defender(context:character()) and context:character():model():pending_battle():has_attacker() and context:character():model():pending_battle():attacker():faction():culture() == "rom_Barbarian" and not context:character():model():pending_battle():defender():faction():culture() == "rom_Barbarian" and context:character():model():pending_battle():percentage_of_defender_killed() <= 60 and attacker_victory(context:character():model():pending_battle())) or (char_is_attacker(context:character()) and context:character():model():pending_battle():has_defender() and context:character():model():pending_battle():defender():faction():culture() == "rom_Barbarian" and not context:character():model():pending_battle():attacker():faction():culture() == "rom_Barbarian" and context:character():model():pending_battle():percentage_of_attacker_killed() <= 60 and defender_victory(context:character():model():pending_battle())))
end 

events.CharacterCompletedBattle[#events.CharacterCompletedBattle+1] =
function (context)
	if r2_sp_trait_all_hates_barbarians_impl(context) then
		effect.trait("r2_sp_trait_all_hates_barbarians", "agent", 1, 20, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_hates_carthage ]]--

function r2_sp_trait_all_hates_carthage_impl (context)
		return char_is_general_with_army(context:character()) and ((char_is_defender(context:character()) and context:character():model():pending_battle():has_attacker() and context:character():model():pending_battle():attacker():faction():subculture() == "sc_rom_carthaginian" and not context:character():model():pending_battle():defender():faction():subculture() == "sc_rom_carthaginian" and context:character():model():pending_battle():percentage_of_defender_killed() < 60 and attacker_victory(context:character():model():pending_battle())) or (char_is_attacker(context:character()) and context:character():model():pending_battle():has_defender() and context:character():model():pending_battle():defender():faction():subculture() == "sc_rom_carthaginian" and not context:character():model():pending_battle():attacker():faction():subculture() == "sc_rom_carthaginian" and context:character():model():pending_battle():percentage_of_attacker_killed() < 60 and defender_victory(context:character():model():pending_battle())))
end 

events.CharacterCompletedBattle[#events.CharacterCompletedBattle+1] =
function (context)
	if r2_sp_trait_all_hates_carthage_impl(context) then
		effect.trait("r2_sp_trait_all_hates_carthage", "agent", 1, 20, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_hates_easterners ]]--

function r2_sp_trait_all_hates_easterners_impl (context)
		return char_is_general_with_army(context:character()) and ((char_is_defender(context:character()) and context:character():model():pending_battle():has_attacker() and context:character():model():pending_battle():attacker():faction():culture() == "rom_Eastern" and not context:character():model():pending_battle():defender():faction():culture() == "rom_Eastern" and context:character():model():pending_battle():percentage_of_defender_killed() <= 60 and attacker_victory(context:character():model():pending_battle())) or (char_is_attacker(context:character()) and context:character():model():pending_battle():has_defender() and context:character():model():pending_battle():defender():faction():culture() == "rom_Eastern" and not context:character():model():pending_battle():attacker():faction():culture() == "rom_Eastern" and context:character():model():pending_battle():percentage_of_attacker_killed() <= 60 and defender_victory(context:character():model():pending_battle())))
end 

events.CharacterCompletedBattle[#events.CharacterCompletedBattle+1] =
function (context)
	if r2_sp_trait_all_hates_easterners_impl(context) then
		effect.trait("r2_sp_trait_all_hates_easterners", "agent", 1, 20, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_hates_egyptians ]]--

function r2_sp_trait_all_hates_egyptians_impl (context)
		return char_is_general_with_army(context:character()) and ((char_is_defender(context:character()) and context:character():model():pending_battle():has_attacker() and context:character():model():pending_battle():attacker():faction():subculture() == "sc_rom_egyptian" and not context:character():model():pending_battle():defender():faction():subculture() == "sc_rom_egyptian" and context:character():model():pending_battle():percentage_of_defender_killed() <= 60 and attacker_victory(context:character():model():pending_battle())) or (char_is_attacker(context:character()) and context:character():model():pending_battle():has_defender() and context:character():model():pending_battle():defender():faction():subculture() == "sc_rom_egyptian" and not context:character():model():pending_battle():attacker():faction():subculture() == "sc_rom_egyptian" and context:character():model():pending_battle():percentage_of_attacker_killed() <= 60 and defender_victory(context:character():model():pending_battle())))
end 

events.CharacterCompletedBattle[#events.CharacterCompletedBattle+1] =
function (context)
	if r2_sp_trait_all_hates_egyptians_impl(context) then
		effect.trait("r2_sp_trait_all_hates_egyptians", "agent", 1, 20, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_hates_greeks ]]--

function r2_sp_trait_all_hates_greeks_impl (context)
		return char_is_general_with_army(context:character()) and ((char_is_defender(context:character()) and context:character():model():pending_battle():has_attacker() and is_in_state_list((context:character():model():pending_battle():attacker()), greek_states_factions) and not is_in_state_list((context:character():model():pending_battle():defender()), greek_states_factions) and context:character():model():pending_battle():percentage_of_defender_killed() <= 60 and attacker_victory(context:character():model():pending_battle())) or (char_is_attacker(context:character()) and context:character():model():pending_battle():has_defender() and is_in_state_list((context:character():model():pending_battle():defender()), greek_states_factions) and not is_in_state_list((context:character():model():pending_battle():attacker()), greek_states_factions) and context:character():model():pending_battle():percentage_of_attacker_killed() <= 60 and defender_victory(context:character():model():pending_battle())))
end 

events.CharacterCompletedBattle[#events.CharacterCompletedBattle+1] =
function (context)
	if r2_sp_trait_all_hates_greeks_impl(context) then
		effect.trait("r2_sp_trait_all_hates_greeks", "agent", 1, 20, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_hates_romans ]]--

function r2_sp_trait_all_hates_romans_impl (context)
		return char_is_general_with_army(context:character()) and ((char_is_defender(context:character()) and context:character():model():pending_battle():has_attacker() and context:character():model():pending_battle():attacker():faction():subculture() == "sc_rom_roman" and not context:character():model():pending_battle():defender():faction():subculture() == "sc_rom_roman" and context:character():model():pending_battle():percentage_of_defender_killed() <= 60 and attacker_victory(context:character():model():pending_battle())) or (char_is_attacker(context:character()) and context:character():model():pending_battle():has_defender() and context:character():model():pending_battle():defender():faction():subculture() == "sc_rom_roman" and not context:character():model():pending_battle():attacker():faction():subculture() == "sc_rom_roman" and context:character():model():pending_battle():percentage_of_attacker_killed() <= 60 and defender_victory(context:character():model():pending_battle())))
end 

events.CharacterCompletedBattle[#events.CharacterCompletedBattle+1] =
function (context)
	if r2_sp_trait_all_hates_romans_impl(context) then
		effect.trait("r2_sp_trait_all_hates_romans", "agent", 1, 20, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_hates_successors ]]--

function r2_sp_trait_all_hates_successors_impl (context)
		return char_is_general_with_army(context:character()) and ((char_is_defender(context:character()) and context:character():model():pending_battle():has_attacker() and is_in_state_list((context:character():model():pending_battle():attacker()), successor_states_factions) and not is_in_state_list((context:character():model():pending_battle():defender()), successor_states_factions) and context:character():model():pending_battle():percentage_of_defender_killed() <= 60 and attacker_victory(context:character():model():pending_battle())) or (char_is_attacker(context:character()) and context:character():model():pending_battle():has_defender() and is_in_state_list((context:character():model():pending_battle():defender()), successor_states_factions) and not is_in_state_list((context:character():model():pending_battle():attacker()), successor_states_factions) and context:character():model():pending_battle():percentage_of_attacker_killed() <= 60 and defender_victory(context:character():model():pending_battle())))
end 

events.CharacterCompletedBattle[#events.CharacterCompletedBattle+1] =
function (context)
	if r2_sp_trait_all_hates_successors_impl(context) then
		effect.trait("r2_sp_trait_all_hates_successors", "agent", 1, 20, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_healthy ]]--

function r2_sp_trait_all_healthy_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and context:character():has_garrison_residence() and garrison_has_building_superchain(context:character():garrison_residence(),  "rom_Sanitation") and not garrison_has_building_superchain(context:character():garrison_residence(),  "rom_Slum") 
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_all_healthy_impl(context) then
		effect.trait("r2_sp_trait_all_healthy", "agent", 1, 20, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_honest ]]--

function r2_sp_trait_all_honest_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and context:character():has_garrison_residence() and context:character():garrison_residence():region():public_order() >= 95
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_all_honest_impl(context) then
		effect.trait("r2_sp_trait_all_honest", "agent", 1, 3, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_infertile ]]--

function r2_sp_trait_all_infertile_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_all_infertile_impl(context) then
		effect.trait("r2_sp_trait_all_infertile", "agent", 1, 2, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_lazy ]]--

function r2_sp_trait_all_lazy_impl (context)
		return char_is_general(context:character()) and context:character():has_garrison_residence() and context:character():action_points_remaining_percent() == 100
end 

events.CharacterTurnEnd[#events.CharacterTurnEnd+1] =
function (context)
	if r2_sp_trait_all_lazy_impl(context) then
		effect.trait("r2_sp_trait_all_lazy", "agent", 1, 5, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_leader_architect ]]--

function r2_sp_trait_all_leader_architect_impl (context)
		return true
end 

events.BuildingCompleted[#events.BuildingCompleted+1] =
function (context)
	if r2_sp_trait_all_leader_architect_impl(context) then
		effect.trait("r2_sp_trait_all_leader_architect", "agent", 1, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_leader_farmer ]]--

function r2_sp_trait_all_leader_farmer_impl (context)
		return context:character():is_faction_leader() and context:character():has_garrison_residence() and (garrison_has_building_superchain(context:character():garrison_residence(), "rom_GENERIC_city_minor_grain") or garrison_has_building_superchain(context:character():garrison_residence(),  "rom_GENERIC_city_minor_olives")) 
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_all_leader_farmer_impl(context) then
		effect.trait("r2_sp_trait_all_leader_farmer", "agent", 1, 10, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_leader_kind ]]--

function r2_sp_trait_all_leader_kind_impl (context)
		return context:character():is_faction_leader() and char_is_general_with_army(context:character()) 
end 

events.CharacterPostBattleRelease[#events.CharacterPostBattleRelease+1] =
function (context)
	if r2_sp_trait_all_leader_kind_impl(context) then
		effect.trait("r2_sp_trait_all_leader_kind", "agent", 1, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_leader_lewd ]]--

function r2_sp_trait_all_leader_lewd_impl (context)
		return context:character():is_faction_leader() and context:character():has_garrison_residence() 
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_all_leader_lewd_impl(context) then
		effect.trait("r2_sp_trait_all_leader_lewd", "agent", 1, 1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_leader_mad ]]--

function r2_sp_trait_all_leader_mad_impl (context)
		return char_is_general(context:character()) and context:character():is_faction_leader() and ((context:character():has_trait("r2_sp_trait_civilized_religious")) or (context:character():has_trait("r2_sp_trait_all_noctophobia")) or (context:character():has_trait("r2_sp_trait_all_background_inbred")) or (context:character():has_trait("r2_sp_trait_all_background_very_inbred")) or (context:character():has_trait("r2_sp_trait_all_background_very_very_inbred")) or (context:character():has_trait("r2_sp_trait_barbarian_drink")) or (context:character():has_trait("r2_sp_trait_barbarian_religious")) or (context:character():has_trait("r2_sp_trait_civilised_blood_feud")) or (context:character():has_trait("r2_sp_trait_civilized_drink")) or (context:character():has_trait("r2_sp_trait_female_all_unhealthy")) or (context:character():has_trait("r2_sp_trait_female_barbarian_drink")) or (context:character():has_trait("r2_sp_trait_female_civilized_drink")) or (context:character():has_trait("r2_sp_trait_female_civilized_persecutor")) or (context:character():has_trait("r2_sp_trait_female_roman_drink")) or (context:character():has_trait("r2_sp_trait_rome_mad")) or (context:character():has_trait("r2_sp_trait_roman_drink")) or (context:character():has_trait("r2_sp_trait_roman_proscriptor")) or (context:character():has_trait("r2_sp_trait_all_leader_paranoid")))
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_all_leader_mad_impl(context) then
		effect.trait("r2_sp_trait_all_leader_mad", "agent", 1, 1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_leader_miner ]]--

function r2_sp_trait_all_leader_miner_impl (context)
		return context:character():is_faction_leader() and context:character():has_garrison_residence() and (garrison_has_building_superchain(context:character():garrison_residence(), "rom_GENERIC_city_minor_gold") or garrison_has_building_superchain(context:character():garrison_residence(),  "rom_GENERIC_city_minor_iron") or garrison_has_building_superchain(context:character():garrison_residence(),  "rom_GENERIC_city_minor_silver")) 
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_all_leader_miner_impl(context) then
		effect.trait("r2_sp_trait_all_leader_miner", "agent", 1, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_leader_miser ]]--

function r2_sp_trait_all_leader_miser_impl (context)
		return context:character():is_faction_leader() and context:character():faction():treasury() >= 5000 and context:character():faction():tax_level() >= 100 and context:character():faction():upkeep_expenditure_percent() <= 50 and faction_contains_building(context:character():faction(), "rom_Slum")
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_all_leader_miser_impl(context) then
		effect.trait("r2_sp_trait_all_leader_miser", "agent", 1, 10, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_leader_paranoid ]]--

function r2_sp_trait_all_leader_paranoid_impl (context)
		return char_is_general(context:character()) and context:character():is_faction_leader() and context:character():has_garrison_residence() and context:character():garrison_residence():region():public_order() <= -50
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_all_leader_paranoid_impl(context) then
		effect.trait("r2_sp_trait_all_leader_paranoid", "agent", 1, 1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_leader_spender ]]--

function r2_sp_trait_all_leader_spender_impl (context)
		return context:character():is_faction_leader() and context:character():faction():treasury() <= 1500 and context:character():faction():upkeep_expenditure_percent() >= 75 and not faction_contains_building(context:character():faction(), "rom_Slum")
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_all_leader_spender_impl(context) then
		effect.trait("r2_sp_trait_all_leader_spender", "agent", 1, 10, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_leader_spymaster ]]--

function r2_sp_trait_all_leader_spymaster_impl (context)
		return context:character():is_faction_leader() and current_faction_spies_recruited_this_turn >= 1
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_all_leader_spymaster_impl(context) then
		effect.trait("r2_sp_trait_all_leader_spymaster", "agent", 1, 5, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_leader_taxman ]]--

function r2_sp_trait_all_leader_taxman_impl (context)
		return context:character():is_faction_leader() and context:character():faction():tax_level() >=115
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_all_leader_taxman_impl(context) then
		effect.trait("r2_sp_trait_all_leader_taxman", "agent", 1, 3, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_leader_trader ]]--

function r2_sp_trait_all_leader_trader_impl (context)
		return context:character():is_faction_leader() and context:character():faction():trade_value_percent() >=110
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_all_leader_trader_impl(context) then
		effect.trait("r2_sp_trait_all_leader_trader", "agent", 1, 3, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_leader_unjust ]]--

function r2_sp_trait_all_leader_unjust_impl (context)
		return true
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_all_leader_unjust_impl(context) then
		effect.trait("r2_sp_trait_all_leader_unjust", "agent", 1, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_likes_barbarians ]]--

function r2_sp_trait_all_likes_barbarians_impl (context)
		return char_is_general(context:character()) and faction_allied_with_state_list(context:character():faction(),barbarian_states_factions) and not is_in_state_list((context:character()), barbarian_states_factions)
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_all_likes_barbarians_impl(context) then
		effect.trait("r2_sp_trait_all_likes_barbarians", "agent", 1, 10, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_likes_carthage ]]--

function r2_sp_trait_all_likes_carthage_impl (context)
		return char_is_general(context:character()) and (faction_allied_with_state(context:character():faction(), "rom_carthage") or faction_allied_with_state(context:character():faction(), "rom_libya") or faction_allied_with_state(context:character():faction(), "rom_nova_carthago") or faction_allied_with_state(context:character():faction(), "rom_rebel_punic")) and not (context:character():faction():name() == "rom_carthage" or context:character():faction():name() =="rom_libya" or context:character():faction():name() == "rom_nova_carthago")
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_all_likes_carthage_impl(context) then
		effect.trait("r2_sp_trait_all_likes_carthage", "agent", 1, 10, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_likes_easterners ]]--

function r2_sp_trait_all_likes_easterners_impl (context)
		return char_is_general(context:character())and faction_allied_with_state_list(context:character():faction(),eastern_states_factions) and not is_in_state_list((context:character()), eastern_states_factions)
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_all_likes_easterners_impl(context) then
		effect.trait("r2_sp_trait_all_likes_easterners", "agent", 1, 10, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_likes_egyptians ]]--

function r2_sp_trait_all_likes_egyptians_impl (context)
		return char_is_general(context:character()) and (faction_allied_with_state(context:character():faction(), "rom_ptolemaics") or faction_allied_with_state(context:character():faction(), "rom_rebel_egyptian")) and not (context:character():faction():name() == "rom_ptolemaics" or context:character():faction():name() == "rom_rebel_egyptian")
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_all_likes_egyptians_impl(context) then
		effect.trait("r2_sp_trait_all_likes_egyptians", "agent", 1, 10, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_likes_greeks ]]--

function r2_sp_trait_all_likes_greeks_impl (context)
		return char_is_general(context:character()) and faction_allied_with_state_list(context:character():faction(),greek_states_factions) and not is_in_state_list((context:character()), greek_states_factions)
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_all_likes_greeks_impl(context) then
		effect.trait("r2_sp_trait_all_likes_greeks", "agent", 1, 10, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_likes_romans_1 ]]--

function r2_sp_trait_all_likes_romans_1_impl (context)
		return char_is_general(context:character()) and faction_allied_with_state_list(context:character():faction(),roman_states_factions) and not is_in_state_list((context:character()), roman_states_factions)
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_all_likes_romans_1_impl(context) then
		effect.trait("r2_sp_trait_all_likes_romans", "agent", 1, 10, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_likes_successors ]]--

function r2_sp_trait_all_likes_successors_impl (context)
		return char_is_general(context:character()) and faction_allied_with_state_list(context:character():faction(),successor_states_factions) and not is_in_state_list((context:character()), successor_states_factions)
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_all_likes_successors_impl(context) then
		effect.trait("r2_sp_trait_all_likes_successors", "agent", 1, 10, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_looter ]]--

function r2_sp_trait_all_looter_impl (context)
		return char_is_general(context:character()) 
end 

events.CharacterLootedSettlement[#events.CharacterLootedSettlement+1] =
function (context)
	if r2_sp_trait_all_looter_impl(context) then
		effect.trait("r2_sp_trait_all_looter", "agent", 1, 50, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_negotiator ]]--

function r2_sp_trait_all_negotiator_impl (context)
		return true
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_all_negotiator_impl(context) then
		effect.trait("r2_sp_trait_all_negotiator", "agent", 1, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_noctophilia ]]--

function r2_sp_trait_all_noctophilia_impl (context)
		return char_is_general(context:character()) and char_has_army(context:character()) and context:character():model():pending_battle():night_battle() and ((char_is_attacker(context:character()) and attacker_victory(context:character():model():pending_battle()) and not (context:character():has_trait("r2_sp_trait_all_noctophobia"))) or (char_is_defender(context:character()) and defender_victory(context:character():model():pending_battle()) and not (context:character():has_trait("r2_sp_trait_all_noctophobia"))))
end 

events.CharacterCompletedBattle[#events.CharacterCompletedBattle+1] =
function (context)
	if r2_sp_trait_all_noctophilia_impl(context) then
		effect.trait("r2_sp_trait_all_noctophilia", "agent", 1, 50, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_noctophobia ]]--

function r2_sp_trait_all_noctophobia_impl (context)
		return char_is_general(context:character()) and char_has_army(context:character()) and context:character():model():pending_battle():night_battle() and ((char_is_attacker(context:character()) and defender_victory(context:character():model():pending_battle()) and not (context:character():has_trait("r2_sp_trait_all_noctophilia"))) or (char_is_defender(context:character()) and attacker_victory(context:character():model():pending_battle()) and not (context:character():has_trait("r2_sp_trait_all_noctophilia"))))
end 

events.CharacterCompletedBattle[#events.CharacterCompletedBattle+1] =
function (context)
	if r2_sp_trait_all_noctophobia_impl(context) then
		effect.trait("r2_sp_trait_all_noctophobia", "agent", 1, 50, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_non_roman_agent_deployed_friendly_civil_admin_success_trigger ]]--

function r2_sp_trait_all_non_roman_agent_deployed_friendly_civil_admin_success_trigger_impl (context)
		return context:character():character_type("dignitary") and context:character():faction():name()~=("rom_rome") and char_in_owned_region(context:character())
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_all_non_roman_agent_deployed_friendly_civil_admin_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_non_roman_agent_deployed_friendly_civil_admin", "agent", 1, 30, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_personal_bravery ]]--

function r2_sp_trait_all_personal_bravery_impl (context)
		return char_is_general(context:character()) and char_has_army(context:character()) and (context:character():fought_in_battle()) and ((char_is_attacker(context:character()) and attacker_victory(context:character():model():pending_battle()) and (context:character():model():pending_battle():attacker():body_guard_casulties() >= 0.2)) or (char_is_defender(context:character()) and defender_victory(context:character():model():pending_battle()) and (context:character():model():pending_battle():defender():body_guard_casulties() >= 0.2))) 
end 

events.CharacterCompletedBattle[#events.CharacterCompletedBattle+1] =
function (context)
	if r2_sp_trait_all_personal_bravery_impl(context) then
		effect.trait("r2_sp_trait_all_personal_bravery", "agent", 1, 30, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_personal_cowardice ]]--

function r2_sp_trait_all_personal_cowardice_impl (context)
		return char_is_general_with_army(context:character()) and ((char_is_attacker(context:character()) and context:character():model():pending_battle():attacker():routed_in_battle()) or (char_is_defender(context:character()) and context:character():model():pending_battle():defender():routed_in_battle()))
end 

events.CharacterCompletedBattle[#events.CharacterCompletedBattle+1] =
function (context)
	if r2_sp_trait_all_personal_cowardice_impl(context) then
		effect.trait("r2_sp_trait_all_personal_cowardice", "agent", 1, 30, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_personal_survival ]]--

function r2_sp_trait_all_personal_survival_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and char_has_army(context:character()) and (context:character():fought_in_battle()) and ((char_is_attacker(context:character()) and (context:character():model():pending_battle():attacker():body_guard_casulties() >= 0.75)) or (char_is_defender(context:character()) and (context:character():model():pending_battle():defender():body_guard_casulties() >= 0.75))) 
end 

events.CharacterCompletedBattle[#events.CharacterCompletedBattle+1] =
function (context)
	if r2_sp_trait_all_personal_survival_impl(context) then
		effect.trait("r2_sp_trait_all_personal_survival", "agent", 1, 30, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_roman_agent_admin ]]--

function r2_sp_trait_all_roman_agent_admin_impl (context)
		return context:character():character_type("dignitary") and context:character():is_embedded_in_military_force() and context:character():faction():name()~=("rom_rome")
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_all_roman_agent_admin_impl(context) then
		effect.trait("r2_sp_trait_all_roman_agent_admin", "agent", 1, 30, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_siege_defender_bad ]]--

function r2_sp_trait_all_siege_defender_bad_impl (context)
		return char_is_general(context:character()) and char_has_army(context:character()) and char_is_defender(context:character()) and context:character():model():pending_battle():seige_battle() and attacker_victory(context:character():model():pending_battle()) and (context:character():defensive_sieges_won() <= (context:character():defensive_sieges_fought() * 0.4))
end 

events.CharacterCompletedBattle[#events.CharacterCompletedBattle+1] =
function (context)
	if r2_sp_trait_all_siege_defender_bad_impl(context) then
		effect.trait("r2_sp_trait_all_siege_defender_bad", "agent", 1, 30, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_tactician ]]--

function r2_sp_trait_all_tactician_impl (context)
		return char_is_general(context:character()) and (context:skill_point_spent_on() == "general_strategist_1" or context:skill_point_spent_on() == "general_strategist_2_navigator" or context:skill_point_spent_on() == "general_strategist_2_tactician" or context:skill_point_spent_on() =="general_strategist_3_administration" or context:skill_point_spent_on() =="general_strategist_3_covert_action" or context:skill_point_spent_on() =="general_strategist_3_logistics" or context:skill_point_spent_on() =="general_strategist_3_mercenary" or context:skill_point_spent_on() =="general_strategist_3_siegecraft" or context:skill_point_spent_on() =="general_strategist_3_master_tactician") 
end 

events.CharacterSkillPointAllocated[#events.CharacterSkillPointAllocated+1] =
function (context)
	if r2_sp_trait_all_tactician_impl(context) then
		effect.trait("r2_sp_trait_all_tactician", "agent", 1, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_all_unhealthy ]]--

function r2_sp_trait_all_unhealthy_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and context:character():has_garrison_residence() and not garrison_has_building_superchain(context:character():garrison_residence(), "rom_Sanitation") and garrison_has_building_superchain(context:character():garrison_residence(), "rom_Slum") 
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_all_unhealthy_impl(context) then
		effect.trait("r2_sp_trait_all_unhealthy", "agent", 1, 10, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_barbarian_berserker ]]--

function r2_sp_trait_barbarian_berserker_impl (context)
		return char_is_general(context:character()) and is_in_state_list((context:character()), barbarian_states_factions) and char_has_army(context:character()) and (context:character():fought_in_battle()) and ((char_is_attacker(context:character()) and attacker_victory(context:character():model():pending_battle()) and context:character():model():pending_battle():percentage_of_defender_killed() >= 0.75) or (char_is_defender(context:character()) and defender_victory(context:character():model():pending_battle()) and context:character():model():pending_battle():percentage_of_attacker_killed() >= 0.75)) 
end 

events.CharacterCompletedBattle[#events.CharacterCompletedBattle+1] =
function (context)
	if r2_sp_trait_barbarian_berserker_impl(context) then
		effect.trait("r2_sp_trait_barbarian_berserker", "agent", 1, 30, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_barbarian_blood_feud ]]--

function r2_sp_trait_barbarian_blood_feud_impl (context)
		return char_is_general(context:character()) and is_in_state_list((context:character()), barbarian_states_factions) and char_has_army(context:character()) and (context:character():fought_in_battle()) and ((char_is_attacker(context:character()) and (context:character():model():pending_battle():attacker():body_guard_casulties() >= 0.9)) or (char_is_defender(context:character()) and (context:character():model():pending_battle():defender():body_guard_casulties() >= 0.9))) 
end 

events.CharacterCompletedBattle[#events.CharacterCompletedBattle+1] =
function (context)
	if r2_sp_trait_barbarian_blood_feud_impl(context) then
		effect.trait("r2_sp_trait_barbarian_blood_feud", "agent", 1, 30, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_barbarian_drink ]]--

function r2_sp_trait_barbarian_drink_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and context:character():has_garrison_residence() and is_in_state_list((context:character()), barbarian_states_factions) and (garrison_has_building_superchain(context:character():garrison_residence(), "rom_GENERIC_city_minor_wine")) 
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_barbarian_drink_impl(context) then
		effect.trait("r2_sp_trait_barbarian_drink", "agent", 1, 1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_barbarian_girls ]]--

function r2_sp_trait_barbarian_girls_impl (context)
		return char_is_general(context:character()) and context:character():has_garrison_residence() and is_in_state_list((context:character()), barbarian_states_factions) 
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_barbarian_girls_impl(context) then
		effect.trait("r2_sp_trait_barbarian_girls", "agent", 1, 1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_barbarian_high_casualties ]]--

function r2_sp_trait_barbarian_high_casualties_impl (context)
		return char_is_general_with_army(context:character()) and is_in_state_list((context:character()), barbarian_states_factions) and ((char_is_attacker(context:character()) and (context:character():model():pending_battle():percentage_of_defender_killed() >= 0.75) and (context:character():model():pending_battle():percentage_of_attacker_killed() >= 0.5)) or (char_is_defender(context:character()) and (context:character():model():pending_battle():percentage_of_defender_killed() >= 0.5) and (context:character():model():pending_battle():percentage_of_attacker_killed() >= 0.75))) 
end 

events.CharacterCompletedBattle[#events.CharacterCompletedBattle+1] =
function (context)
	if r2_sp_trait_barbarian_high_casualties_impl(context) then
		effect.trait("r2_sp_trait_barbarian_high_casualties", "agent", 1, 15, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_barbarian_religious ]]--

function r2_sp_trait_barbarian_religious_impl (context)
		return (char_is_general(context:character()) or context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and is_in_state_list((context:character()), barbarian_states_factions) and context:character():has_garrison_residence() and (garrison_has_building_superchain(context:character():garrison_residence(), "rom_TempleMajor") or garrison_has_building_superchain(context:character():garrison_residence(), "rom_TempleLocal") or garrison_has_building_superchain(context:character():garrison_residence(), "rom_TempleMinor") or garrison_has_building_superchain(context:character():garrison_residence(), "rom_GENERIC_city_minor_holy_site")) 
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_barbarian_religious_impl(context) then
		effect.trait("r2_sp_trait_barbarian_religious", "agent", 1, 5, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_barbarian_sober ]]--

function r2_sp_trait_barbarian_sober_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and context:character():has_garrison_residence() and is_in_state_list((context:character()), barbarian_states_factions) and not garrison_has_building_superchain(context:character():garrison_residence(), "rom_GENERIC_city_minor_wine") 
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_barbarian_sober_impl(context) then
		effect.trait("r2_sp_trait_barbarian_sober", "agent", 1, 1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_barbarian_sweary ]]--

function r2_sp_trait_barbarian_sweary_impl (context)
		return char_is_general_with_army(context:character()) and is_in_state_list((context:character()), barbarian_states_factions) and context:character():is_male() and not context:character():has_garrison_residence() 
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_barbarian_sweary_impl(context) then
		effect.trait("r2_sp_trait_barbarian_sweary", "agent", 1, 1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_ch_carthage ]]--

function r2_sp_trait_ch_carthage_impl (context)
		return true
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_ch_carthage_impl(context) then
		effect.trait("r2_sp_trait_ch_carthage", "agent", 1, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_ch_celtic ]]--

function r2_sp_trait_ch_celtic_impl (context)
		return true
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_ch_celtic_impl(context) then
		effect.trait("r2_sp_trait_ch_celtic", "agent", 1, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_ch_east_A ]]--

function r2_sp_trait_ch_east_A_impl (context)
		return true
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_ch_east_A_impl(context) then
		effect.trait("r2_sp_trait_ch_east_A", "agent", 1, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_ch_east_B ]]--

function r2_sp_trait_ch_east_B_impl (context)
		return true
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_ch_east_B_impl(context) then
		effect.trait("r2_sp_trait_ch_east_B", "agent", 1, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_ch_german ]]--

function r2_sp_trait_ch_german_impl (context)
		return true
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_ch_german_impl(context) then
		effect.trait("r2_sp_trait_ch_german", "agent", 1, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_ch_hellenic ]]--

function r2_sp_trait_ch_hellenic_impl (context)
		return true
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_ch_hellenic_impl(context) then
		effect.trait("r2_sp_trait_ch_hellenic", "agent", 1, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_ch_hellenic_athens ]]--

function r2_sp_trait_ch_hellenic_athens_impl (context)
		return true
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_ch_hellenic_athens_impl(context) then
		effect.trait("r2_sp_trait_ch_hellenic_athens", "agent", 1, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_ch_hellenic_sparta ]]--

function r2_sp_trait_ch_hellenic_sparta_impl (context)
		return true
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_ch_hellenic_sparta_impl(context) then
		effect.trait("r2_sp_trait_ch_hellenic_sparta", "agent", 1, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_ch_ptolemaic ]]--

function r2_sp_trait_ch_ptolemaic_impl (context)
		return true
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_ch_ptolemaic_impl(context) then
		effect.trait("r2_sp_trait_ch_ptolemaic", "agent", 1, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_ch_roman ]]--

function r2_sp_trait_ch_roman_impl (context)
		return true
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_ch_roman_impl(context) then
		effect.trait("r2_sp_trait_ch_roman", "agent", 1, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_ch_roman_variant_1 ]]--

function r2_sp_trait_ch_roman_variant_1_impl (context)
		return true
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_ch_roman_variant_1_impl(context) then
		effect.trait("r2_sp_trait_ch_roman_variant_1", "agent", 1, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_civilised_agent_zeal ]]--

function r2_sp_trait_civilised_agent_zeal_impl (context)
		return (char_is_general(context:character()) or context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and not is_in_state_list((context:character()), barbarian_states_factions) and (context:mission_result_success() or context:mission_result_critial_success()) and not context:character():is_male()
end 

events.CharacterCharacterTargetAction[#events.CharacterCharacterTargetAction+1] =
function (context)
	if r2_sp_trait_civilised_agent_zeal_impl(context) then
		effect.trait("r2_sp_trait_civilised_agent_zeal", "agent", 1, 30, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_civilised_blood_feud ]]--

function r2_sp_trait_civilised_blood_feud_impl (context)
		return char_is_general(context:character()) and not is_in_state_list((context:character()), barbarian_states_factions) and char_has_army(context:character()) and (context:character():fought_in_battle()) and ((char_is_attacker(context:character()) and (context:character():model():pending_battle():attacker():body_guard_casulties() >= 0.9)) or (char_is_defender(context:character()) and (context:character():model():pending_battle():defender():body_guard_casulties() >= 0.9))) 
end 

events.CharacterCompletedBattle[#events.CharacterCompletedBattle+1] =
function (context)
	if r2_sp_trait_civilised_blood_feud_impl(context) then
		effect.trait("r2_sp_trait_civilised_blood_feud", "agent", 1, 30, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_civilised_disciplinarian_bad ]]--

function r2_sp_trait_civilised_disciplinarian_bad_impl (context)
		return char_is_general_with_army(context:character()) and not is_in_state_list((context:character()), barbarian_states_factions) and (context:character():has_trait("r2_sp_trait_civilized_drink") or context:character():has_trait("r2_sp_trait_all_personal_cowardice") or context:character():has_trait("r2_sp_trait_rome_mad") or context:character():has_trait("r2_sp_trait_all_leader_mad") or context:character():has_trait("r2_sp_trait_all_mad") or context:character():has_trait("r2_sp_trait_all_lazy")) 
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_civilised_disciplinarian_bad_impl(context) then
		effect.trait("r2_sp_trait_civilised_disciplinarian_bad", "agent", 1, 5, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_civilised_high_casualties ]]--

function r2_sp_trait_civilised_high_casualties_impl (context)
		return char_is_general_with_army(context:character()) and not is_in_state_list((context:character()), barbarian_states_factions) and ((char_is_attacker(context:character()) and (context:character():model():pending_battle():percentage_of_defender_killed() >= 0.9) and (context:character():model():pending_battle():percentage_of_attacker_killed() >= 0.7)) or (char_is_defender(context:character()) and (context:character():model():pending_battle():percentage_of_defender_killed() >= 0.7) and (context:character():model():pending_battle():percentage_of_attacker_killed() >= 0.9))) 
end 

events.CharacterCompletedBattle[#events.CharacterCompletedBattle+1] =
function (context)
	if r2_sp_trait_civilised_high_casualties_impl(context) then
		effect.trait("r2_sp_trait_civilised_high_casualties", "agent", 1, 15, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_civilised_leader_harsh ]]--

function r2_sp_trait_civilised_leader_harsh_impl (context)
		return context:character():is_faction_leader() and char_is_general_with_army(context:character())
end 

events.CharacterPostBattleSlaughter[#events.CharacterPostBattleSlaughter+1] =
function (context)
	if r2_sp_trait_civilised_leader_harsh_impl(context) then
		effect.trait("r2_sp_trait_civilised_leader_harsh", "agent", 1, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_civilised_politician ]]--

function r2_sp_trait_civilised_politician_impl (context)
		return true
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_civilised_politician_impl(context) then
		effect.trait("r2_sp_trait_civilised_politician", "agent", 1, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_civilised_sweary ]]--

function r2_sp_trait_civilised_sweary_impl (context)
		return char_is_general_with_army(context:character()) and not is_in_state_list((context:character()), barbarian_states_factions) and context:character():is_male() and not context:character():has_garrison_residence() 
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_civilised_sweary_impl(context) then
		effect.trait("r2_sp_trait_civilised_sweary", "agent", 1, 1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_civilized_adulterer ]]--

function r2_sp_trait_civilized_adulterer_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and context:character():has_garrison_residence() and not is_in_state_list((context:character()), barbarian_states_factions) 
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_civilized_adulterer_impl(context) then
		effect.trait("r2_sp_trait_civilized_adulterer", "agent", 1, 1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_civilized_arse ]]--

function r2_sp_trait_civilized_arse_impl (context)
		return char_is_general(context:character()) and context:character():has_garrison_residence() and not is_in_state_list((context:character()), barbarian_states_factions) 
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_civilized_arse_impl(context) then
		effect.trait("r2_sp_trait_civilized_arse", "agent", 1, 1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_civilized_atheist ]]--

function r2_sp_trait_civilized_atheist_impl (context)
		return char_is_general(context:character()) and not is_in_state_list((context:character()), barbarian_states_factions) and context:character():has_garrison_residence() and not ((garrison_has_building_superchain(context:character():garrison_residence(), "rom_TempleMajor")) or not (garrison_has_building_superchain(context:character():garrison_residence(), "rom_TempleLocal")) or not (garrison_has_building_superchain(context:character():garrison_residence(), "rom_TempleMinor")) or not (garrison_has_building_superchain(context:character():garrison_residence(), "rom_GENERIC_city_minor_holy_site"))) 
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_civilized_atheist_impl(context) then
		effect.trait("r2_sp_trait_civilized_atheist", "agent", 1, 20, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_civilized_drink ]]--

function r2_sp_trait_civilized_drink_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and context:character():has_garrison_residence() and not is_in_state_list((context:character()), barbarian_states_factions) and garrison_has_building_superchain(context:character():garrison_residence(), "rom_GENERIC_city_minor_wine") 
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_civilized_drink_impl(context) then
		effect.trait("r2_sp_trait_civilized_drink", "agent", 1, 1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_civilized_girls ]]--

function r2_sp_trait_civilized_girls_impl (context)
		return char_is_general(context:character()) and context:character():has_garrison_residence() and not is_in_state_list((context:character()), greek_states_factions) and not is_in_state_list((context:character()), barbarian_states_factions)
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_civilized_girls_impl(context) then
		effect.trait("r2_sp_trait_civilized_girls", "agent", 1, 1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_civilized_murderer ]]--

function r2_sp_trait_civilized_murderer_impl (context)
		return true
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_civilized_murderer_impl(context) then
		effect.trait("r2_sp_trait_civilized_murderer", "agent", 1, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_civilized_persecutor ]]--

function r2_sp_trait_civilized_persecutor_impl (context)
		return (char_is_general(context:character()) or context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and not is_in_state_list((context:character()), barbarian_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_civilized_persecutor_impl(context) then
		effect.trait("r2_sp_trait_civilized_persecutor", "agent", 1, 15, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_civilized_religious ]]--

function r2_sp_trait_civilized_religious_impl (context)
		return (char_is_general(context:character()) or context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and not is_in_state_list((context:character()), barbarian_states_factions) and context:character():has_garrison_residence() and  (garrison_has_building_superchain(context:character():garrison_residence(),"rom_TempleMajor") or garrison_has_building_superchain(context:character():garrison_residence(), "rom_TempleLocal") or garrison_has_building_superchain(context:character():garrison_residence(), "rom_TempleMinor") or garrison_has_building_superchain(context:character():garrison_residence(), "rom_GENERIC_city_minor_holy_site")) 
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_civilized_religious_impl(context) then
		effect.trait("r2_sp_trait_civilized_religious", "agent", 1, 5, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_civilized_sober ]]--

function r2_sp_trait_civilized_sober_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and context:character():has_garrison_residence() and not is_in_state_list((context:character()), barbarian_states_factions) and not garrison_has_building_superchain(context:character():garrison_residence(), "rom_GENERIC_city_minor_wine") 
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_civilized_sober_impl(context) then
		effect.trait("r2_sp_trait_civilized_sober", "agent", 1, 1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_civilized_xenophile ]]--

function r2_sp_trait_civilized_xenophile_impl (context)
		return char_is_general(context:character()) and context:character():faction():num_allies() >= 3 and not is_in_state_list((context:character()), barbarian_states_factions) 
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_civilized_xenophile_impl(context) then
		effect.trait("r2_sp_trait_civilized_xenophile", "agent", 1, 15, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_civilized_xenophobe ]]--

function r2_sp_trait_civilized_xenophobe_impl (context)
		return char_is_general(context:character()) and context:character():faction():num_allies() == 0 and context:character():faction():at_war() and not is_in_state_list((context:character()), barbarian_states_factions) 
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_civilized_xenophobe_impl(context) then
		effect.trait("r2_sp_trait_civilized_xenophobe", "agent", 1, 1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_eastern_leader_great_king ]]--

function r2_sp_trait_eastern_leader_great_king_impl (context)
		return char_is_general(context:character()) and context:character():is_faction_leader() and is_in_state_list((context:character()), eastern_states_factions) and (context:character():battles_won() >=  (context:character():battles_fought() * 0.8)) and context:character():faction():trade_value_percent() >=30
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_eastern_leader_great_king_impl(context) then
		effect.trait("r2_sp_trait_eastern_leader_great_king", "agent", 1, 15, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_all_agent_army_show_force_extraordinary_success_trigger ]]--

function r2_sp_trait_female_all_agent_army_show_force_extraordinary_success_trigger_impl (context)
		return context:character():character_type("champion") and context:ability() == "hinder_army" and context:attribute() == "authority" and context:mission_result_critial_success() and not context:character():is_male()
end 

events.CharacterCharacterTargetAction[#events.CharacterCharacterTargetAction+1] =
function (context)
	if r2_sp_trait_female_all_agent_army_show_force_extraordinary_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_female_all_agent_army_show_force", "agent", 2, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_all_agent_army_show_force_success_trigger ]]--

function r2_sp_trait_female_all_agent_army_show_force_success_trigger_impl (context)
		return context:character():character_type("champion") and context:ability() == "hinder_army" and context:attribute() == "authority" and context:mission_result_success() and not context:character():is_male()
end 

events.CharacterCharacterTargetAction[#events.CharacterCharacterTargetAction+1] =
function (context)
	if r2_sp_trait_female_all_agent_army_show_force_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_female_all_agent_army_show_force", "agent", 1, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_all_agent_character_assassin ]]--

function r2_sp_trait_female_all_agent_character_assassin_impl (context)
		return true
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_female_all_agent_character_assassin_impl(context) then
		effect.trait("r2_sp_trait_female_all_agent_character_assassin", "agent", 1, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_all_agent_character_kill_poison_extraordinary_success_trigger ]]--

function r2_sp_trait_female_all_agent_character_kill_poison_extraordinary_success_trigger_impl (context)
		return (context:character():character_type("spy")) and context:ability() == "hinder_character" and (context:attribute() == "subterfuge") and context:mission_result_critial_success() and not context:character():is_male()
end 

events.CharacterCharacterTargetAction[#events.CharacterCharacterTargetAction+1] =
function (context)
	if r2_sp_trait_female_all_agent_character_kill_poison_extraordinary_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_female_all_agent_character_kill_poison", "agent", 2, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_all_agent_character_kill_poison_success_trigger ]]--

function r2_sp_trait_female_all_agent_character_kill_poison_success_trigger_impl (context)
		return (context:character():character_type("spy")) and context:ability() == "hinder_character" and (context:attribute() == "subterfuge") and context:mission_result_success() and not context:character():is_male()
end 

events.CharacterCharacterTargetAction[#events.CharacterCharacterTargetAction+1] =
function (context)
	if r2_sp_trait_female_all_agent_character_kill_poison_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_female_all_agent_character_kill_poison", "agent", 1, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_all_agent_character_kill_single_combat_extraordinary_success_trigger ]]--

function r2_sp_trait_female_all_agent_character_kill_single_combat_extraordinary_success_trigger_impl (context)
		return (context:character():character_type("champion")) and context:ability() == "hinder_character" and (context:attribute() == "authority") and context:mission_result_critial_success() and not context:character():is_male()
end 

events.CharacterCharacterTargetAction[#events.CharacterCharacterTargetAction+1] =
function (context)
	if r2_sp_trait_female_all_agent_character_kill_single_combat_extraordinary_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_female_all_agent_character_kill_single_combat", "agent", 2, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_all_agent_character_kill_single_combat_success_trigger ]]--

function r2_sp_trait_female_all_agent_character_kill_single_combat_success_trigger_impl (context)
		return (context:character():character_type("champion")) and context:ability() == "hinder_character" and (context:attribute() == "authority") and context:mission_result_success() and not context:character():is_male()
end 

events.CharacterCharacterTargetAction[#events.CharacterCharacterTargetAction+1] =
function (context)
	if r2_sp_trait_female_all_agent_character_kill_single_combat_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_female_all_agent_character_kill_single_combat", "agent", 1, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_all_agent_deployed_foreign_corrupt_extraordinary_success_trigger ]]--

function r2_sp_trait_female_all_agent_deployed_foreign_corrupt_extraordinary_success_trigger_impl (context)
		return false
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_female_all_agent_deployed_foreign_corrupt_extraordinary_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_female_all_agent_deployed_foreign_corrupt", "agent", 2, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_all_agent_deployed_foreign_corrupt_success_trigger ]]--

function r2_sp_trait_female_all_agent_deployed_foreign_corrupt_success_trigger_impl (context)
		return false
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_female_all_agent_deployed_foreign_corrupt_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_female_all_agent_deployed_foreign_corrupt", "agent", 1, 30, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_all_agent_deployed_friendly_counterspy_succes_trigger ]]--

function r2_sp_trait_female_all_agent_deployed_friendly_counterspy_succes_trigger_impl (context)
		return (context:character():character_type("spy")) and context:character():is_deployed() and context:character():has_region() and char_in_owned_region(context:character()) and not context:character():is_male()
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_female_all_agent_deployed_friendly_counterspy_succes_trigger_impl(context) then
		effect.trait("r2_sp_trait_female_all_agent_deployed_friendly_counterspy", "agent", 1, 30, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_all_agent_passive_spy ]]--

function r2_sp_trait_female_all_agent_passive_spy_impl (context)
		return true
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_female_all_agent_passive_spy_impl(context) then
		effect.trait("r2_sp_trait_female_all_agent_passive_spy", "agent", 1, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_all_agent_settle_incite_unrest_extraordinary_success_trigger ]]--

function r2_sp_trait_female_all_agent_settle_incite_unrest_extraordinary_success_trigger_impl (context)
		return (context:character():character_type("dignitary")) and (context:ability() == "hinder_settlement") and (context:attribute() == "authority") and context:mission_result_critial_success() and not context:character():is_male()
end 

events.CharacterGarrisonTargetAction[#events.CharacterGarrisonTargetAction+1] =
function (context)
	if r2_sp_trait_female_all_agent_settle_incite_unrest_extraordinary_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_female_all_agent_settle_incite_unrest", "agent", 2, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_all_agent_settle_incite_unrest_success_trigger ]]--

function r2_sp_trait_female_all_agent_settle_incite_unrest_success_trigger_impl (context)
		return (context:character():character_type("dignitary")) and (context:ability() == "hinder_settlement") and (context:attribute() == "authority") and context:mission_result_success() and not context:character():is_male()
end 

events.CharacterGarrisonTargetAction[#events.CharacterGarrisonTargetAction+1] =
function (context)
	if r2_sp_trait_female_all_agent_settle_incite_unrest_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_female_all_agent_settle_incite_unrest", "agent", 1, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_all_agent_settle_promote_disorder_extraordinary_success_trigger ]]--

function r2_sp_trait_female_all_agent_settle_promote_disorder_extraordinary_success_trigger_impl (context)
		return (context:character():character_type("spy")) and (context:ability() == "hinder_settlement") and (context:attribute() == "authority") and context:mission_result_critial_success() and not context:character():is_male()
end 

events.CharacterGarrisonTargetAction[#events.CharacterGarrisonTargetAction+1] =
function (context)
	if r2_sp_trait_female_all_agent_settle_promote_disorder_extraordinary_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_female_all_agent_settle_promote_disorder", "agent", 2, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_all_agent_settle_promote_disorder_success_trigger ]]--

function r2_sp_trait_female_all_agent_settle_promote_disorder_success_trigger_impl (context)
		return (context:character():character_type("spy")) and (context:ability() == "hinder_settlement") and (context:attribute() == "authority") and context:mission_result_success() and not context:character():is_male()
end 

events.CharacterGarrisonTargetAction[#events.CharacterGarrisonTargetAction+1] =
function (context)
	if r2_sp_trait_female_all_agent_settle_promote_disorder_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_female_all_agent_settle_promote_disorder", "agent", 1, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_all_agent_settle_rally_slaves_extraordinary_success_trigger ]]--

function r2_sp_trait_female_all_agent_settle_rally_slaves_extraordinary_success_trigger_impl (context)
		return (context:character():character_type("champion")) and (context:ability() == "hinder_settlement") and (context:attribute() == "authority") and context:mission_result_critial_success() and not context:character():is_male()
end 

events.CharacterGarrisonTargetAction[#events.CharacterGarrisonTargetAction+1] =
function (context)
	if r2_sp_trait_female_all_agent_settle_rally_slaves_extraordinary_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_female_all_agent_settle_rally_slaves", "agent", 2, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_all_agent_settle_rally_slaves_success_trigger ]]--

function r2_sp_trait_female_all_agent_settle_rally_slaves_success_trigger_impl (context)
		return (context:character():character_type("champion")) and (context:ability() == "hinder_settlement") and (context:attribute() == "authority") and context:mission_result_success() and not context:character():is_male()
end 

events.CharacterGarrisonTargetAction[#events.CharacterGarrisonTargetAction+1] =
function (context)
	if r2_sp_trait_female_all_agent_settle_rally_slaves_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_female_all_agent_settle_rally_slaves", "agent", 1, 75, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_all_background_beautiful ]]--

function r2_sp_trait_female_all_background_beautiful_impl (context)
		return not context:character():is_male() and not (context:character():has_trait("r2_sp_trait_all_battle_scarred")) and not (context:character():has_trait("r2_sp_trait_all_background_inbred")) and not (context:character():has_trait("r2_sp_trait_all_background_very_inbred")) and not (context:character():has_trait("r2_sp_trait_all_background_very_very_inbred")) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_female_all_background_beautiful_impl(context) then
		effect.trait("r2_sp_trait_female_all_background_beautiful", "agent", 1, 2, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_all_background_bright ]]--

function r2_sp_trait_female_all_background_bright_impl (context)
		return not context:character():is_male() and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_female_all_background_bright_impl(context) then
		effect.trait("r2_sp_trait_female_all_background_bright", "agent", 1, 2, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_all_background_command ]]--

function r2_sp_trait_female_all_background_command_impl (context)
		return char_is_general(context:character()) and not context:character():is_male() and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_female_all_background_command_impl(context) then
		effect.trait("r2_sp_trait_female_all_background_command", "agent", 1, 2, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_all_background_slave ]]--

function r2_sp_trait_female_all_background_slave_impl (context)
		return (context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and not context:character():is_male() and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_female_all_background_slave_impl(context) then
		effect.trait("r2_sp_trait_female_all_background_slave", "agent", 1, 2, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_all_background_spy ]]--

function r2_sp_trait_female_all_background_spy_impl (context)
		return (context:character():character_type("spy")) and not context:character():is_male() and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_female_all_background_spy_impl(context) then
		effect.trait("r2_sp_trait_female_all_background_spy", "agent", 1, 2, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_all_healthy ]]--

function r2_sp_trait_female_all_healthy_impl (context)
		return (char_is_general(context:character()) or context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and not context:character():is_male() and context:character():has_garrison_residence() and garrison_has_building_superchain(context:character():garrison_residence(), "rom_Sanitation") and not garrison_has_building_superchain(context:character():garrison_residence(), "rom_Slum") 
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_female_all_healthy_impl(context) then
		effect.trait("r2_sp_trait_female_all_healthy", "agent", 1, 10, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_all_personal_survival ]]--

function r2_sp_trait_female_all_personal_survival_impl (context)
		return (char_is_general(context:character()) or context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and not context:character():is_male() and char_has_army(context:character()) and (context:character():fought_in_battle()) and ((char_is_attacker(context:character()) and (context:character():model():pending_battle():attacker():body_guard_casulties() >= 0.5)) or (char_is_defender(context:character()) and (context:character():model():pending_battle():defender():body_guard_casulties() >= 0.5))) 
end 

events.CharacterCompletedBattle[#events.CharacterCompletedBattle+1] =
function (context)
	if r2_sp_trait_female_all_personal_survival_impl(context) then
		effect.trait("r2_sp_trait_female_all_personal_survival", "agent", 1, 30, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_all_unhealthy ]]--

function r2_sp_trait_female_all_unhealthy_impl (context)
		return char_is_general(context:character()) and not context:character():is_male() and context:character():has_garrison_residence() and not garrison_has_building_superchain(context:character():garrison_residence(), "rom_Sanitation") and garrison_has_building_superchain(context:character():garrison_residence(), "rom_Slum") 
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_female_all_unhealthy_impl(context) then
		effect.trait("r2_sp_trait_female_all_unhealthy", "agent", 1, 10, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_barbarian_agent_zeal ]]--

function r2_sp_trait_female_barbarian_agent_zeal_impl (context)
		return (context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and not context:character():is_male() and is_in_state_list((context:character()), barbarian_states_factions) and (context:mission_result_success() or context:mission_result_critial_success())
end 

events.CharacterCharacterTargetAction[#events.CharacterCharacterTargetAction+1] =
function (context)
	if r2_sp_trait_female_barbarian_agent_zeal_impl(context) then
		effect.trait("r2_sp_trait_female_barbarian_agent_zeal", "agent", 1, 30, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_barbarian_blokes ]]--

function r2_sp_trait_female_barbarian_blokes_impl (context)
		return (context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and not context:character():is_male() and not context:character():is_male() and context:character():has_garrison_residence() and is_in_state_list((context:character()), barbarian_states_factions) 
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_female_barbarian_blokes_impl(context) then
		effect.trait("r2_sp_trait_female_barbarian_blokes", "agent", 1, 10, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_barbarian_drink ]]--

function r2_sp_trait_female_barbarian_drink_impl (context)
		return (context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and not context:character():is_male() and not context:character():is_male() and context:character():has_garrison_residence() and is_in_state_list((context:character()), barbarian_states_factions) and garrison_has_building_superchain(context:character():garrison_residence(), "rom_GENERIC_city_minor_wine") 
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_female_barbarian_drink_impl(context) then
		effect.trait("r2_sp_trait_female_barbarian_drink", "agent", 1, 1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_barbarian_sober ]]--

function r2_sp_trait_female_barbarian_sober_impl (context)
		return (context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and not context:character():is_male() and not context:character():is_male() and context:character():has_garrison_residence() and is_in_state_list((context:character()), barbarian_states_factions) and not garrison_has_building_superchain(context:character():garrison_residence(), "rom_GENERIC_city_minor_wine") 
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_female_barbarian_sober_impl(context) then
		effect.trait("r2_sp_trait_female_barbarian_sober", "agent", 1, 1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_civilised_agent_zeal ]]--

function r2_sp_trait_female_civilised_agent_zeal_impl (context)
		return (context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and not context:character():is_male() and not is_in_state_list((context:character()), barbarian_states_factions) and (context:mission_result_success() or context:mission_result_critial_success())
end 

events.CharacterCharacterTargetAction[#events.CharacterCharacterTargetAction+1] =
function (context)
	if r2_sp_trait_female_civilised_agent_zeal_impl(context) then
		effect.trait("r2_sp_trait_female_civilised_agent_zeal", "agent", 1, 30, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_civilized_adulterer ]]--

function r2_sp_trait_female_civilized_adulterer_impl (context)
		return (context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and not context:character():is_male() and not context:character():is_male() and context:character():has_garrison_residence() and is_in_state_list((context:character()), barbarian_states_factions) 
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_female_civilized_adulterer_impl(context) then
		effect.trait("r2_sp_trait_female_civilized_adulterer", "agent", 1, 1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_civilized_blokes ]]--

function r2_sp_trait_female_civilized_blokes_impl (context)
		return (context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and not context:character():is_male() and not context:character():is_male() and context:character():has_garrison_residence() and not is_in_state_list((context:character()), barbarian_states_factions) 
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_female_civilized_blokes_impl(context) then
		effect.trait("r2_sp_trait_female_civilized_blokes", "agent", 1, 10, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_civilized_drink ]]--

function r2_sp_trait_female_civilized_drink_impl (context)
		return (context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and not context:character():is_male() and context:character():has_garrison_residence() and is_in_state_list((context:character()), barbarian_states_factions) and garrison_has_building_superchain(context:character():garrison_residence(), "rom_GENERIC_city_minor_wine") 
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_female_civilized_drink_impl(context) then
		effect.trait("r2_sp_trait_female_civilized_drink", "agent", 1, 1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_civilized_murderer ]]--

function r2_sp_trait_female_civilized_murderer_impl (context)
		return true
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_female_civilized_murderer_impl(context) then
		effect.trait("r2_sp_trait_female_civilized_murderer", "agent", 1, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_civilized_persecutor ]]--

function r2_sp_trait_female_civilized_persecutor_impl (context)
		return (char_is_general(context:character()) or context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and not is_in_state_list((context:character()), barbarian_states_factions) and not context:character():is_male() and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_female_civilized_persecutor_impl(context) then
		effect.trait("r2_sp_trait_female_civilized_persecutor", "agent", 1, 5, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_civilized_sober ]]--

function r2_sp_trait_female_civilized_sober_impl (context)
		return (context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and not context:character():is_male() and context:character():has_garrison_residence() and not is_in_state_list((context:character()), barbarian_states_factions) and not garrison_has_building_superchain(context:character():garrison_residence(), "rom_GENERIC_city_minor_wine") 
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_female_civilized_sober_impl(context) then
		effect.trait("r2_sp_trait_female_civilized_sober", "agent", 1, 1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_greco_roman_humors_phlegm ]]--

function r2_sp_trait_female_greco_roman_humors_phlegm_impl (context)
		return (context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and not context:character():is_male() and is_in_state_list((context:character()), greco_roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_female_greco_roman_humors_phlegm_impl(context) then
		effect.trait("r2_sp_trait_female_greco_roman_humors_phlegm", "agent", 1, 15, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_roman_dishonest ]]--

function r2_sp_trait_female_roman_dishonest_impl (context)
		return (context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and not context:character():is_male() and context:character():has_garrison_residence() and is_in_state_list((context:character()), roman_states_factions) and context:character():garrison_residence():region():public_order() <= -25
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_female_roman_dishonest_impl(context) then
		effect.trait("r2_sp_trait_female_roman_dishonest", "agent", 1, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_roman_drink ]]--

function r2_sp_trait_female_roman_drink_impl (context)
		return (context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and not context:character():is_male() and context:character():has_garrison_residence() and is_in_state_list((context:character()), roman_states_factions) and garrison_has_building_superchain(context:character():garrison_residence(), "rom_GENERIC_city_minor_wine") 
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_female_roman_drink_impl(context) then
		effect.trait("r2_sp_trait_female_roman_drink", "agent", 1, 1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_roman_games_obsessive ]]--

function r2_sp_trait_female_roman_games_obsessive_impl (context)
		return (context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and not context:character():is_male() and context:character():has_garrison_residence() and is_in_state_list((context:character()), roman_states_factions) and (garrison_has_building(context:character():garrison_residence(), "rom_EASTERN_city_slot_entertainment_2") or garrison_has_building(context:character():garrison_residence(), "rom_EASTERN_city_slot_entertainment_3") or garrison_has_building(context:character():garrison_residence(), "rom_EASTERN_city_slot_entertainment_4") or garrison_has_building(context:character():garrison_residence(), "rom_HELLENIC_agora_entertainment_2") or garrison_has_building(context:character():garrison_residence(), "rom_HELLENIC_agora_entertainment_3") or garrison_has_building(context:character():garrison_residence(), "rom_HELLENIC_agora_entertainment_4") or garrison_has_building(context:character():garrison_residence(), "rom_ROMAN_forum_entertainment_2") or garrison_has_building(context:character():garrison_residence(), "rom_ROMAN_forum_entertainment_3") or garrison_has_building(context:character():garrison_residence(), "rom_ROMAN_forum_entertainment_4") or garrison_has_building(context:character():garrison_residence(), "rom_ROMAN_forum_entertainment_circus_5") or garrison_has_building(context:character():garrison_residence(), "rom_ROMAN_forum_entertainment_colosseum_5")) 
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_female_roman_games_obsessive_impl(context) then
		effect.trait("r2_sp_trait_female_roman_games_obsessive", "agent", 1, 20, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_roman_good_roman ]]--

function r2_sp_trait_female_roman_good_roman_impl (context)
		return (context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and not context:character():is_male() and context:character():has_region() and is_in_state_list((context:character()), roman_states_factions) and context:character():region():public_order() >= 1
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_female_roman_good_roman_impl(context) then
		effect.trait("r2_sp_trait_female_roman_good_roman", "agent", 1, 20, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_roman_races_obsessive ]]--

function r2_sp_trait_female_roman_races_obsessive_impl (context)
		return (context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and not context:character():is_male() and context:character():has_garrison_residence() and is_in_state_list((context:character()), roman_states_factions) and (garrison_has_building(context:character():garrison_residence(), "rom_EASTERN_city_slot_entertainment_2") or garrison_has_building(context:character():garrison_residence(), "rom_EASTERN_city_slot_entertainment_3") or garrison_has_building(context:character():garrison_residence(), "rom_EASTERN_city_slot_entertainment_4") or garrison_has_building(context:character():garrison_residence(), "rom_HELLENIC_agora_entertainment_2") or garrison_has_building(context:character():garrison_residence(), "rom_HELLENIC_agora_entertainment_3") or garrison_has_building(context:character():garrison_residence(), "rom_HELLENIC_agora_entertainment_4") or garrison_has_building(context:character():garrison_residence(), "rom_ROMAN_forum_entertainment_2") or garrison_has_building(context:character():garrison_residence(), "rom_ROMAN_forum_entertainment_3") or garrison_has_building(context:character():garrison_residence(), "rom_ROMAN_forum_entertainment_4") or garrison_has_building(context:character():garrison_residence(), "rom_ROMAN_forum_entertainment_circus_5") or garrison_has_building(context:character():garrison_residence(), "rom_ROMAN_forum_entertainment_colosseum_5")) 
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_female_roman_races_obsessive_impl(context) then
		effect.trait("r2_sp_trait_female_roman_races_obsessive", "agent", 1, 20, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_roman_unroman ]]--

function r2_sp_trait_female_roman_unroman_impl (context)
		return (context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and not context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():faction():num_allies() >= 4 and context:character():has_trait("r2_sp_trait_civilized_xenophile")
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_female_roman_unroman_impl(context) then
		effect.trait("r2_sp_trait_female_roman_unroman", "agent", 1, 5, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_roman_virtues_personal_dignity ]]--

function r2_sp_trait_female_roman_virtues_personal_dignity_impl (context)
		return (context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and not context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_female_roman_virtues_personal_dignity_impl(context) then
		effect.trait("r2_sp_trait_female_roman_virtues_personal_dignity", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_roman_virtues_personal_dutifulness ]]--

function r2_sp_trait_female_roman_virtues_personal_dutifulness_impl (context)
		return (context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and not context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1 
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_female_roman_virtues_personal_dutifulness_impl(context) then
		effect.trait("r2_sp_trait_female_roman_virtues_personal_dutifulness", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_roman_virtues_personal_frugality ]]--

function r2_sp_trait_female_roman_virtues_personal_frugality_impl (context)
		return (context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and not context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_female_roman_virtues_personal_frugality_impl(context) then
		effect.trait("r2_sp_trait_female_roman_virtues_personal_frugality", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_roman_virtues_personal_gravity ]]--

function r2_sp_trait_female_roman_virtues_personal_gravity_impl (context)
		return (context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and not context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_female_roman_virtues_personal_gravity_impl(context) then
		effect.trait("r2_sp_trait_female_roman_virtues_personal_gravity", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_roman_virtues_personal_humanity ]]--

function r2_sp_trait_female_roman_virtues_personal_humanity_impl (context)
		return (context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and not context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_female_roman_virtues_personal_humanity_impl(context) then
		effect.trait("r2_sp_trait_female_roman_virtues_personal_humanity", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_roman_virtues_personal_humour ]]--

function r2_sp_trait_female_roman_virtues_personal_humour_impl (context)
		return (context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and not context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_female_roman_virtues_personal_humour_impl(context) then
		effect.trait("r2_sp_trait_female_roman_virtues_personal_humour", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_roman_virtues_personal_industriousness ]]--

function r2_sp_trait_female_roman_virtues_personal_industriousness_impl (context)
		return (context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and not context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_female_roman_virtues_personal_industriousness_impl(context) then
		effect.trait("r2_sp_trait_female_roman_virtues_personal_industriousness", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_roman_virtues_personal_mercy ]]--

function r2_sp_trait_female_roman_virtues_personal_mercy_impl (context)
		return (context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and not context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_female_roman_virtues_personal_mercy_impl(context) then
		effect.trait("r2_sp_trait_female_roman_virtues_personal_mercy", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_roman_virtues_personal_prudence ]]--

function r2_sp_trait_female_roman_virtues_personal_prudence_impl (context)
		return (context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and not context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_female_roman_virtues_personal_prudence_impl(context) then
		effect.trait("r2_sp_trait_female_roman_virtues_personal_prudence", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_roman_virtues_personal_tenacity ]]--

function r2_sp_trait_female_roman_virtues_personal_tenacity_impl (context)
		return (context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and not context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_female_roman_virtues_personal_tenacity_impl(context) then
		effect.trait("r2_sp_trait_female_roman_virtues_personal_tenacity", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_roman_virtues_personal_truthfulness ]]--

function r2_sp_trait_female_roman_virtues_personal_truthfulness_impl (context)
		return (context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and not context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_female_roman_virtues_personal_truthfulness_impl(context) then
		effect.trait("r2_sp_trait_female_roman_virtues_personal_truthfulness", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_roman_virtues_personal_wholesomeness ]]--

function r2_sp_trait_female_roman_virtues_personal_wholesomeness_impl (context)
		return (context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and not context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_female_roman_virtues_personal_wholesomeness_impl(context) then
		effect.trait("r2_sp_trait_female_roman_virtues_personal_wholesomeness", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_roman_virtues_public_dutifulness ]]--

function r2_sp_trait_female_roman_virtues_public_dutifulness_impl (context)
		return (context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and not context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_female_roman_virtues_public_dutifulness_impl(context) then
		effect.trait("r2_sp_trait_female_roman_virtues_public_dutifulness", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_roman_virtues_public_forethought ]]--

function r2_sp_trait_female_roman_virtues_public_forethought_impl (context)
		return (context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and not context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_female_roman_virtues_public_forethought_impl(context) then
		effect.trait("r2_sp_trait_female_roman_virtues_public_forethought", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_roman_virtues_public_freedom ]]--

function r2_sp_trait_female_roman_virtues_public_freedom_impl (context)
		return (context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and not context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_female_roman_virtues_public_freedom_impl(context) then
		effect.trait("r2_sp_trait_female_roman_virtues_public_freedom", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_roman_virtues_public_giving ]]--

function r2_sp_trait_female_roman_virtues_public_giving_impl (context)
		return (context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and not context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_female_roman_virtues_public_giving_impl(context) then
		effect.trait("r2_sp_trait_female_roman_virtues_public_giving", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_female_roman_virtues_public_modesty ]]--

function r2_sp_trait_female_roman_virtues_public_modesty_impl (context)
		return (context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and not context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_female_roman_virtues_public_modesty_impl(context) then
		effect.trait("r2_sp_trait_female_roman_virtues_public_modesty", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_greco_roman_humors_black_bile ]]--

function r2_sp_trait_greco_roman_humors_black_bile_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and is_in_state_list((context:character()), greco_roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_greco_roman_humors_black_bile_impl(context) then
		effect.trait("r2_sp_trait_greco_roman_humors_black_bile", "agent", 1, 15, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_greco_roman_humors_blood ]]--

function r2_sp_trait_greco_roman_humors_blood_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and is_in_state_list((context:character()), greco_roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_greco_roman_humors_blood_impl(context) then
		effect.trait("r2_sp_trait_greco_roman_humors_blood", "agent", 1, 15, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_greco_roman_humors_phlegm ]]--

function r2_sp_trait_greco_roman_humors_phlegm_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and is_in_state_list((context:character()), greco_roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_greco_roman_humors_phlegm_impl(context) then
		effect.trait("r2_sp_trait_greco_roman_humors_phlegm", "agent", 1, 15, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_greco_roman_humors_yellow_bile ]]--

function r2_sp_trait_greco_roman_humors_yellow_bile_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and is_in_state_list((context:character()), greco_roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_greco_roman_humors_yellow_bile_impl(context) then
		effect.trait("r2_sp_trait_greco_roman_humors_yellow_bile", "agent", 1, 15, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_non_roman_background_fighter ]]--

function r2_sp_trait_non_roman_background_fighter_impl (context)
		return (char_is_general(context:character()) or context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and context:character():is_male() and not is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_non_roman_background_fighter_impl(context) then
		effect.trait("r2_sp_trait_non_roman_background_fighter", "agent", 1, 2, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_non_roman_background_mascot ]]--

function r2_sp_trait_non_roman_background_mascot_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and not is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_non_roman_background_mascot_impl(context) then
		effect.trait("r2_sp_trait_non_roman_background_mascot", "agent", 1, 2, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_non_roman_background_poor ]]--

function r2_sp_trait_non_roman_background_poor_impl (context)
		return (char_is_general(context:character()) or context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and context:character():is_male() and not is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_non_roman_background_poor_impl(context) then
		effect.trait("r2_sp_trait_non_roman_background_poor", "agent", 1, 2, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_non_roman_background_wealthy ]]--

function r2_sp_trait_non_roman_background_wealthy_impl (context)
		return (char_is_general(context:character()) or context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and context:character():is_male() and not is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_non_roman_background_wealthy_impl(context) then
		effect.trait("r2_sp_trait_non_roman_background_wealthy", "agent", 1, 2, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_non_roman_dishonest ]]--

function r2_sp_trait_non_roman_dishonest_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and context:character():has_garrison_residence() and not is_in_state_list((context:character()), roman_states_factions) and context:character():garrison_residence():region():public_order() <= -25
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_non_roman_dishonest_impl(context) then
		effect.trait("r2_sp_trait_non_roman_dishonest", "agent", 1, 15, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_non_roman_eagle_won ]]--

function r2_sp_trait_non_roman_eagle_won_impl (context)
		return true
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_non_roman_eagle_won_impl(context) then
		effect.trait("r2_sp_trait_non_roman_eagle_won", "agent", 1, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_background_fighter ]]--

function r2_sp_trait_roman_background_fighter_impl (context)
		return (context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_roman_background_fighter_impl(context) then
		effect.trait("r2_sp_trait_roman_background_fighter", "agent", 1, 2, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_background_mascot ]]--

function r2_sp_trait_roman_background_mascot_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_roman_background_mascot_impl(context) then
		effect.trait("r2_sp_trait_roman_background_mascot", "agent", 1, 2, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_background_poor ]]--

function r2_sp_trait_roman_background_poor_impl (context)
		return (char_is_general(context:character()) or context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_roman_background_poor_impl(context) then
		effect.trait("r2_sp_trait_roman_background_poor", "agent", 1, 2, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_background_wealthy ]]--

function r2_sp_trait_roman_background_wealthy_impl (context)
		return (char_is_general(context:character()) or context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_roman_background_wealthy_impl(context) then
		effect.trait("r2_sp_trait_roman_background_wealthy", "agent", 1, 2, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_blood_feud ]]--

function r2_sp_trait_roman_blood_feud_impl (context)
		return char_is_general(context:character()) and is_in_state_list((context:character()), roman_states_factions) and char_has_army(context:character()) and (context:character():fought_in_battle()) and (char_is_attacker(context:character()) and (context:character():model():pending_battle():attacker():body_guard_casulties() >= 0.9)) or (char_is_defender(context:character()) and (context:character():model():pending_battle():defender():body_guard_casulties() >= 0.9)) 
end 

events.CharacterCompletedBattle[#events.CharacterCompletedBattle+1] =
function (context)
	if r2_sp_trait_roman_blood_feud_impl(context) then
		effect.trait("r2_sp_trait_roman_blood_feud", "agent", 1, 30, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_dishonest ]]--

function r2_sp_trait_roman_dishonest_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and context:character():has_garrison_residence() and is_in_state_list((context:character()), roman_states_factions) and context:character():garrison_residence():region():public_order() <= -25
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_roman_dishonest_impl(context) then
		effect.trait("r2_sp_trait_roman_dishonest", "agent", 1, 15, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_drink ]]--

function r2_sp_trait_roman_drink_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and context:character():has_garrison_residence() and is_in_state_list((context:character()), roman_states_factions) and garrison_has_building_superchain(context:character():garrison_residence(), "rom_GENERIC_city_minor_wine") 
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_roman_drink_impl(context) then
		effect.trait("r2_sp_trait_roman_drink", "agent", 1, 1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_eagle_found ]]--

function r2_sp_trait_roman_eagle_found_impl (context)
		return true
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_roman_eagle_found_impl(context) then
		effect.trait("r2_sp_trait_roman_eagle_found", "agent", 1, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_eagle_lost ]]--

function r2_sp_trait_roman_eagle_lost_impl (context)
		return true
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_roman_eagle_lost_impl(context) then
		effect.trait("r2_sp_trait_roman_eagle_lost", "agent", 1, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_games_obsessive ]]--

function r2_sp_trait_roman_games_obsessive_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and context:character():has_garrison_residence() and is_in_state_list((context:character()), roman_states_factions) and (garrison_has_building(context:character():garrison_residence(), "rom_EASTERN_city_slot_entertainment_2") or garrison_has_building(context:character():garrison_residence(), "rom_EASTERN_city_slot_entertainment_3") or garrison_has_building(context:character():garrison_residence(), "rom_EASTERN_city_slot_entertainment_4") or garrison_has_building(context:character():garrison_residence(), "rom_HELLENIC_agora_entertainment_2") or garrison_has_building(context:character():garrison_residence(), "rom_HELLENIC_agora_entertainment_3") or garrison_has_building(context:character():garrison_residence(), "rom_HELLENIC_agora_entertainment_4") or garrison_has_building(context:character():garrison_residence(), "rom_ROMAN_forum_entertainment_2") or garrison_has_building(context:character():garrison_residence(), "rom_ROMAN_forum_entertainment_3") or garrison_has_building(context:character():garrison_residence(), "rom_ROMAN_forum_entertainment_4") or garrison_has_building(context:character():garrison_residence(), "rom_ROMAN_forum_entertainment_circus_5") or garrison_has_building(context:character():garrison_residence(), "rom_ROMAN_forum_entertainment_colosseum_5")) 
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_roman_games_obsessive_impl(context) then
		effect.trait("r2_sp_trait_roman_games_obsessive", "agent", 1, 20, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_gladiator_obsessive_mermillo ]]--

function r2_sp_trait_roman_gladiator_obsessive_mermillo_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and context:character():has_garrison_residence() and is_in_state_list((context:character()), roman_states_factions) and (garrison_has_building(context:character():garrison_residence(), "rom_EASTERN_city_slot_entertainment_2") or garrison_has_building(context:character():garrison_residence(), "rom_EASTERN_city_slot_entertainment_3") or garrison_has_building(context:character():garrison_residence(), "rom_EASTERN_city_slot_entertainment_4") or garrison_has_building(context:character():garrison_residence(), "rom_HELLENIC_agora_entertainment_2") or garrison_has_building(context:character():garrison_residence(), "rom_HELLENIC_agora_entertainment_3") or garrison_has_building(context:character():garrison_residence(), "rom_HELLENIC_agora_entertainment_4") or garrison_has_building(context:character():garrison_residence(), "rom_ROMAN_forum_entertainment_2") or garrison_has_building(context:character():garrison_residence(), "rom_ROMAN_forum_entertainment_3") or garrison_has_building(context:character():garrison_residence(), "rom_ROMAN_forum_entertainment_4") or garrison_has_building(context:character():garrison_residence(), "rom_ROMAN_forum_entertainment_circus_5") or garrison_has_building(context:character():garrison_residence(), "rom_ROMAN_forum_entertainment_colosseum_5")) 
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_roman_gladiator_obsessive_mermillo_impl(context) then
		effect.trait("r2_sp_trait_roman_gladiator_obsessive_mermillo", "agent", 1, 20, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_gladiator_obsessive_samnite ]]--

function r2_sp_trait_roman_gladiator_obsessive_samnite_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and context:character():has_garrison_residence() and is_in_state_list((context:character()), roman_states_factions) and (garrison_has_building(context:character():garrison_residence(), "rom_EASTERN_city_slot_entertainment_2") or garrison_has_building(context:character():garrison_residence(), "rom_EASTERN_city_slot_entertainment_3") or garrison_has_building(context:character():garrison_residence(), "rom_EASTERN_city_slot_entertainment_4") or garrison_has_building(context:character():garrison_residence(), "rom_HELLENIC_agora_entertainment_2") or garrison_has_building(context:character():garrison_residence(), "rom_HELLENIC_agora_entertainment_3") or garrison_has_building(context:character():garrison_residence(), "rom_HELLENIC_agora_entertainment_4") or garrison_has_building(context:character():garrison_residence(), "rom_ROMAN_forum_entertainment_2") or garrison_has_building(context:character():garrison_residence(), "rom_ROMAN_forum_entertainment_3") or garrison_has_building(context:character():garrison_residence(), "rom_ROMAN_forum_entertainment_4") or garrison_has_building(context:character():garrison_residence(), "rom_ROMAN_forum_entertainment_circus_5") or garrison_has_building(context:character():garrison_residence(), "rom_ROMAN_forum_entertainment_colosseum_5")) 
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_roman_gladiator_obsessive_samnite_impl(context) then
		effect.trait("r2_sp_trait_roman_gladiator_obsessive_samnite", "agent", 1, 20, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_good_roman ]]--

function r2_sp_trait_roman_good_roman_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():has_garrison_residence() and context:character():garrison_residence():region():public_order() >= 1
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_roman_good_roman_impl(context) then
		effect.trait("r2_sp_trait_roman_good_roman", "agent", 1, 20, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_proscriptor ]]--

function r2_sp_trait_roman_proscriptor_impl (context)
		return char_is_general(context:character()) and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_roman_proscriptor_impl(context) then
		effect.trait("r2_sp_trait_roman_proscriptor", "agent", 1, 15, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_races_obsessive ]]--

function r2_sp_trait_roman_races_obsessive_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and context:character():has_garrison_residence() and is_in_state_list((context:character()), roman_states_factions) and (garrison_has_building(context:character():garrison_residence(), "rom_EASTERN_city_slot_entertainment_2") or garrison_has_building(context:character():garrison_residence(), "rom_EASTERN_city_slot_entertainment_3") or garrison_has_building(context:character():garrison_residence(), "rom_EASTERN_city_slot_entertainment_4") or garrison_has_building(context:character():garrison_residence(), "rom_HELLENIC_agora_entertainment_2") or garrison_has_building(context:character():garrison_residence(), "rom_HELLENIC_agora_entertainment_3") or garrison_has_building(context:character():garrison_residence(), "rom_HELLENIC_agora_entertainment_4") or garrison_has_building(context:character():garrison_residence(), "rom_ROMAN_forum_entertainment_2") or garrison_has_building(context:character():garrison_residence(), "rom_ROMAN_forum_entertainment_3") or garrison_has_building(context:character():garrison_residence(), "rom_ROMAN_forum_entertainment_4") or garrison_has_building(context:character():garrison_residence(), "rom_ROMAN_forum_entertainment_circus_5") or garrison_has_building(context:character():garrison_residence(), "rom_ROMAN_forum_entertainment_colosseum_5")) 
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_roman_races_obsessive_impl(context) then
		effect.trait("r2_sp_trait_roman_races_obsessive", "agent", 1, 20, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_unroman ]]--

function r2_sp_trait_roman_unroman_impl (context)
		return char_is_general(context:character()) and is_in_state_list((context:character()), roman_states_factions) and context:character():faction():num_allies() >= 4 and context:character():has_trait("r2_sp_trait_civilized_xenophile")
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_roman_unroman_impl(context) then
		effect.trait("r2_sp_trait_roman_unroman", "agent", 1, 5, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_victor ]]--

function r2_sp_trait_roman_victor_impl (context)
		return true
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_roman_victor_impl(context) then
		effect.trait("r2_sp_trait_roman_victor", "agent", 1, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_virtues_personal_dignity ]]--

function r2_sp_trait_roman_virtues_personal_dignity_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_roman_virtues_personal_dignity_impl(context) then
		effect.trait("r2_sp_trait_roman_virtues_personal_dignity", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_virtues_personal_dutifulness ]]--

function r2_sp_trait_roman_virtues_personal_dutifulness_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_roman_virtues_personal_dutifulness_impl(context) then
		effect.trait("r2_sp_trait_roman_virtues_personal_dutifulness", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_virtues_personal_fortitude ]]--

function r2_sp_trait_roman_virtues_personal_fortitude_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_roman_virtues_personal_fortitude_impl(context) then
		effect.trait("r2_sp_trait_roman_virtues_personal_fortitude", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_virtues_personal_frugality ]]--

function r2_sp_trait_roman_virtues_personal_frugality_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_roman_virtues_personal_frugality_impl(context) then
		effect.trait("r2_sp_trait_roman_virtues_personal_frugality", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_virtues_personal_gravity ]]--

function r2_sp_trait_roman_virtues_personal_gravity_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_roman_virtues_personal_gravity_impl(context) then
		effect.trait("r2_sp_trait_roman_virtues_personal_gravity", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_virtues_personal_humanity ]]--

function r2_sp_trait_roman_virtues_personal_humanity_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_roman_virtues_personal_humanity_impl(context) then
		effect.trait("r2_sp_trait_roman_virtues_personal_humanity", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_virtues_personal_humour ]]--

function r2_sp_trait_roman_virtues_personal_humour_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_roman_virtues_personal_humour_impl(context) then
		effect.trait("r2_sp_trait_roman_virtues_personal_humour", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_virtues_personal_industriousness ]]--

function r2_sp_trait_roman_virtues_personal_industriousness_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_roman_virtues_personal_industriousness_impl(context) then
		effect.trait("r2_sp_trait_roman_virtues_personal_industriousness", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_virtues_personal_mercy ]]--

function r2_sp_trait_roman_virtues_personal_mercy_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_roman_virtues_personal_mercy_impl(context) then
		effect.trait("r2_sp_trait_roman_virtues_personal_mercy", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_virtues_personal_morale_courage ]]--

function r2_sp_trait_roman_virtues_personal_morale_courage_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_roman_virtues_personal_morale_courage_impl(context) then
		effect.trait("r2_sp_trait_roman_virtues_personal_morale_courage", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_virtues_personal_prudence ]]--

function r2_sp_trait_roman_virtues_personal_prudence_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_roman_virtues_personal_prudence_impl(context) then
		effect.trait("r2_sp_trait_roman_virtues_personal_prudence", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_virtues_personal_respectability ]]--

function r2_sp_trait_roman_virtues_personal_respectability_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_roman_virtues_personal_respectability_impl(context) then
		effect.trait("r2_sp_trait_roman_virtues_personal_respectability", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_virtues_personal_spiritual_authority ]]--

function r2_sp_trait_roman_virtues_personal_spiritual_authority_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_roman_virtues_personal_spiritual_authority_impl(context) then
		effect.trait("r2_sp_trait_roman_virtues_personal_spiritual_authority", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_virtues_personal_sternness ]]--

function r2_sp_trait_roman_virtues_personal_sternness_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_roman_virtues_personal_sternness_impl(context) then
		effect.trait("r2_sp_trait_roman_virtues_personal_sternness", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_virtues_personal_tenacity ]]--

function r2_sp_trait_roman_virtues_personal_tenacity_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_roman_virtues_personal_tenacity_impl(context) then
		effect.trait("r2_sp_trait_roman_virtues_personal_tenacity", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_virtues_personal_truthfulness ]]--

function r2_sp_trait_roman_virtues_personal_truthfulness_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_roman_virtues_personal_truthfulness_impl(context) then
		effect.trait("r2_sp_trait_roman_virtues_personal_truthfulness", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_virtues_personal_wholesomeness ]]--

function r2_sp_trait_roman_virtues_personal_wholesomeness_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_roman_virtues_personal_wholesomeness_impl(context) then
		effect.trait("r2_sp_trait_roman_virtues_personal_wholesomeness", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_virtues_public_clemency ]]--

function r2_sp_trait_roman_virtues_public_clemency_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and not (context:character():has_trait("r2_sp_trait_roman_virtues_personal_mercy")) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_roman_virtues_public_clemency_impl(context) then
		effect.trait("r2_sp_trait_roman_virtues_public_clemency", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_virtues_public_confidence ]]--

function r2_sp_trait_roman_virtues_public_confidence_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_roman_virtues_public_confidence_impl(context) then
		effect.trait("r2_sp_trait_roman_virtues_public_confidence", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_virtues_public_dutifulness ]]--

function r2_sp_trait_roman_virtues_public_dutifulness_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_roman_virtues_public_dutifulness_impl(context) then
		effect.trait("r2_sp_trait_roman_virtues_public_dutifulness", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_virtues_public_endurance ]]--

function r2_sp_trait_roman_virtues_public_endurance_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_roman_virtues_public_endurance_impl(context) then
		effect.trait("r2_sp_trait_roman_virtues_public_endurance", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_virtues_public_fair ]]--

function r2_sp_trait_roman_virtues_public_fair_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_roman_virtues_public_fair_impl(context) then
		effect.trait("r2_sp_trait_roman_virtues_public_fair", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_virtues_public_faith ]]--

function r2_sp_trait_roman_virtues_public_faith_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_roman_virtues_public_faith_impl(context) then
		effect.trait("r2_sp_trait_roman_virtues_public_faith", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_virtues_public_fertile_agriculture ]]--

function r2_sp_trait_roman_virtues_public_fertile_agriculture_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_roman_virtues_public_fertile_agriculture_impl(context) then
		effect.trait("r2_sp_trait_roman_virtues_public_fertile_agriculture", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_virtues_public_forethought ]]--

function r2_sp_trait_roman_virtues_public_forethought_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_roman_virtues_public_forethought_impl(context) then
		effect.trait("r2_sp_trait_roman_virtues_public_forethought", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_virtues_public_fortune ]]--

function r2_sp_trait_roman_virtues_public_fortune_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_roman_virtues_public_fortune_impl(context) then
		effect.trait("r2_sp_trait_roman_virtues_public_fortune", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_virtues_public_freedom ]]--

function r2_sp_trait_roman_virtues_public_freedom_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_roman_virtues_public_freedom_impl(context) then
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_virtues_public_giving ]]--

function r2_sp_trait_roman_virtues_public_giving_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_roman_virtues_public_giving_impl(context) then
		effect.trait("r2_sp_trait_roman_virtues_public_giving", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_virtues_public_harmony ]]--

function r2_sp_trait_roman_virtues_public_harmony_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_roman_virtues_public_harmony_impl(context) then
		effect.trait("r2_sp_trait_roman_virtues_public_harmony", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_virtues_public_hope ]]--

function r2_sp_trait_roman_virtues_public_hope_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_roman_virtues_public_hope_impl(context) then
		effect.trait("r2_sp_trait_roman_virtues_public_hope", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_virtues_public_joy ]]--

function r2_sp_trait_roman_virtues_public_joy_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_roman_virtues_public_joy_impl(context) then
		effect.trait("r2_sp_trait_roman_virtues_public_joy", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_virtues_public_justice ]]--

function r2_sp_trait_roman_virtues_public_justice_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_roman_virtues_public_justice_impl(context) then
		effect.trait("r2_sp_trait_roman_virtues_public_justice", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_virtues_public_lucky ]]--

function r2_sp_trait_roman_virtues_public_lucky_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_roman_virtues_public_lucky_impl(context) then
		effect.trait("r2_sp_trait_roman_virtues_public_lucky", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_virtues_public_mirth ]]--

function r2_sp_trait_roman_virtues_public_mirth_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_roman_virtues_public_mirth_impl(context) then
		effect.trait("r2_sp_trait_roman_virtues_public_mirth", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_virtues_public_modesty ]]--

function r2_sp_trait_roman_virtues_public_modesty_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_roman_virtues_public_modesty_impl(context) then
		effect.trait("r2_sp_trait_roman_virtues_public_modesty", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_virtues_public_nobility ]]--

function r2_sp_trait_roman_virtues_public_nobility_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_roman_virtues_public_nobility_impl(context) then
		effect.trait("r2_sp_trait_roman_virtues_public_nobility", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_virtues_public_peace ]]--

function r2_sp_trait_roman_virtues_public_peace_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_roman_virtues_public_peace_impl(context) then
		effect.trait("r2_sp_trait_roman_virtues_public_peace", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_virtues_public_plenty ]]--

function r2_sp_trait_roman_virtues_public_plenty_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_roman_virtues_public_plenty_impl(context) then
		effect.trait("r2_sp_trait_roman_virtues_public_plenty", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_virtues_public_prosperity ]]--

function r2_sp_trait_roman_virtues_public_prosperity_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_roman_virtues_public_prosperity_impl(context) then
		effect.trait("r2_sp_trait_roman_virtues_public_prosperity", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_virtues_public_public_health ]]--

function r2_sp_trait_roman_virtues_public_public_health_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_roman_virtues_public_public_health_impl(context) then
		effect.trait("r2_sp_trait_roman_virtues_public_public_health", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_virtues_public_roman_spirit ]]--

function r2_sp_trait_roman_virtues_public_roman_spirit_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_roman_virtues_public_roman_spirit_impl(context) then
		effect.trait("r2_sp_trait_roman_virtues_public_roman_spirit", "agent", 0, -1, context)
		return true
	end
	return false
end

--[[ r2_sp_trait_roman_virtues_public_wealth ]]--

function r2_sp_trait_roman_virtues_public_wealth_impl (context)
		return char_is_general(context:character()) and context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_roman_virtues_public_wealth_impl(context) then
		effect.trait("r2_sp_trait_roman_virtues_public_wealth", "agent", 0, -1, context)
		return true
	end
	return false
end

















--[[ r2_sp_trait_all_mad ]]--

function r2_sp_trait_all_mad_impl (context)
		return char_is_general(context:character()) and ((context:character():has_trait("r2_sp_trait_civilized_religious")) or (context:character():has_trait("r2_sp_trait_all_noctophobia")) or (context:character():has_trait("r2_sp_trait_all_background_inbred")) or (context:character():has_trait("r2_sp_trait_all_background_very_inbred")) or (context:character():has_trait("r2_sp_trait_all_background_very_very_inbred")) or (context:character():has_trait("r2_sp_trait_barbarian_drink")) or (context:character():has_trait("r2_sp_trait_barbarian_religious")) or (context:character():has_trait("r2_sp_trait_civilized_drink")) or (context:character():has_trait("r2_sp_trait_female_barbarian_drink")) or (context:character():has_trait("r2_sp_trait_female_civilized_drink")) or (context:character():has_trait("r2_sp_trait_female_civilized_persecutor")) or (context:character():has_trait("r2_sp_trait_female_roman_drink")) or (context:character():has_trait("r2_sp_trait_all_mad")) or (context:character():has_trait("r2_sp_trait_roman_drink")) or (context:character():has_trait("r2_sp_trait_roman_proscriptor")) or (context:character():has_trait("r2_sp_trait_all_leader_paranoid"))) and not conditions.FactionIsHuman(context)
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_all_mad_impl(context) then
		effect.trait("r2_sp_trait_all_mad", "agent", 1, 1, context)
		return true
	end
	return false
end


--[[ r2_sp_trait_rome_mad ]]--

function r2_sp_trait_rome_mad_impl (context)
		return char_is_general(context:character()) and is_in_state_list((context:character()), roman_states_factions) and ((context:character():has_trait("r2_sp_trait_civilized_religious")) or (context:character():has_trait("r2_sp_trait_all_noctophobia")) or (context:character():has_trait("r2_sp_trait_all_background_inbred")) or (context:character():has_trait("r2_sp_trait_all_background_very_inbred")) or (context:character():has_trait("r2_sp_trait_all_background_very_very_inbred")) or (context:character():has_trait("r2_sp_trait_civilized_drink")) or (context:character():has_trait("r2_sp_trait_female_civilized_drink")) or (context:character():has_trait("r2_sp_trait_female_civilized_persecutor")) or (context:character():has_trait("r2_sp_trait_female_roman_drink")) or (context:character():has_trait("r2_sp_trait_rome_mad")) or (context:character():has_trait("r2_sp_trait_roman_drink")) or (context:character():has_trait("r2_sp_trait_roman_proscriptor")) or (context:character():has_trait("r2_sp_trait_all_leader_paranoid"))) and not conditions.FactionIsHuman(context)
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_rome_mad_impl(context) then
		effect.trait("r2_sp_trait_rome_mad", "agent", 1, 1, context)
		return true
	end
	return false
end



--[[ r2_sp_trait_barbarian_warlord ]]--

function r2_sp_trait_barbarian_warlord_impl (context)
		return char_is_general_with_army(context:character()) and is_in_state_list((context:character()), barbarian_states_factions) and ((context:character():model():pending_battle():attacker() and context:character():model():pending_battle():attacker():won_battle()) or (context:character():model():pending_battle():defender() and (context:character():model():pending_battle():defender():won_battle()))) and (context:character():battles_won() >=  (context:character():battles_fought() * 0.8)) and not conditions.FactionIsHuman(context)
end 

events.CharacterCompletedBattle[#events.CharacterCompletedBattle+1] =
function (context)
	if r2_sp_trait_barbarian_warlord_impl(context) then
		effect.trait("r2_sp_trait_barbarian_warlord", "agent", 1, 30, context)
		return true
	end
	return false
end



--[[ r2_sp_trait_all_strategist ]]--

function r2_sp_trait_all_strategist_impl (context)
		return char_is_general(context:character()) and (context:skill_point_spent_on() == "general_strategist_1" or context:skill_point_spent_on() == "general_strategist_2_navigator" or context:skill_point_spent_on() == "general_strategist_2_tactician" or context:skill_point_spent_on() == "general_strategist_3_administration" or context:skill_point_spent_on() == "general_strategist_3_covert_action" or context:skill_point_spent_on() == "general_strategist_3_logistics" or context:skill_point_spent_on() == "general_strategist_3_mercenary" or context:skill_point_spent_on() == "general_strategist_3_siegecraft" or context:skill_point_spent_on() == "general_strategist_3_master_tactician") and not conditions.FactionIsHuman(context)
end 

events.CharacterSkillPointAllocated[#events.CharacterSkillPointAllocated+1] =
function (context)
	if r2_sp_trait_all_strategist_impl(context) then
		effect.trait("r2_sp_trait_all_strategist", "agent", 1, 75, context)
		return true
	end
	return false
end
















--[[ r2_sp_trait_all_non_roman_agent_army_friendly_military_admin_success_trigger ]]--

function r2_sp_trait_all_non_roman_agent_army_friendly_military_admin_success_trigger_impl (context)
		return context:character():character_type("dignitary") and context:character():is_embedded_in_military_force() and not context:character():faction():name()~=("rom_rome") and not conditions.FactionIsHuman(context)
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_all_non_roman_agent_army_friendly_military_admin_success_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_non_roman_agent_army_friendly_military_admin", "agent", 1, 30, context)
		return true
	end
	return false
end



--[[ r2_sp_trait_all_background_ugly_trigger ]]--

function r2_sp_trait_all_background_ugly_trigger_impl (context)
		return (char_is_general(context:character()) or context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and (context:character():is_male()) and context:character():number_of_traits() <1 and not conditions.FactionIsHuman(context)
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_all_background_ugly_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_background_ugly", "agent", 1, 2, context)
		return true
	end
	return false
end



--[[ r2_sp_trait_female_greco_roman_humors_yellow_bile ]]--

function r2_sp_trait_female_greco_roman_humors_yellow_bile_impl (context)
		return (context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and not context:character():is_male() and is_in_state_list((context:character()), greco_roman_states_factions) and context:character():number_of_traits() <1 and not conditions.FactionIsHuman(context)
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_female_greco_roman_humors_yellow_bile_impl(context) then
		effect.trait("r2_sp_trait_female_greco_roman_humors_yellow_bile", "agent", 1, 15, context)
		return true
	end
	return false
end



--[[ r2_sp_trait_female_roman_background_fighter ]]--

function r2_sp_trait_female_roman_background_fighter_impl (context)
		return (context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and not context:character():is_male() and is_in_state_list((context:character()), roman_states_factions) and context:character():number_of_traits() <1 and not conditions.FactionIsHuman(context)
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_female_roman_background_fighter_impl(context) then
		effect.trait("r2_sp_trait_female_roman_background_fighter", "agent", 1, 2, context)
		return true
	end
	return false
end



--[[ r2_sp_trait_all_background_very_inbred_trigger ]]--

function r2_sp_trait_all_background_very_inbred_trigger_impl (context)
		return (char_is_general(context:character()) or context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and (context:character():is_male()) and context:character():number_of_traits() <1 and not conditions.FactionIsHuman(context)
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_all_background_very_inbred_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_background_very_inbred", "agent", 1, 2, context)
		return true
	end
	return false
end



--[[ r2_sp_trait_all_feck_trigger ]]--

function r2_sp_trait_all_feck_trigger_impl (context)
		return char_is_general_with_army(context:character()) and context:character():is_male() and not context:character():has_garrison_residence() and not conditions.FactionIsHuman(context)
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_all_feck_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_feck", "agent", 1, 1, context)
		return true
	end
	return false
end



--[[ r2_sp_trait_female_all_feck ]]--

function r2_sp_trait_female_all_feck_impl (context)
		return (char_is_general_with_army(context:character()) or context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and not context:character():is_male() and not context:character():has_garrison_residence() and not conditions.FactionIsHuman(context)
end 

events.CharacterTurnStart[#events.CharacterTurnStart+1] =
function (context)
	if r2_sp_trait_female_all_feck_impl(context) then
		effect.trait("r2_sp_trait_female_all_feck", "agent", 1, 1, context)
		return true
	end
	return false
end



--[[ r2_sp_trait_all_background_very_very_inbred_trigger ]]--

function r2_sp_trait_all_background_very_very_inbred_trigger_impl (context)
		return (char_is_general(context:character()) or context:character():character_type("champion") or context:character():character_type("dignitary") or context:character():character_type("spy")) and (context:character():is_male()) and context:character():number_of_traits() <1 and not conditions.FactionIsHuman(context)
end 

events.CharacterCreated[#events.CharacterCreated+1] =
function (context)
	if r2_sp_trait_all_background_very_very_inbred_trigger_impl(context) then
		effect.trait("r2_sp_trait_all_background_very_very_inbred", "agent", 1, 2, context)
		return true
	end
	return false
end
