ck2plus / CleanSlate

A community resource, clean base from which to begin mods for CrusaderKings 2
29 stars 13 forks source link

Holy war (and similar) distance check is kind of weird #203

Closed Silversweeper closed 1 month ago

Silversweeper commented 3 months ago

Consistent with vanilla CK2, but the "Neighbour of within two sea zones" check that is used in a few places (holy wars being one) checks if any county in the duchy is within one/two sea zones, not just the defender's counties. This can result in some possibly undesirable things, e.g. the Fatimids bypassing their Nubian/Ethiopian tributaries to attack someone with an inland county in a duchy because they are close enough to a coastal county held by a third party realm in the same duchy.

As a fix, I would suggest putting the "location" part of the check in an AND together with holder_scope = { OR = { character = FROM is_vassal_or_below_of = FROM } }; it's a change to vanilla, but probably how it's intended to work, and it'd mean fewer crimes against bordergore.

schwarherz commented 1 month ago

Alrighty so after messing with it a little bit I think I wrote something that will work: I'll want @Whizzer 's approval before I commit it, however.

Original:

        # The attacker needs at least one county in the target kingdom, or a border, or be only two sea zones away from one of your counties
        any_direct_de_jure_vassal_title = {
            OR = {
                holder_scope = { # part of attacker's realm
                    OR = {
                        character = ROOT
                        is_vassal_or_below_of = ROOT
                    }
                }

                location = {
                    any_neighbor_province = { # bordering province
                        trigger_if = {
                            limit = { has_owner = yes }

                            owner = { # part of attacker's realm
                                OR = {
                                    character = ROOT
                                    is_vassal_or_below_of = ROOT
                                }
                            }
                        }
                        trigger_else = {
                            is_land = no # first sea zone

                            any_neighbor_province = {
                                trigger_if = {
                                    limit = { has_owner = yes }

                                    owner = { # part of attacker's realm
                                        OR = {
                                            character = ROOT
                                            is_vassal_or_below_of = ROOT
                                        }
                                    }
                                }
                                trigger_else = {
                                    is_land = no # second sea zone

                                    any_neighbor_province = {
                                        owner = { # part of attacker's realm
                                            OR = {
                                                character = ROOT
                                                is_vassal_or_below_of = ROOT
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }

New:

        # The attacker needs at least one county in the target kingdom, or a border, or be only two sea zones away from one of your counties
        any_direct_de_jure_vassal_title = {
            trigger_if = {
                limit = {
                    holder_scope = {
                        NOR = { # part of attacker's realm
                            character = ROOT
                            is_vassal_or_below_of = ROOT
                        }
                    }
                }
            }

            holder_scope = {
                OR = { # Actually part of Defender's realm, not a random title in the same de jure duchy
                    character = FROM
                    is_vassal_or_below_of = FROM
                }
            }

            location = {
                any_neighbor_province = { # bordering province
                    trigger_if = {
                        limit = { has_owner = yes }

                        owner = { # part of attacker's realm
                            OR = {
                                character = ROOT
                                is_vassal_or_below_of = ROOT
                            }
                        }
                    }
                    trigger_else = {
                        is_land = no # first sea zone

                        any_neighbor_province = {
                            trigger_if = {
                                limit = { has_owner = yes }

                                owner = { # part of attacker's realm
                                    OR = {
                                        character = ROOT
                                        is_vassal_or_below_of = ROOT
                                    }
                                }
                            }
                            trigger_else = {
                                is_land = no # second sea zone

                                any_neighbor_province = {
                                    owner = { # part of attacker's realm
                                        OR = {
                                            character = ROOT
                                            is_vassal_or_below_of = ROOT
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }