# -*- ck2.decisions -*-

# Fort decisions are possible vs _all_ forts and are shown in the Settlement Diplomacy View, not the Intrigue View. The taker is in the FROM scope.
#
# filter = [capital/owned/vassal_owned/sub_realm_owned/realm_owned/dynasty_owned]
# ai_target_filter = [capital/owned/vassal_owned/sub_realm_owned/realm_owned/dynasty_owned] (which forts for which the AI evaluates the decision.)
#	owned: all forts owned by the AI
#	vassal_owned: all forts owned by direct vassal rulers of the AI's employer
#	sub_realm_owned: all forts below the AI's employer
#	realm_owned: all forts in the same top realm as the AI
#	dynasty_owned: all forts owned by members of the same dynasty
#

decisions = {
    dsf_build_fort_in_capital = {
        only_playable = yes
        ai_check_interval = 6

        potential = {
            ai = yes
            is_landed = yes
            is_nomadic = no

            capital_scope = {
                has_fort = no
            }
        }

        allow = {
            capital_scope = {
                is_occupied = no

                NOT = {
                    any_province_holding = {
                        OR = {
                            has_siege = yes
                            is_occupied = yes
                        }
                    }
                }
            }

            OR = {
                trait = skilled_tactician
                trait = brilliant_strategist
				trait = genius
                trait = strategist
                trait = unyielding_leader
                trait = defensive_leader
            }

            wealth >= 40
        }

        effect = {
            create_fort = capital_scope

			capital_scope = {
				province_event = { id = dsf_forts_building.2 }
			}

            wealth = -20
        }

        ai_will_do = {
            factor = 1
        }
    }
}

fort_decisions = {	
	dsf_abandon_fort = {
		only_playable = yes
		filter = sub_realm_owned
		ai_target_filter = sub_realm_owned
		ai = no
		
		from_potential = {
		}
		
		potential = {
			fort_owner = {
				character = FROM
			}
		}
		allow = {
			fort_owner = {
				war = no
			}
		}
		effect = {
			destroy_fort = THIS
			remove_province_modifier = dsf_building_battle_camp
			remove_province_modifier = dsf_building_fortress_camp
			remove_province_modifier = dsf_building_military_outpost
			remove_province_modifier = dsf_building_wooden_bastion
			remove_province_modifier = dsf_building_stone_bastion
			remove_province_modifier = dsf_building_siege_camp
		}
		revoke_allowed = {
			always = no
		}
		
		ai_will_do = {
			factor = 0
		}
	}		
}