Skip to content

Commit 4fa8f85

Browse files
committed
vic3: ship veterancy levels for 1.13.5
1 parent 49a7160 commit 4fa8f85

13 files changed

Lines changed: 116 additions & 28 deletions

File tree

src/vic3/data/naval_missions.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ impl DbKind for NavalMissionType {
4040
vd.field_bool("piracy");
4141
vd.field_bool("port_bombardment");
4242

43+
vd.field_numeric("experience");
44+
4345
vd.field_list_choice("intercept_targets", &["none", "hostile", "piracy", "all"]);
4446
vd.field_list_choice(
4547
"piracy_targets",

src/vic3/data/ships.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,18 @@ use crate::vic3::tables::modifs::maybe_warn_modifiable_capitalization;
1616
pub struct ShipType {}
1717
#[derive(Clone, Debug)]
1818
pub struct ShipGroup {}
19+
#[derive(Clone, Debug)]
20+
pub struct ShipVeterancyLevel {}
1921

2022
inventory::submit! {
2123
ItemLoader::Normal(GameFlags::Vic3, Item::ShipType, ShipType::add)
2224
}
2325
inventory::submit! {
2426
ItemLoader::Normal(GameFlags::Vic3, Item::ShipGroup, ShipGroup::add)
2527
}
28+
inventory::submit! {
29+
ItemLoader::Normal(GameFlags::Vic3, Item::ShipVeterancyLevel, ShipVeterancyLevel::add)
30+
}
2631

2732
impl ShipType {
2833
pub fn add(db: &mut Db, key: Token, block: Block) {
@@ -34,6 +39,11 @@ impl ShipGroup {
3439
db.add(Item::ShipGroup, key, block, Box::new(Self {}));
3540
}
3641
}
42+
impl ShipVeterancyLevel {
43+
pub fn add(db: &mut Db, key: Token, block: Block) {
44+
db.add(Item::ShipVeterancyLevel, key, block, Box::new(Self {}));
45+
}
46+
}
3747

3848
impl DbKind for ShipType {
3949
fn validate(&self, key: &Token, block: &Block, data: &Everything) {
@@ -122,3 +132,18 @@ impl DbKind for ShipGroup {
122132
vd.field_choice("category", &["capital_group", "cruiser_group", "torpedo_group", "supply"]);
123133
}
124134
}
135+
136+
impl DbKind for ShipVeterancyLevel {
137+
fn validate(&self, key: &Token, block: &Block, data: &Everything) {
138+
let mut vd = Validator::new(block, data);
139+
140+
data.verify_exists(Item::Localization, key);
141+
142+
vd.field_item("icon", Item::File);
143+
vd.field_numeric("experience_threshold");
144+
vd.field_validated_block("modifier", |block, data| {
145+
let vd = Validator::new(block, data);
146+
validate_modifs(block, data, ModifKinds::Ship, vd);
147+
});
148+
}
149+
}

src/vic3/effect_validation.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,7 @@ pub fn validate_create_military_formation(
566566
vd.field_choice("type", &["army", "fleet"]);
567567
let is_fleet = block.field_value_is("type", "fleet");
568568
vd.field_target("hq_region", sc, Scopes::StrategicRegion);
569+
vd.field_target("supply_hub", sc, Scopes::State);
569570
vd.multi_field_validated_block("combat_unit", |block, data| {
570571
let mut vd = Validator::new(block, data);
571572
vd.field_target("type", sc, Scopes::CombatUnitType);

src/vic3/tables/misc.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ pub const COMMON_DIRS: &[&str] = &[
284284
"common/ship_modifications",
285285
"common/ship_name_definitions",
286286
"common/ship_types",
287+
"common/ship_veterancy_levels",
287288
"common/social_classes",
288289
"common/social_hierarchies",
289290
"common/state_traits",

src/vic3/tables/modifs.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,6 +1025,8 @@ const MODIF_TABLE: &[(&str, ModifKinds)] = &[
10251025
("country_ship_construction_efficiency_add", ModifKinds::Country),
10261026
("country_ship_construction_goods_cost_mult", ModifKinds::Country),
10271027
("country_ship_construction_progress_max_add", ModifKinds::Country),
1028+
("country_ship_crew_starting_veterancy_experience_add", ModifKinds::Country),
1029+
("country_ship_crew_starting_veterancy_experience_mult", ModifKinds::Country),
10281030
("country_society_tech_research_speed_mult", ModifKinds::Country),
10291031
("country_society_tech_spread_mult", ModifKinds::Country),
10301032
("country_state_religion_wages_mult", ModifKinds::Country),

src/vic3/tables/triggers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,7 @@ const TRIGGER: &[(Scopes, &str, Trigger)] = &[
878878
(Scopes::Character, "is_heir", Removed("1.13", "replaced with `is_heir_of_own_country`")),
879879
(Scopes::Character, "is_heir_of_own_country", Boolean),
880880
(Scopes::Character, "is_historical", Boolean),
881-
(Scopes::Treaty, "is_historical_treaty", Boolean),
881+
(Scopes::Treaty.union(Scopes::TreatyOptions), "is_historical_treaty", Boolean),
882882
(Scopes::War, "is_holder_of_wargoal_in_war", Scope(Scopes::Country)),
883883
(Scopes::Country, "is_home_country_for", Scope(Scopes::Country)),
884884
(Scopes::StateRegion, "is_homeland", ScopeOrItem(Scopes::Culture, Item::Culture)),

tiger-tables/src/item.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,7 @@ pub enum Item {
545545
#[cfg(feature = "vic3")] ShipModificationSlot,
546546
#[cfg(feature = "vic3")] ShipNameDefinition,
547547
#[cfg(feature = "vic3")] ShipType,
548+
#[cfg(feature = "vic3")] ShipVeterancyLevel,
548549
#[cfg(feature = "vic3")] SocialClass,
549550
#[cfg(feature = "vic3")] SocialHierarchy,
550551
#[cfg(feature = "vic3")] StateRegion,
@@ -1868,6 +1869,8 @@ impl Item {
18681869
#[cfg(feature = "vic3")]
18691870
Item::ShipType => "common/ship_types/",
18701871
#[cfg(feature = "vic3")]
1872+
Item::ShipVeterancyLevel => "common/ship_veterancy_levels/",
1873+
#[cfg(feature = "vic3")]
18711874
Item::SocialClass => "common/social_classes/",
18721875
#[cfg(feature = "vic3")]
18731876
Item::SocialHierarchy => "common/social_hierarchies/",

0 commit comments

Comments
 (0)