16#define EFFECT_PARAMTERS \
17 uint16_t const *tval, sys::state &ws, int32_t primary_slot, int32_t this_slot, int32_t from_slot, uint32_t r_hi, uint32_t r_lo, bool& els
26 while(sub_units_start < tval + source_size) {
34 return apply_subeffects(tval, ws, primary_slot, this_slot, from_slot, r_hi, r_lo, els);
43 ret =
apply_subeffects(tval, ws, primary_slot, this_slot, from_slot, r_hi, r_lo, els);
47 ret =
apply_subeffects(tval, ws, primary_slot, this_slot, from_slot, r_hi, r_lo, els);
57 ret =
apply_subeffects(tval, ws, primary_slot, this_slot, from_slot, r_hi, r_lo, els);
61 ret =
apply_subeffects(tval, ws, primary_slot, this_slot, from_slot, r_hi, r_lo, els);
68 auto neighbor_range = ws.world.province_get_province_adjacency(
trigger::to_prov(primary_slot));
71 std::vector<dcon::province_id> rlist;
75 for(
auto p : neighbor_range) {
76 auto other = p.get_connected_provinces(p.get_connected_provinces(0) ==
trigger::to_prov(primary_slot) ? 1 : 0);
78 rlist.push_back(other.id);
82 for(
auto p : neighbor_range) {
83 auto other = p.get_connected_provinces(p.get_connected_provinces(0) ==
trigger::to_prov(primary_slot) ? 1 : 0);
84 if(other.get_nation_from_province_ownership()) {
85 rlist.push_back(other.id);
90 if(rlist.size() != 0) {
99 for(
auto p : neighbor_range) {
100 auto other = p.get_connected_provinces(p.get_connected_provinces(0) ==
trigger::to_prov(primary_slot) ? 1 : 0);
108 for(
auto p : neighbor_range) {
109 auto other = p.get_connected_provinces(p.get_connected_provinces(0) ==
trigger::to_prov(primary_slot) ? 1 : 0);
110 if(other.get_nation_from_province_ownership()) {
120 std::vector<dcon::province_id> v;
122 for(
auto own : state.world.nation_get_province_ownership(nat_id)) {
123 auto prov = own.get_province().id;
124 auto neighbor_range = state.world.province_get_province_adjacency(prov);
126 for(
auto adj : state.world.province_get_province_adjacency(prov)) {
128 auto other = adj.get_connected_provinces(0) != prov ? adj.get_connected_provinces(0) : adj.get_connected_provinces(1);
130 if(std::find(v.begin(), v.end(), other.id) == v.end()) {
131 v.push_back(other.id);
145 std::vector<dcon::province_id> rlist;
149 for(
auto other : neighbor_range) {
151 rlist.push_back(other);
155 for(
auto other : neighbor_range) {
156 if(
dcon::fatten(ws.world, other).get_nation_from_province_ownership()) {
157 rlist.push_back(other);
162 if(rlist.size() != 0) {
172 for(
auto other : neighbor_range) {
180 for(
auto other : neighbor_range) {
181 if(
dcon::fatten(ws.world, other).get_nation_from_province_ownership()) {
194 std::vector<dcon::province_id> rlist;
198 for(
auto other : neighbor_range) {
200 rlist.push_back(other);
204 for(
auto other : neighbor_range) {
205 if(!
dcon::fatten(ws.world, other).get_nation_from_province_ownership()) {
206 rlist.push_back(other);
211 if(rlist.size() != 0) {
221 for(
auto other : neighbor_range) {
229 for(
auto other : neighbor_range) {
230 if(!
dcon::fatten(ws.world, other).get_nation_from_province_ownership()) {
239 auto neighbor_range = ws.world.nation_get_nation_adjacency(
trigger::to_nation(primary_slot));
242 std::vector<dcon::nation_id> rlist;
246 for(
auto p : neighbor_range) {
247 auto other = p.get_connected_nations(0) ==
trigger::to_nation(primary_slot) ? p.get_connected_nations(1) : p.get_connected_nations(0);
249 rlist.push_back(other.id);
253 for(
auto p : neighbor_range) {
254 auto other = p.get_connected_nations(0) ==
trigger::to_nation(primary_slot) ? p.get_connected_nations(1) : p.get_connected_nations(0);
255 rlist.push_back(other.id);
259 if(rlist.size() != 0) {
268 for(
auto p : neighbor_range) {
269 auto other = p.get_connected_nations(0) ==
trigger::to_nation(primary_slot) ? p.get_connected_nations(1) : p.get_connected_nations(0);
277 for(
auto p : neighbor_range) {
278 auto other = p.get_connected_nations(0) ==
trigger::to_nation(primary_slot) ? p.get_connected_nations(1) : p.get_connected_nations(0);
287 std::vector<dcon::nation_id> rlist;
290 for(
auto n : ws.world.in_nation) {
292 rlist.push_back(n.id);
295 for(
auto n : ws.world.in_nation) {
296 if(n.get_owned_province_count() != 0)
297 rlist.push_back(n.id);
301 if(rlist.size() != 0) {
310 for(
auto n : ws.world.in_nation) {
315 for(
auto n : ws.world.in_nation) {
316 if(n.get_owned_province_count() != 0)
325 std::vector<dcon::nation_id> rlist;
328 for(
auto n : ws.world.in_nation) {
330 rlist.push_back(n.id);
333 for(
auto n : ws.world.in_nation) {
335 rlist.push_back(n.id);
338 if(rlist.size() != 0) {
347 for(
auto n : ws.world.in_nation) {
352 for(
auto n : ws.world.in_nation) {
362 std::vector<dcon::nation_id> rlist;
365 for(
auto n : ws.world.in_nation) {
367 rlist.push_back(n.id);
370 for(
auto n : ws.world.in_nation) {
372 rlist.push_back(n.id);
375 if(rlist.size() != 0) {
384 for(
auto n : ws.world.in_nation) {
389 for(
auto n : ws.world.in_nation) {
401 return apply_subeffects(tval, ws, primary_slot, this_slot, primary_slot, r_hi, r_lo + 1, els);
405 return apply_subeffects(tval, ws, primary_slot, this_slot, primary_slot, r_hi, r_lo + 1, els);
411 return apply_subeffects(tval, ws, primary_slot, primary_slot, from_slot, r_hi, r_lo + 1, els);
415 return apply_subeffects(tval, ws, primary_slot, primary_slot, from_slot, r_hi, r_lo + 1, els);
428 auto neighbor_range = ws.world.province_get_province_adjacency(
trigger::to_prov(primary_slot));
430 std::vector<dcon::province_id> rlist;
433 for(
auto p : neighbor_range) {
434 auto other = p.get_connected_provinces(p.get_connected_provinces(0) ==
trigger::to_prov(primary_slot) ? 1 : 0);
436 rlist.push_back(other.id);
440 for(
auto p : neighbor_range) {
441 auto other = p.get_connected_provinces(p.get_connected_provinces(0) ==
trigger::to_prov(primary_slot) ? 1 : 0);
442 if(!other.get_nation_from_province_ownership()) {
443 rlist.push_back(other.id);
448 if(rlist.size() != 0) {
457 for(
auto p : neighbor_range) {
458 auto other = p.get_connected_provinces(p.get_connected_provinces(0) ==
trigger::to_prov(primary_slot) ? 1 : 0);
459 if(!other.get_nation_from_province_ownership() &&
465 for(
auto p : neighbor_range) {
466 auto other = p.get_connected_provinces(p.get_connected_provinces(0) ==
trigger::to_prov(primary_slot) ? 1 : 0);
467 if(!other.get_nation_from_province_ownership()) {
477 std::vector<dcon::nation_id> rlist;
480 for(
auto& n : ws.great_nations) {
482 rlist.push_back(n.nation);
486 for(
auto& n : ws.great_nations) {
487 rlist.push_back(n.nation);
490 if(rlist.size() != 0) {
499 for(
auto& n : ws.great_nations) {
506 for(
auto& n : ws.great_nations) {
515 std::vector<dcon::pop_id> plist;
518 for(
auto p : ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot))) {
519 for(
auto pop : p.get_province().get_pop_location()) {
521 plist.push_back(pop.get_pop().id);
526 for(
auto p : ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot))) {
527 for(
auto pop : p.get_province().get_pop_location()) {
529 plist.push_back(pop.get_pop().id);
542 std::vector<dcon::pop_id> plist;
547 for(
auto pop : ws.world.province_get_pop_location(p)) {
548 if(pop.get_pop().get_poptype().get_strata() == uint8_t(culture::pop_strata::poor) && trigger::evaluate(ws, limit, trigger::to_generic(pop.get_pop().id), this_slot, from_slot)) {
549 plist.push_back(pop.get_pop().id);
555 for(
auto pop : ws.world.province_get_pop_location(p)) {
556 if(pop.get_pop().get_poptype().get_strata() == uint8_t(culture::pop_strata::poor)) {
557 plist.push_back(pop.get_pop().id);
569 std::vector<dcon::pop_id> plist;
573 for(
auto pop : ws.world.province_get_pop_location(
trigger::to_prov(primary_slot))) {
575 plist.push_back(pop.get_pop().id);
579 for(
auto pop : ws.world.province_get_pop_location(
trigger::to_prov(primary_slot))) {
581 plist.push_back(pop.get_pop().id);
592 std::vector<dcon::pop_id> plist;
596 for(
auto p : ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot))) {
597 for(
auto pop : p.get_province().get_pop_location()) {
600 plist.push_back(pop.get_pop().id);
605 for(
auto p : ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot))) {
606 for(
auto pop : p.get_province().get_pop_location()) {
608 plist.push_back(pop.get_pop().id);
620 std::vector<dcon::pop_id> plist;
625 for(
auto pop : ws.world.province_get_pop_location(p)) {
626 if(pop.get_pop().get_poptype().get_strata() == uint8_t(culture::pop_strata::middle) && trigger::evaluate(ws, limit, trigger::to_generic(pop.get_pop().id), this_slot, from_slot)) {
627 plist.push_back(pop.get_pop().id);
633 for(
auto pop : ws.world.province_get_pop_location(p)) {
634 if(pop.get_pop().get_poptype().get_strata() == uint8_t(culture::pop_strata::middle)) {
635 plist.push_back(pop.get_pop().id);
646 std::vector<dcon::pop_id> plist;
650 for(
auto pop : ws.world.province_get_pop_location(
trigger::to_prov(primary_slot))) {
653 plist.push_back(pop.get_pop().id);
657 for(
auto pop : ws.world.province_get_pop_location(
trigger::to_prov(primary_slot))) {
659 plist.push_back(pop.get_pop().id);
667 std::vector<dcon::pop_id> plist;
671 for(
auto p : ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot))) {
672 for(
auto pop : p.get_province().get_pop_location()) {
675 plist.push_back(pop.get_pop().id);
680 for(
auto p : ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot))) {
681 for(
auto pop : p.get_province().get_pop_location()) {
683 plist.push_back(pop.get_pop().id);
695 std::vector<dcon::pop_id> plist;
700 for(
auto pop : ws.world.province_get_pop_location(p)) {
701 if(pop.get_pop().get_poptype().get_strata() == uint8_t(culture::pop_strata::rich) && trigger::evaluate(ws, limit, trigger::to_generic(pop.get_pop().id), this_slot, from_slot)) {
702 plist.push_back(pop.get_pop().id);
708 for(
auto pop : ws.world.province_get_pop_location(p)) {
709 if(pop.get_pop().get_poptype().get_strata() == uint8_t(culture::pop_strata::rich)) {
710 plist.push_back(pop.get_pop().id);
722 std::vector<dcon::pop_id> plist;
726 for(
auto pop : ws.world.province_get_pop_location(
trigger::to_prov(primary_slot))) {
728 plist.push_back(pop.get_pop().id);
732 for(
auto pop : ws.world.province_get_pop_location(
trigger::to_prov(primary_slot))) {
734 plist.push_back(pop.get_pop().id);
744 std::vector<dcon::pop_id> rlist;
747 for(
auto p : ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot))) {
748 for(
auto pop : p.get_province().get_pop_location()) {
750 rlist.push_back(pop.get_pop().id);
755 for(
auto p : ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot))) {
756 for(
auto pop : p.get_province().get_pop_location()) {
757 rlist.push_back(pop.get_pop().id);
761 if(rlist.size() != 0) {
768 std::vector<dcon::pop_id> plist;
772 for(
auto p : ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot))) {
773 for(
auto pop : p.get_province().get_pop_location()) {
775 plist.push_back(pop.get_pop().id);
780 for(
auto p : ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot))) {
781 for(
auto pop : p.get_province().get_pop_location()) {
782 plist.push_back(pop.get_pop().id);
794 std::vector<dcon::pop_id> rlist;
798 for(
auto pop : ws.world.province_get_pop_location(p)) {
799 if(trigger::evaluate(ws, limit, trigger::to_generic(pop.get_pop().id), this_slot, from_slot)) {
800 rlist.push_back(pop.get_pop().id);
806 for(
auto pop : ws.world.province_get_pop_location(p)) {
807 rlist.push_back(pop.get_pop().id);
811 if(rlist.size() != 0) {
818 std::vector<dcon::pop_id> plist;
823 for(
auto pop : ws.world.province_get_pop_location(p)) {
824 if(trigger::evaluate(ws, limit, trigger::to_generic(pop.get_pop().id), this_slot, from_slot)) {
825 plist.push_back(pop.get_pop().id);
831 for(
auto pop : ws.world.province_get_pop_location(p)) {
832 plist.push_back(pop.get_pop().id);
844 std::vector<dcon::pop_id> rlist;
848 for(
auto pop : ws.world.province_get_pop_location(
trigger::to_prov(primary_slot))) {
850 rlist.push_back(pop.get_pop().id);
854 for(
auto pop : ws.world.province_get_pop_location(
trigger::to_prov(primary_slot))) {
855 rlist.push_back(pop.get_pop().id);
859 if(rlist.size() != 0) {
866 std::vector<dcon::pop_id> plist;
870 for(
auto pop : ws.world.province_get_pop_location(
trigger::to_prov(primary_slot))) {
872 plist.push_back(pop.get_pop().id);
876 for(
auto pop : ws.world.province_get_pop_location(
trigger::to_prov(primary_slot))) {
877 plist.push_back(pop.get_pop().id);
888 std::vector<dcon::province_id> rlist;
892 for(
auto p : ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot))) {
894 rlist.push_back(p.get_province().id);
898 for(
auto p : ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot))) {
899 rlist.push_back(p.get_province().id);
903 if(rlist.size() != 0) {
909 std::vector<dcon::province_id> plist;
913 for(
auto p : ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot))) {
915 plist.push_back(p.get_province());
919 for(
auto p : ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot))) {
920 plist.push_back(p.get_province());
925 for(
auto p : plist) {
933 std::vector<dcon::province_id> rlist;
948 if(rlist.size() != 0) {
971 auto tag = ws.world.nation_get_identity_from_identity_holder(
trigger::to_nation(primary_slot));
972 auto cores_range = ws.world.national_identity_get_core(tag);
975 std::vector<dcon::province_id> rlist;
979 for(
auto p : cores_range) {
981 rlist.push_back(p.get_province().id);
984 for(
auto p : cores_range) {
985 rlist.push_back(p.get_province().id);
989 if(rlist.size() != 0) {
995 std::vector<dcon::province_id> plist;
999 for(
auto p : cores_range) {
1001 plist.push_back(p.get_province());
1004 for(
auto p : cores_range) {
1005 plist.push_back(p.get_province());
1010 for(
auto p : plist) {
1018 auto cores_range = ws.world.province_get_core(prov);
1021 std::vector<dcon::nation_id> rlist;
1025 for(
auto p : cores_range) {
1026 auto h = p.get_identity().get_nation_from_identity_holder();
1028 rlist.push_back(h.id);
1031 for(
auto p : cores_range) {
1032 auto h = p.get_identity().get_nation_from_identity_holder();
1034 rlist.push_back(h.id);
1038 if(rlist.size() != 0) {
1044 std::vector<dcon::nation_id> plist;
1048 for(
auto p : cores_range) {
1049 auto h = p.get_identity().get_nation_from_identity_holder();
1054 for(
auto p : cores_range) {
1055 auto h = p.get_identity().get_nation_from_identity_holder();
1062 for(
auto p : plist) {
1070 std::vector<dcon::state_instance_id> rlist;
1074 for(
auto si : ws.world.nation_get_state_ownership(
trigger::to_nation(primary_slot))) {
1076 rlist.push_back(si.get_state().id);
1079 for(
auto si : ws.world.nation_get_state_ownership(
trigger::to_nation(primary_slot))) {
1080 rlist.push_back(si.get_state().id);
1083 if(rlist.size() != 0) {
1089 std::vector<dcon::state_instance_id> slist;
1093 for(
auto si : ws.world.nation_get_state_ownership(
trigger::to_nation(primary_slot))) {
1095 slist.push_back(si.get_state());
1098 for(
auto si : ws.world.nation_get_state_ownership(
trigger::to_nation(primary_slot))) {
1099 slist.push_back(si.get_state());
1104 for(
auto p : slist) {
1112 std::vector<dcon::nation_id> rlist;
1116 for(
auto si : ws.world.nation_get_overlord_as_ruler(
trigger::to_nation(primary_slot))) {
1118 rlist.push_back(si.get_subject().id);
1121 for(
auto si : ws.world.nation_get_overlord_as_ruler(
trigger::to_nation(primary_slot))) {
1122 if(si.get_subject().get_is_substate())
1123 rlist.push_back(si.get_subject().id);
1126 if(rlist.size() != 0) {
1135 for(
auto si : ws.world.nation_get_overlord_as_ruler(
trigger::to_nation(primary_slot))) {
1141 for(
auto si : ws.world.nation_get_overlord_as_ruler(
trigger::to_nation(primary_slot))) {
1142 if(si.get_subject().get_is_substate()) {
1152 auto chances_total = tval[2];
1156 auto sub_units_start = tval + 3;
1157 while(sub_units_start < tval + source_size) {
1158 r -= *sub_units_start;
1160 return 1 +
internal_execute_effect(sub_units_start + 1, ws, primary_slot, this_slot, from_slot, r_hi, r_lo + 1, els);
1167 auto chance = tval[2];
1170 return 1 +
apply_subeffects(tval, ws, primary_slot, this_slot, from_slot, r_hi, r_lo + 1, els);
1174 auto mod_k = dcon::value_modifier_key{ dcon::value_modifier_key::value_base_t(tval[2]) };
1179 return 1 +
apply_subeffects(tval, ws, primary_slot, this_slot, from_slot, r_hi, r_lo + 1, els);
1183 if(
auto owner = ws.world.state_instance_get_nation_from_state_ownership(
trigger::to_state(primary_slot)); owner)
1188 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot)); owner)
1193 if(
auto controller = ws.world.province_get_nation_from_province_control(
trigger::to_prov(primary_slot)); controller)
1198 if(
auto owner = ws.world.pop_get_province_from_pop_location(
trigger::to_pop(primary_slot)); owner)
1209 auto owner = ws.world.state_instance_get_nation_from_state_ownership(
trigger::to_state(primary_slot));
1221 auto owner = ws.world.nation_get_capital(ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot)));
1227 return apply_subeffects(tval, ws, this_slot, this_slot, from_slot, r_hi, r_lo, els);
1230 return apply_subeffects(tval, ws, this_slot, this_slot, from_slot, r_hi, r_lo, els);
1233 return apply_subeffects(tval, ws, this_slot, this_slot, from_slot, r_hi, r_lo, els);
1236 return apply_subeffects(tval, ws, this_slot, this_slot, from_slot, r_hi, r_lo, els);
1239 return apply_subeffects(tval, ws, from_slot, this_slot, from_slot, r_hi, r_lo, els);
1242 return apply_subeffects(tval, ws, from_slot, this_slot, from_slot, r_hi, r_lo, els);
1245 return apply_subeffects(tval, ws, from_slot, this_slot, from_slot, r_hi, r_lo, els);
1248 return apply_subeffects(tval, ws, from_slot, this_slot, from_slot, r_hi, r_lo, els);
1252 for(
auto adj : pid.get_province_adjacency()) {
1253 if(adj.get_connected_provinces(0).id.index() >= ws.province_definitions.first_sea_province.index()) {
1255 }
else if(adj.get_connected_provinces(1).id.index() >= ws.province_definitions.first_sea_province.index()) {
1262 auto cultures = ws.world.nation_get_primary_culture(
trigger::to_nation(primary_slot));
1263 auto cg = ws.world.culture_get_group_from_culture_group_membership(cultures);
1264 auto union_tags = ws.world.culture_group_get_identity_from_cultural_union_of(cg);
1265 auto group_holders = ws.world.national_identity_get_nation_from_identity_holder(union_tags);
1271 auto overlord = ws.world.nation_get_overlord_as_subject(
trigger::to_nation(primary_slot));
1272 auto on = ws.world.overlord_get_ruler(overlord);
1278 auto sphere_leader = ws.world.nation_get_in_sphere_of(
trigger::to_nation(primary_slot));
1284 auto rtag = ws.world.rebel_faction_get_defection_target(
trigger::to_rebel(primary_slot));
1285 auto rnation = ws.world.national_identity_get_nation_from_identity_holder(rtag);
1291 auto ctag = ws.world.state_instance_get_flashpoint_tag(
trigger::to_state(primary_slot));
1292 auto rnation = ws.world.national_identity_get_nation_from_identity_holder(ctag);
1298 auto cstate = ws.crisis_state_instance;
1304 auto state = ws.world.province_get_state_membership(
trigger::to_prov(primary_slot));
1310 auto pop_province = ws.world.pop_get_province_from_pop_location(
trigger::to_pop(primary_slot));
1311 auto state = ws.world.province_get_state_membership(pop_province);
1320 auto tag_holder = ws.world.national_identity_get_nation_from_identity_holder(tag);
1326 auto tag_holder = ws.world.national_identity_get_nation_from_identity_holder(tag);
1351 for(
auto p : ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot))) {
1352 for(
auto pop : p.get_province().get_pop_location()) {
1360 for(
auto p : ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot))) {
1361 for(
auto pop : p.get_province().get_pop_location()) {
1362 if(pop.get_pop().get_poptype() == type) {
1376 for(
auto pop : ws.world.province_get_pop_location(p)) {
1377 if(pop.get_pop().get_poptype() == type && trigger::evaluate(ws, limit, trigger::to_generic(pop.get_pop().id), this_slot, from_slot)) {
1378 i += apply_subeffects(tval, ws, trigger::to_generic(pop.get_pop().id), this_slot, from_slot, r_hi, r_lo + i, els);
1387 for(
auto pop : ws.world.province_get_pop_location(p)) {
1388 if(pop.get_pop().get_poptype() == type) {
1389 i += apply_subeffects(tval, ws, trigger::to_generic(pop.get_pop().id), this_slot, from_slot, r_hi, r_lo + i, els);
1402 for(
auto pop : ws.world.province_get_pop_location(
trigger::to_prov(primary_slot))) {
1403 if(pop.get_pop().get_poptype() == type &&
1413 for(
auto pop : ws.world.province_get_pop_location(
trigger::to_prov(primary_slot))) {
1414 if(pop.get_pop().get_poptype() == type) {
1426 for(
auto p : ws.world.state_definition_get_abstract_state_membership(region)) {
1433 for(
auto p : ws.world.state_definition_get_abstract_state_membership(region)) {
1444 for(
auto p : ws.world.region_get_region_membership(region)) {
1451 for(
auto p : ws.world.region_get_region_membership(region)) {
1463 if(ws.world.province_get_nation_from_province_ownership(new_capital) ==
trigger::to_nation(primary_slot))
1478 auto tag = ws.world.nation_get_identity_from_identity_holder(
trigger::to_nation(primary_slot));
1484 auto tag = ws.world.nation_get_identity_from_identity_holder(
trigger::to_nation(this_slot));
1490 auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(this_slot));
1492 return ef_add_core_this_nation(tval, ws, primary_slot,
trigger::to_generic(owner), 0, r_hi, r_lo, els);
1497 auto owner = ws.world.state_instance_get_nation_from_state_ownership(
trigger::to_state(this_slot));
1499 return ef_add_core_this_nation(tval, ws, primary_slot,
trigger::to_generic(owner), 0, r_hi, r_lo, els);
1506 return ef_add_core_this_nation(tval, ws, primary_slot,
trigger::to_generic(owner), 0, r_hi, r_lo, els);
1511 auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(from_slot));
1513 return ef_add_core_this_nation(tval, ws, primary_slot,
trigger::to_generic(owner), 0, r_hi, r_lo, els);
1518 return ef_add_core_this_nation(tval, ws, primary_slot, from_slot, 0, r_hi, r_lo, els);
1521 auto tag = ws.world.rebel_faction_get_defection_target(
trigger::to_rebel(from_slot));
1527 auto tag = ws.world.nation_get_identity_from_identity_holder(
trigger::to_nation(this_slot));
1533 auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(this_slot));
1535 return ef_add_core_state_this_nation(tval, ws, primary_slot,
trigger::to_generic(owner), 0, r_hi, r_lo, els);
1540 auto owner = ws.world.state_instance_get_nation_from_state_ownership(
trigger::to_state(this_slot));
1542 return ef_add_core_state_this_nation(tval, ws, primary_slot,
trigger::to_generic(owner), 0, r_hi, r_lo, els);
1549 return ef_add_core_state_this_nation(tval, ws, primary_slot,
trigger::to_generic(owner), 0, r_hi, r_lo, els);
1554 auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(from_slot));
1556 return ef_add_core_state_this_nation(tval, ws, primary_slot,
trigger::to_generic(owner), 0, r_hi, r_lo, els);
1561 auto tag = ws.world.nation_get_identity_from_identity_holder(
trigger::to_nation(from_slot));
1567 auto tag = ws.world.rebel_faction_get_defection_target(
trigger::to_rebel(from_slot));
1587 for(
auto p : ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot))) {
1593 auto tag = ws.world.nation_get_identity_from_identity_holder(
trigger::to_nation(primary_slot));
1599 auto tag = ws.world.nation_get_identity_from_identity_holder(
trigger::to_nation(this_slot));
1600 for(
auto p : ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot))) {
1606 auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(this_slot));
1613 auto owner = ws.world.state_instance_get_nation_from_state_ownership(
trigger::to_state(this_slot));
1627 auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(from_slot));
1636 auto tag = ws.world.rebel_faction_get_defection_target(
trigger::to_rebel(from_slot));
1637 for(
auto p : ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot))) {
1643 auto tag = ws.world.nation_get_identity_from_identity_holder(
trigger::to_nation(this_slot));
1650 auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(this_slot));
1657 auto owner = ws.world.state_instance_get_nation_from_state_ownership(
trigger::to_state(this_slot));
1671 auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(from_slot));
1680 auto tag = ws.world.rebel_faction_get_defection_target(
trigger::to_rebel(from_slot));
1687 auto tag = ws.world.nation_get_identity_from_identity_holder(
trigger::to_nation(this_slot));
1693 auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(this_slot));
1695 return ef_remove_core_this_nation(tval, ws, primary_slot,
trigger::to_generic(owner), 0, r_hi, r_lo, els);
1700 auto owner = ws.world.state_instance_get_nation_from_state_ownership(
trigger::to_state(this_slot));
1702 return ef_remove_core_this_nation(tval, ws, primary_slot,
trigger::to_generic(owner), 0, r_hi, r_lo, els);
1709 return ef_remove_core_this_nation(tval, ws, primary_slot,
trigger::to_generic(owner), 0, r_hi, r_lo, els);
1714 auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(from_slot));
1716 return ef_remove_core_this_nation(tval, ws, primary_slot,
trigger::to_generic(owner), 0, r_hi, r_lo, els);
1720 return ef_remove_core_this_nation(tval, ws, primary_slot, from_slot, 0, r_hi, r_lo, els);
1723 auto tag = ws.world.rebel_faction_get_defection_target(
trigger::to_rebel(from_slot));
1728 auto def = ws.world.state_instance_get_definition(
trigger::to_state(primary_slot));
1730 ws.world.state_definition_set_name(def, name);
1734 auto def = ws.world.province_get_state_from_abstract_state_membership(
trigger::to_prov(primary_slot));
1737 ws.world.state_definition_set_name(def, name);
1754 auto prim_culture = ws.world.nation_get_primary_culture(
trigger::to_nation(primary_slot));
1755 auto cg = ws.world.culture_get_group_from_culture_group_membership(prim_culture);
1756 for(
auto c : ws.world.culture_group_get_culture_group_membership(cg)) {
1757 if(ws.world.nation_get_primary_culture(
trigger::to_nation(primary_slot)) != c.get_member().id) {
1758 ws.world.nation_set_accepted_cultures(
trigger::to_nation(primary_slot), c.get_member().id,
true);
1775 auto prim_culture = ws.world.nation_get_primary_culture(
trigger::to_nation(this_slot));
1776 auto cg = ws.world.culture_get_group_from_culture_group_membership(prim_culture);
1777 for(
auto c : ws.world.culture_group_get_culture_group_membership(cg)) {
1778 if(ws.world.nation_get_primary_culture(
trigger::to_nation(primary_slot)) != c.get_member().id) {
1779 ws.world.nation_set_accepted_cultures(
trigger::to_nation(primary_slot), c.get_member().id,
true);
1795 auto prim_culture = ws.world.nation_get_primary_culture(
trigger::to_nation(from_slot));
1796 auto cg = ws.world.culture_get_group_from_culture_group_membership(prim_culture);
1797 for(
auto c : ws.world.culture_group_get_culture_group_membership(cg)) {
1798 if(ws.world.nation_get_primary_culture(
trigger::to_nation(primary_slot)) != c.get_member().id) {
1799 ws.world.nation_set_accepted_cultures(
trigger::to_nation(primary_slot), c.get_member().id,
true);
1815 ws.world.nation_set_accepted_cultures(
trigger::to_nation(primary_slot), c.id,
false);
1820 auto owner = ws.world.state_instance_get_nation_from_state_ownership(
trigger::to_state(this_slot));
1822 auto c = ws.world.nation_get_primary_culture(owner);
1824 ws.world.nation_set_accepted_cultures(
trigger::to_nation(primary_slot), c.id,
false);
1830 auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(this_slot));
1832 auto c = ws.world.nation_get_primary_culture(owner);
1834 ws.world.nation_set_accepted_cultures(
trigger::to_nation(primary_slot), c.id,
false);
1842 auto c = ws.world.nation_get_primary_culture(owner);
1844 ws.world.nation_set_accepted_cultures(
trigger::to_nation(primary_slot), c.id,
false);
1852 ws.world.nation_set_accepted_cultures(
trigger::to_nation(primary_slot), c.id,
false);
1870 ws.world.province_set_life_rating(
1882 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot)); owner) {
1883 auto owner_c = ws.world.nation_get_primary_culture(owner);
1884 for(
auto pop : ws.world.province_get_pop_location(
trigger::to_prov(primary_slot))) {
1897 [&](dcon::province_id p) { ws.world.province_set_is_slave(p,
true); });
1905 ws.world.pop_set_poptype(
trigger::to_pop(primary_slot), ws.culture_definitions.slaves);
1923 .get_government_change(ws.world.nation_get_government_type(
trigger::to_nation(primary_slot)));
1931 assert(std::isfinite(amount));
1936 t = std::max(0.0f, t + amount);
1942 assert(std::isfinite(amount));
1943 war_x = std::clamp(war_x + amount, 0.0f, 100.0f);
1947 auto& dippts = ws.world.nation_get_diplomatic_points(
trigger::to_nation(primary_slot));
1949 assert(std::isfinite(amount));
1950 dippts = std::max(0.0f, dippts + amount);
1955 assert(std::isfinite(amount));
1960 auto tag = ws.world.nation_get_identity_from_identity_holder(
trigger::to_nation(primary_slot));
1962 auto old_holder = ws.world.national_identity_get_nation_from_identity_holder(
trigger::payload(tval[1]).tag_id);
1966 ws.world.nation_set_identity_from_identity_holder(old_holder, tag);
1972 auto prim_culture = ws.world.nation_get_primary_culture(
trigger::to_nation(primary_slot));
1973 auto cg = ws.world.culture_get_group_from_culture_group_membership(prim_culture);
1974 auto u = ws.world.culture_group_get_identity_from_cultural_union_of(cg);
1978 auto old_holder = ws.world.national_identity_get_nation_from_identity_holder(u);
1979 auto tag = ws.world.nation_get_identity_from_identity_holder(
trigger::to_nation(primary_slot));
1981 ws.world.nation_set_identity_from_identity_holder(
trigger::to_nation(primary_slot), u);
1984 ws.world.nation_set_identity_from_identity_holder(old_holder, tag);
1990 auto holder = ws.world.national_identity_get_nation_from_identity_holder(
trigger::payload(tval[1]).tag_id);
1996 }
else if(ws.world.nation_get_is_player_controlled(holder)) {
2000 auto old_controller = ws.world.nation_get_is_player_controlled(holder);
2001 ws.world.nation_set_is_player_controlled(holder, ws.world.nation_get_is_player_controlled(
trigger::to_nation(primary_slot)));
2002 ws.world.nation_set_is_player_controlled(
trigger::to_nation(primary_slot), old_controller);
2006 if(ws.world.nation_get_is_player_controlled(holder))
2010 ws.local_player_nation = holder;
2011 }
else if(ws.local_player_nation == holder) {
2017 auto prim_culture = ws.world.nation_get_primary_culture(
trigger::to_nation(primary_slot));
2018 auto cg = ws.world.culture_get_group_from_culture_group_membership(prim_culture);
2019 auto u = ws.world.culture_group_get_identity_from_cultural_union_of(cg);
2020 auto holder = ws.world.national_identity_get_nation_from_identity_holder(u);
2026 }
else if(ws.world.nation_get_is_player_controlled(holder)) {
2030 auto old_controller = ws.world.nation_get_is_player_controlled(holder);
2031 ws.world.nation_set_is_player_controlled(holder, ws.world.nation_get_is_player_controlled(
trigger::to_nation(primary_slot)));
2032 ws.world.nation_set_is_player_controlled(
trigger::to_nation(primary_slot), old_controller);
2036 if(ws.world.nation_get_is_player_controlled(holder))
2040 ws.local_player_nation = holder;
2041 }
else if(ws.local_player_nation == holder) {
2055 auto target = ws.world.national_identity_get_nation_from_identity_holder(
trigger::payload(tval[1]).tag_id);
2065 auto target = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(this_slot));
2075 auto target = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(from_slot));
2083 assert(std::isfinite(amount));
2084 inf = std::max(0.0f, inf + amount);
2088 auto holder = ws.world.national_identity_get_nation_from_identity_holder(
trigger::payload(tval[1]).tag_id);
2091 auto hprovs = ws.world.nation_get_province_ownership(holder);
2092 if(hprovs.begin() == hprovs.end()) {
2093 auto powner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot));
2101 auto holder = ws.world.national_identity_get_nation_from_identity_holder(
trigger::payload(tval[1]).tag_id);
2104 auto hprovs = ws.world.nation_get_province_ownership(holder);
2105 if(hprovs.begin() == hprovs.end()) {
2106 auto powner = ws.world.state_instance_get_nation_from_state_ownership(
trigger::to_state(primary_slot));
2116 auto hprovs = ws.world.nation_get_province_ownership(target);
2117 if(hprovs.begin() == hprovs.end()) {
2118 auto powner = ws.world.state_instance_get_nation_from_state_ownership(
trigger::to_state(primary_slot));
2127 auto target = ws.world.state_instance_get_nation_from_state_ownership(
trigger::to_state(this_slot));
2130 auto hprovs = ws.world.nation_get_province_ownership(target);
2131 if(hprovs.begin() == hprovs.end()) {
2132 auto powner = ws.world.state_instance_get_nation_from_state_ownership(
trigger::to_state(primary_slot));
2141 auto target = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(this_slot));
2144 auto hprovs = ws.world.nation_get_province_ownership(target);
2145 if(hprovs.begin() == hprovs.end()) {
2146 auto powner = ws.world.state_instance_get_nation_from_state_ownership(
trigger::to_state(primary_slot));
2158 auto hprovs = ws.world.nation_get_province_ownership(target);
2159 if(hprovs.begin() == hprovs.end()) {
2160 auto powner = ws.world.state_instance_get_nation_from_state_ownership(
trigger::to_state(primary_slot));
2169 return ef_secede_province_state_this_nation(tval, ws, primary_slot, from_slot, 0, r_hi, r_lo, els);
2172 return ef_secede_province_state_this_province(tval, ws, primary_slot, from_slot, 0, r_hi, r_lo, els);
2175 auto target = ws.world.rebel_faction_get_defection_target(
trigger::to_rebel(from_slot));
2176 auto holder = ws.world.national_identity_get_nation_from_identity_holder(target);
2179 auto hprovs = ws.world.nation_get_province_ownership(holder);
2180 if(hprovs.begin() == hprovs.end()) {
2181 auto powner = ws.world.state_instance_get_nation_from_state_ownership(
trigger::to_state(primary_slot));
2192 auto hprovs = ws.world.nation_get_province_ownership(target);
2193 if(hprovs.begin() == hprovs.end()) {
2194 auto powner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot));
2202 auto target = ws.world.state_instance_get_nation_from_state_ownership(
trigger::to_state(this_slot));
2205 auto hprovs = ws.world.nation_get_province_ownership(target);
2206 if(hprovs.begin() == hprovs.end()) {
2207 auto powner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot));
2215 auto target = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(this_slot));
2218 auto hprovs = ws.world.nation_get_province_ownership(target);
2219 if(hprovs.begin() == hprovs.end()) {
2220 auto powner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot));
2231 auto hprovs = ws.world.nation_get_province_ownership(target);
2232 if(hprovs.begin() == hprovs.end()) {
2233 auto powner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot));
2241 return ef_secede_province_this_nation(tval, ws, primary_slot, from_slot, 0, r_hi, r_lo, els);
2244 return ef_secede_province_this_province(tval, ws, primary_slot, from_slot, 0, r_hi, r_lo, els);
2247 auto target = ws.world.rebel_faction_get_defection_target(
trigger::to_rebel(from_slot));
2248 auto holder = ws.world.national_identity_get_nation_from_identity_holder(target);
2251 auto hprovs = ws.world.nation_get_province_ownership(holder);
2252 if(hprovs.begin() == hprovs.end()) {
2253 auto powner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot));
2261 auto holder = ws.world.national_identity_get_nation_from_identity_holder(
trigger::payload(tval[1]).tag_id);
2264 auto hprovs = ws.world.nation_get_province_ownership(holder);
2265 auto sprovs = ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot));
2266 if(sprovs.begin() == sprovs.end()) {
2269 while(hprovs.begin() != hprovs.end()) {
2278 auto hprovs = ws.world.nation_get_province_ownership(holder);
2279 auto sprovs = ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot));
2280 if(sprovs.begin() == sprovs.end()) {
2283 while(hprovs.begin() != hprovs.end()) {
2289 auto holder = ws.world.state_instance_get_nation_from_state_ownership(
trigger::to_state(this_slot));
2292 auto hprovs = ws.world.nation_get_province_ownership(holder);
2293 auto sprovs = ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot));
2294 if(sprovs.begin() == sprovs.end()) {
2297 while(hprovs.begin() != hprovs.end()) {
2303 auto holder = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(this_slot));
2306 auto hprovs = ws.world.nation_get_province_ownership(holder);
2307 auto sprovs = ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot));
2308 if(sprovs.begin() == sprovs.end()) {
2311 while(hprovs.begin() != hprovs.end()) {
2320 auto hprovs = ws.world.nation_get_province_ownership(holder);
2321 auto sprovs = ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot));
2322 if(sprovs.begin() == sprovs.end()) {
2325 while(hprovs.begin() != hprovs.end()) {
2334 auto hprovs = ws.world.nation_get_province_ownership(holder);
2335 auto sprovs = ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot));
2336 if(sprovs.begin() == sprovs.end()) {
2339 while(hprovs.begin() != hprovs.end()) {
2345 auto holder = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(from_slot));
2348 auto hprovs = ws.world.nation_get_province_ownership(holder);
2349 auto sprovs = ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot));
2350 if(sprovs.begin() == sprovs.end()) {
2353 while(hprovs.begin() != hprovs.end()) {
2359 auto holder = ws.world.national_identity_get_nation_from_identity_holder(
trigger::payload(tval[1]).tag_id);
2362 auto hprovs = ws.world.nation_get_province_ownership(holder);
2363 auto sprovs = ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot));
2364 if(hprovs.begin() == hprovs.end()) {
2367 while(sprovs.begin() != sprovs.end()) {
2376 auto hprovs = ws.world.nation_get_province_ownership(holder);
2377 auto sprovs = ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot));
2378 if(hprovs.begin() == hprovs.end()) {
2381 while(sprovs.begin() != sprovs.end()) {
2387 auto holder = ws.world.state_instance_get_nation_from_state_ownership(
trigger::to_state(this_slot));
2390 auto hprovs = ws.world.nation_get_province_ownership(holder);
2391 auto sprovs = ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot));
2392 if(hprovs.begin() == hprovs.end()) {
2395 while(sprovs.begin() != sprovs.end()) {
2401 auto holder = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(this_slot));
2404 auto hprovs = ws.world.nation_get_province_ownership(holder);
2405 auto sprovs = ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot));
2406 if(hprovs.begin() == hprovs.end()) {
2409 while(sprovs.begin() != sprovs.end()) {
2418 auto hprovs = ws.world.nation_get_province_ownership(holder);
2419 auto sprovs = ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot));
2420 if(hprovs.begin() == hprovs.end()) {
2423 while(sprovs.begin() != sprovs.end()) {
2432 auto hprovs = ws.world.nation_get_province_ownership(holder);
2433 auto sprovs = ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot));
2434 if(hprovs.begin() == hprovs.end()) {
2437 while(sprovs.begin() != sprovs.end()) {
2443 auto holder = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(from_slot));
2446 auto hprovs = ws.world.nation_get_province_ownership(holder);
2447 auto sprovs = ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot));
2448 if(hprovs.begin() == hprovs.end()) {
2451 while(sprovs.begin() != sprovs.end()) {
2466 auto owner = ws.world.state_instance_get_nation_from_state_ownership(
trigger::to_state(this_slot));
2467 return ef_release_this_nation(tval, ws, primary_slot,
trigger::to_generic(owner), 0, r_hi, r_lo, els);
2470 auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(this_slot));
2471 return ef_release_this_nation(tval, ws, primary_slot,
trigger::to_generic(owner), 0, r_hi, r_lo, els);
2475 return ef_release_this_nation(tval, ws, primary_slot,
trigger::to_generic(owner), 0, r_hi, r_lo, els);
2483 auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(from_slot));
2484 return ef_release_this_nation(tval, ws, primary_slot,
trigger::to_generic(owner), 0, r_hi, r_lo, els);
2487 auto holder = ws.world.national_identity_get_nation_from_identity_holder(
trigger::payload(tval[1]).tag_id);
2500 auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(this_slot));
2513 auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(from_slot));
2521 auto holder = ws.world.national_identity_get_nation_from_identity_holder(
trigger::payload(tval[1]).tag_id);
2539 auto holder = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(this_slot));
2557 auto holder = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(from_slot));
2568 building_level =
uint8_t(std::clamp(int32_t(building_level) + int32_t(
trigger::payload(tval[1]).signed_value),
2571 ws.railroad_built.store(
true, std::memory_order::release);
2577 building_level =
uint8_t(std::clamp(int32_t(building_level) + int32_t(
trigger::payload(tval[1]).signed_value),
2581 ws.railroad_built.store(
true, std::memory_order::release);
2588 assert(std::isfinite(amount));
2589 m = std::max(0.0f, m + amount);
2597 auto holder = ws.world.national_identity_get_nation_from_identity_holder(
trigger::payload(tval[1]).tag_id);
2608 auto holder = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(this_slot));
2619 auto holder = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(from_slot));
2626 auto target = ws.world.national_identity_get_nation_from_identity_holder(
trigger::payload(tval[1]).tag_id);
2636 auto target = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(this_slot));
2646 auto target = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(from_slot));
2652 auto holder = ws.world.national_identity_get_nation_from_identity_holder(
trigger::payload(tval[1]).tag_id);
2675 auto target = ws.world.national_identity_get_nation_from_identity_holder(
trigger::payload(tval[1]).tag_id);
2706 assert(std::isfinite(amount));
2707 plur = std::clamp(plur + amount, 0.0f, 100.0f);
2726 auto holder = ws.world.national_identity_get_nation_from_identity_holder(
trigger::payload(tval[1]).tag_id);
2727 if(holder && ws.world.nation_get_owned_province_count(holder) != 0 && ws.world.nation_get_owned_province_count(
trigger::to_nation(primary_slot)) != 0)
2737 auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(this_slot));
2738 if(owner && ws.world.nation_get_owned_province_count(owner) != 0 && ws.world.nation_get_owned_province_count(
trigger::to_nation(primary_slot)) != 0)
2748 auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(from_slot));
2749 if(owner && ws.world.nation_get_owned_province_count(owner) != 0 && ws.world.nation_get_owned_province_count(
trigger::to_nation(primary_slot)) != 0)
2754 auto holder = ws.world.national_identity_get_nation_from_identity_holder(
trigger::payload(tval[1]).tag_id);
2757 auto hprovs = ws.world.nation_get_province_ownership(holder);
2758 if(hprovs.begin() == hprovs.end()) {
2760 if(ws.world.nation_get_owned_province_count(holder) == 0)
2764 auto sr = ws.world.force_create_gp_relationship(holder,
trigger::to_nation(primary_slot));
2765 auto& flags = ws.world.gp_relationship_get_status(sr);
2770 auto rel = ws.world.nation_get_overlord_as_subject(holder);
2779 if(hprovs.begin() == hprovs.end()) {
2787 auto& flags = ws.world.gp_relationship_get_status(sr);
2800 auto holder = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(this_slot));
2803 auto hprovs = ws.world.nation_get_province_ownership(holder);
2804 if(hprovs.begin() == hprovs.end()) {
2807 if(ws.world.nation_get_owned_province_count(holder) == 0)
2811 auto sr = ws.world.force_create_gp_relationship(holder,
trigger::to_nation(primary_slot));
2812 auto& flags = ws.world.gp_relationship_get_status(sr);
2817 auto rel = ws.world.nation_get_overlord_as_subject(holder);
2826 if(hprovs.begin() == hprovs.end()) {
2834 auto& flags = ws.world.gp_relationship_get_status(sr);
2847 auto holder = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(from_slot));
2850 auto hprovs = ws.world.nation_get_province_ownership(holder);
2851 if(hprovs.begin() == hprovs.end()) {
2854 if(ws.world.nation_get_owned_province_count(holder) == 0)
2858 auto sr = ws.world.force_create_gp_relationship(holder,
trigger::to_nation(primary_slot));
2859 auto& flags = ws.world.gp_relationship_get_status(sr);
2864 auto rel = ws.world.nation_get_overlord_as_subject(holder);
2872 auto itag = ws.world.rebel_faction_get_defection_target(
trigger::to_rebel(from_slot));
2873 auto holder = ws.world.national_identity_get_nation_from_identity_holder(itag);
2876 auto hprovs = ws.world.nation_get_province_ownership(holder);
2877 if(hprovs.begin() == hprovs.end()) {
2879 if(ws.world.nation_get_owned_province_count(holder) == 0)
2883 auto sr = ws.world.force_create_gp_relationship(holder,
trigger::to_nation(primary_slot));
2884 auto& flags = ws.world.gp_relationship_get_status(sr);
2889 auto rel = ws.world.nation_get_overlord_as_subject(holder);
2901 auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot));
2903 return ef_release_vassal(tval, ws,
trigger::to_generic(owner), this_slot, from_slot, r_hi, r_lo, els);
2908 auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot));
2910 return ef_release_vassal_this_nation(tval, ws,
trigger::to_generic(owner), this_slot, from_slot, r_hi, r_lo, els);
2915 auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot));
2917 return ef_release_vassal_this_province(tval, ws,
trigger::to_generic(owner), this_slot, from_slot, r_hi, r_lo, els);
2922 auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot));
2924 return ef_release_vassal_from_nation(tval, ws,
trigger::to_generic(owner), this_slot, from_slot, r_hi, r_lo, els);
2929 auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot));
2931 return ef_release_vassal_from_province(tval, ws,
trigger::to_generic(owner), this_slot, from_slot, r_hi, r_lo, els);
2936 auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot));
2938 return ef_release_vassal_reb(tval, ws,
trigger::to_generic(owner), this_slot, from_slot, r_hi, r_lo, els);
2943 auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot));
2945 return ef_release_vassal_random(tval, ws,
trigger::to_generic(owner), this_slot, from_slot, r_hi, r_lo, els);
2959 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[1]).glob_id,
true);
2963 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[1]).glob_id,
false);
2967 auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot));
2969 ws.world.nation_set_national_value(owner,
trigger::payload(tval[1]).mod_id);
2986 ws.world.province_set_is_slave(p,
false);
2987 bool mine = ws.world.commodity_get_is_mine(ws.world.province_get_rgo(p));
2988 for(
auto pop : ws.world.province_get_pop_location(p)) {
2989 if(pop.get_pop().get_poptype() == ws.culture_definitions.slaves) {
2990 pop.get_pop().set_poptype(mine ? ws.culture_definitions.laborers : ws.culture_definitions.farmers);
2997 if(ws.world.pop_get_poptype(
trigger::to_pop(primary_slot)) == ws.culture_definitions.slaves) {
2998 bool mine = ws.world.commodity_get_is_mine(
2999 ws.world.province_get_rgo(ws.world.pop_get_province_from_pop_location(
trigger::to_pop(primary_slot))));
3001 mine ? ws.culture_definitions.laborers : ws.culture_definitions.farmers);
3007 ws.world.province_set_is_slave(p,
false);
3008 bool mine = ws.world.commodity_get_is_mine(ws.world.province_get_rgo(p));
3009 for(
auto pop : ws.world.province_get_pop_location(p)) {
3010 if(pop.get_pop().get_poptype() == ws.culture_definitions.slaves) {
3011 pop.get_pop().set_poptype(mine ? ws.culture_definitions.laborers : ws.culture_definitions.farmers);
3029 auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot));
3046 auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot));
3055 auto income = ws.world.nation_get_total_poor_income(
trigger::to_nation(primary_slot)) +
3059 assert(std::isfinite(amount));
3060 auto combined_amount = income * amount;
3061 assert(std::isfinite(combined_amount));
3065 v = v + combined_amount;
3067 v = std::max(v + combined_amount, 0.0f);
3076 assert(std::isfinite(amount));
3088 assert(std::isfinite(amount));
3089 for(
auto p : ws.world.province_get_pop_location(
trigger::to_prov(primary_slot))) {
3090 p.get_pop().get_size() *= amount;
3096 assert(std::isfinite(amount));
3097 for(
auto pr : ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot))) {
3098 for(
auto p : pr.get_province().get_pop_location()) {
3099 p.get_pop().get_size() *= amount;
3106 assert(std::isfinite(amount));
3108 for(
auto p : ws.world.province_get_pop_location(pr)) {
3109 p.get_pop().get_size() *= amount;
3125 assert(std::isfinite(amount));
3133 assert(std::isfinite(amount));
3136 (ws.world.nation_get_modifier_values(
trigger::to_nation(primary_slot), sys::national_mod_offsets::prestige) + 1.0f) *
3144 assert(std::isfinite(amount));
3146 bp = std::max(0.0f, bp + (score)*amount);
3164 std::vector<dcon::reform_option_id> active_reforms;
3166 for(
auto issue : ws.world.in_reform) {
3168 ws.world.nation_get_reforms(nation_id, issue) != ws.world.reform_get_options(issue)[0])
3169 active_reforms.push_back(ws.world.reform_get_options(issue)[0]);
3171 for(int32_t i = tval[1] - 1; active_reforms.size() != 0 && i >= 0; --i) {
3174 active_reforms[r] = active_reforms.back();
3175 active_reforms.pop_back();
3182 std::vector<dcon::reform_option_id> active_reforms;
3184 for(
auto issue : ws.world.in_reform) {
3186 ws.world.nation_get_reforms(nation_id, issue) != ws.world.reform_get_options(issue)[0])
3187 active_reforms.push_back(ws.world.reform_get_options(issue)[0]);
3189 for(int32_t i = tval[1] - 1; active_reforms.size() != 0 && i >= 0; --i) {
3192 active_reforms[r] = active_reforms.back();
3193 active_reforms.pop_back();
3204 ws.world.province_set_crime(
trigger::to_prov(primary_slot), dcon::crime_id{});
3213 auto cs = ws.world.province_get_state_membership(c);
3230 ws.military_definitions.great_wars_enabled =
true;
3234 ws.military_definitions.great_wars_enabled =
false;
3238 ws.military_definitions.world_wars_enabled =
true;
3242 ws.military_definitions.world_wars_enabled =
false;
3246 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot)); owner) {
3247 auto owner_c = ws.world.nation_get_primary_culture(owner);
3248 for(
auto pop : ws.world.province_get_pop_location(
trigger::to_prov(primary_slot))) {
3249 pop.get_pop().set_culture(owner_c);
3250 pop.get_pop().set_is_primary_or_accepted_culture(
true);
3256 if(
auto owner = ws.world.state_instance_get_nation_from_state_ownership(
trigger::to_state(primary_slot)); owner) {
3257 auto owner_c = ws.world.nation_get_primary_culture(owner);
3259 for(
auto pop : ws.world.province_get_pop_location(p)) {
3260 pop.get_pop().set_culture(owner_c);
3261 pop.get_pop().set_is_primary_or_accepted_culture(true);
3269 auto owner_c = ws.world.nation_get_primary_culture(owner);
3271 ws.world.pop_set_is_primary_or_accepted_culture(
trigger::to_pop(primary_slot),
true);
3286 assert(std::isfinite(amount));
3292 for(
auto& im : ws.crisis_participants) {
3298 im.merely_interested =
true;
3299 im.supports_attacker =
false;
3307 auto& current_tension = ws.world.state_instance_get_flashpoint_tension(
trigger::to_state(primary_slot));
3309 assert(std::isfinite(amount));
3311 current_tension = std::clamp(current_tension + amount, 0.0f, 100.0f);
3315 auto state = ws.world.province_get_state_membership(
trigger::to_prov(primary_slot));
3319 auto& current_tension = ws.world.state_instance_get_flashpoint_tension(state);
3321 assert(std::isfinite(amount));
3323 current_tension = std::clamp(current_tension + amount, 0.0f, 100.0f);
3328 assert(std::isfinite(amount));
3330 ws.crisis_temperature = std::clamp(ws.crisis_temperature + amount, 0.0f, 100.0f);
3335 assert(std::isfinite(amount));
3343 assert(std::isfinite(amount));
3344 for(
auto p : ws.world.province_get_pop_location(
trigger::to_prov(primary_slot))) {
3352 assert(std::isfinite(amount));
3353 for(
auto pr : ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot))) {
3354 for(
auto p : pr.get_province().get_pop_location()) {
3363 assert(std::isfinite(amount));
3365 for(
auto p : ws.world.province_get_pop_location(pr)) {
3366 auto c = pop_demographics::get_consciousness(ws, p.get_pop());
3367 pop_demographics::set_consciousness(ws, p.get_pop(), std::clamp(c + amount, 0.0f, 10.0f));
3374 assert(std::isfinite(amount));
3382 assert(std::isfinite(amount));
3383 for(
auto p : ws.world.province_get_pop_location(
trigger::to_prov(primary_slot))) {
3391 assert(std::isfinite(amount));
3392 for(
auto pr : ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot))) {
3393 for(
auto p : pr.get_province().get_pop_location()) {
3402 assert(std::isfinite(amount));
3404 for(
auto p : ws.world.province_get_pop_location(pr)) {
3405 auto c = pop_demographics::get_militancy(ws, p.get_pop());
3406 pop_demographics::set_militancy(ws, p.get_pop(), std::clamp(c + amount, 0.0f, 10.0f));
3418 building_level =
uint8_t(std::clamp(int32_t(building_level) + int32_t(
trigger::payload(tval[1]).signed_value),
3426 if(building_level > 0) {
3427 auto si = ws.world.province_get_state_membership(
trigger::to_prov(primary_slot));
3428 ws.world.state_instance_set_naval_base_is_taken(si,
true);
3454 lvl = std::max<uint32_t>(lvl, building_level);
3457 auto si = ws.world.province_get_state_membership(
trigger::to_prov(primary_slot));
3458 ws.world.state_instance_set_naval_base_is_taken(si,
true);
3483 if(
auto owner = ws.world.state_instance_get_nation_from_state_ownership(
trigger::to_state(primary_slot)); owner)
3489 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot)); owner)
3495 if(
auto holder = ws.world.national_identity_get_nation_from_identity_holder(
trigger::payload(tval[1]).
tag_id); holder)
3506 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(this_slot)); owner)
3517 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(from_slot)); owner)
3523 if(
auto holder = ws.world.national_identity_get_nation_from_identity_holder(
trigger::payload(tval[1]).
tag_id); holder)
3533 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(this_slot)); owner)
3543 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(from_slot)); owner)
3584 if(
auto holder = ws.world.national_identity_get_nation_from_identity_holder(tag_target); holder) {
3594 if(
auto holder = ws.world.province_get_nation_from_province_ownership(
trigger::payload(tval[3]).
prov_id); holder) {
3614 if(
auto holder = ws.world.state_instance_get_nation_from_state_ownership(
trigger::to_state(this_slot)); holder) {
3624 if(
auto holder = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(this_slot)); holder) {
3654 if(
auto holder = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(from_slot)); holder) {
3665 if(
auto holder = ws.world.national_identity_get_nation_from_identity_holder(tag_target); holder) {
3666 ws.world.nation_get_available_cbs(holder).push_back(
3675 if(
auto holder = ws.world.province_get_nation_from_province_ownership(
trigger::payload(tval[3]).
prov_id); holder) {
3676 ws.world.nation_get_available_cbs(holder).push_back(
3693 if(
auto holder = ws.world.state_instance_get_nation_from_state_ownership(
trigger::to_state(this_slot)); holder) {
3694 ws.world.nation_get_available_cbs(holder).push_back(
3703 if(
auto holder = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(this_slot)); holder) {
3704 ws.world.nation_get_available_cbs(holder).push_back(
3714 ws.world.nation_get_available_cbs(holder).push_back(
3731 if(
auto holder = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(from_slot)); holder) {
3732 ws.world.nation_get_available_cbs(holder).push_back(
3741 auto holder = ws.world.national_identity_get_nation_from_identity_holder(tag_target);
3743 for(
uint32_t i = cbs.size(); i-- > 0;) {
3744 if(cbs.at(i).cb_type == type && cbs.at(i).target == holder)
3752 auto holder = ws.world.province_get_nation_from_province_ownership(
trigger::payload(tval[2]).prov_id);
3754 for(
uint32_t i = cbs.size(); i-- > 0;) {
3755 if(cbs.at(i).cb_type == type && cbs.at(i).target == holder)
3765 for(
uint32_t i = cbs.size(); i-- > 0;) {
3766 if(cbs.at(i).cb_type == type && cbs.at(i).target == holder)
3774 auto holder = ws.world.state_instance_get_nation_from_state_ownership(
trigger::to_state(this_slot));
3776 for(
uint32_t i = cbs.size(); i-- > 0;) {
3777 if(cbs.at(i).cb_type == type && cbs.at(i).target == holder)
3785 auto holder = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(this_slot));
3787 for(
uint32_t i = cbs.size(); i-- > 0;) {
3788 if(cbs.at(i).cb_type == type && cbs.at(i).target == holder)
3798 for(
uint32_t i = cbs.size(); i-- > 0;) {
3799 if(cbs.at(i).cb_type == type && cbs.at(i).target == holder)
3809 for(
uint32_t i = cbs.size(); i-- > 0;) {
3810 if(cbs.at(i).cb_type == type && cbs.at(i).target == holder)
3818 auto holder = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(from_slot));
3820 for(
uint32_t i = cbs.size(); i-- > 0;) {
3821 if(cbs.at(i).cb_type == type && cbs.at(i).target == holder)
3830 auto holder = ws.world.national_identity_get_nation_from_identity_holder(tag_target);
3832 auto cbs = ws.world.nation_get_available_cbs(holder);
3833 for(
uint32_t i = cbs.size(); i-- > 0;) {
3834 if(cbs.at(i).cb_type == type && cbs.at(i).target ==
trigger::to_nation(primary_slot))
3843 auto holder = ws.world.province_get_nation_from_province_ownership(
trigger::payload(tval[2]).prov_id);
3845 auto cbs = ws.world.nation_get_available_cbs(holder);
3846 for(
uint32_t i = cbs.size(); i-- > 0;) {
3847 if(cbs.at(i).cb_type == type && cbs.at(i).target ==
trigger::to_nation(primary_slot))
3857 auto cbs = ws.world.nation_get_available_cbs(holder);
3858 for(
uint32_t i = cbs.size(); i-- > 0;) {
3859 if(cbs.at(i).cb_type == type && cbs.at(i).target ==
trigger::to_nation(primary_slot))
3867 auto holder = ws.world.state_instance_get_nation_from_state_ownership(
trigger::to_state(this_slot));
3869 auto cbs = ws.world.nation_get_available_cbs(holder);
3870 for(
uint32_t i = cbs.size(); i-- > 0;) {
3871 if(cbs.at(i).cb_type == type && cbs.at(i).target ==
trigger::to_nation(primary_slot))
3880 auto holder = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(this_slot));
3882 auto cbs = ws.world.nation_get_available_cbs(holder);
3883 for(
uint32_t i = cbs.size(); i-- > 0;) {
3884 if(cbs.at(i).cb_type == type && cbs.at(i).target ==
trigger::to_nation(primary_slot))
3895 auto cbs = ws.world.nation_get_available_cbs(holder);
3896 for(
uint32_t i = cbs.size(); i-- > 0;) {
3897 if(cbs.at(i).cb_type == type && cbs.at(i).target ==
trigger::to_nation(primary_slot))
3907 auto cbs = ws.world.nation_get_available_cbs(holder);
3908 for(
uint32_t i = cbs.size(); i-- > 0;) {
3909 if(cbs.at(i).cb_type == type && cbs.at(i).target ==
trigger::to_nation(primary_slot))
3917 auto holder = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(from_slot));
3919 auto cbs = ws.world.nation_get_available_cbs(holder);
3920 for(
uint32_t i = cbs.size(); i-- > 0;) {
3921 if(cbs.at(i).cb_type == type && cbs.at(i).target ==
trigger::to_nation(primary_slot))
3929 auto target = ws.world.national_identity_get_nation_from_identity_holder(
trigger::payload(tval[1]).tag_id);
3930 if(ws.world.nation_get_owned_province_count(target) == 0 || ws.world.nation_get_owned_province_count(
trigger::to_nation(primary_slot)) == 0)
3937 if(ws.world.nation_get_owned_province_count(target) == 0 || ws.world.nation_get_owned_province_count(
trigger::to_nation(primary_slot)) == 0)
3943 auto target = ws.world.state_instance_get_nation_from_state_ownership(
trigger::to_state(this_slot));
3944 if(ws.world.nation_get_owned_province_count(target) == 0 || ws.world.nation_get_owned_province_count(
trigger::to_nation(primary_slot)) == 0)
3950 auto target = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(this_slot));
3951 if(ws.world.nation_get_owned_province_count(target) == 0 || ws.world.nation_get_owned_province_count(
trigger::to_nation(primary_slot)) == 0)
3958 if(ws.world.nation_get_owned_province_count(target) == 0 || ws.world.nation_get_owned_province_count(
trigger::to_nation(primary_slot)) == 0)
3965 if(ws.world.nation_get_owned_province_count(target) == 0 || ws.world.nation_get_owned_province_count(
trigger::to_nation(primary_slot)) == 0)
3971 auto target = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(this_slot));
3972 if(ws.world.nation_get_owned_province_count(target) == 0 || ws.world.nation_get_owned_province_count(
trigger::to_nation(primary_slot)) == 0)
3978 for(
auto drel : ws.world.nation_get_diplomatic_relation(
trigger::to_nation(primary_slot))) {
3979 auto other_nation = drel.get_related_nations(0) !=
trigger::to_nation(primary_slot) ? drel.get_related_nations(0) : drel.get_related_nations(1);
3980 if(drel.get_are_allied()) {
3981 for(
auto wfor : ws.world.nation_get_war_participant(
trigger::to_nation(primary_slot))) {
3986 std::memset(&m, 0,
sizeof(m));
3988 m.to = other_nation;
3990 m.data.war = wfor.get_war();
3998 std::memset(&m, 0,
sizeof(m));
4000 m.to = other_nation;
4002 m.data.war = wfor.get_war();
4024 auto target = ws.world.national_identity_get_nation_from_identity_holder(
trigger::payload(tval[1]).tag_id);
4027 if(ws.world.nation_get_owned_province_count(target) == 0 || ws.world.nation_get_owned_province_count(
trigger::to_nation(primary_slot)) == 0)
4058 if(ws.world.nation_get_owned_province_count(target) == 0 || ws.world.nation_get_owned_province_count(
trigger::to_nation(primary_slot)) == 0)
4088 if(
auto owner = ws.world.state_instance_get_nation_from_state_ownership(
trigger::to_state(this_slot)); owner)
4089 return ef_war_this_nation(tval, ws, primary_slot,
trigger::to_generic(owner), 0, r_lo, r_hi, els);
4093 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(this_slot)); owner)
4094 return ef_war_this_nation(tval, ws, primary_slot,
trigger::to_generic(owner), 0, r_lo, r_hi, els);
4099 return ef_war_this_nation(tval, ws, primary_slot,
trigger::to_generic(owner), 0, r_lo, r_hi, els);
4103 return ef_war_this_nation(tval, ws, primary_slot, from_slot, 0, r_lo, r_hi, els);
4106 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(from_slot)); owner)
4107 return ef_war_this_nation(tval, ws, primary_slot,
trigger::to_generic(owner), 0, r_lo, r_hi, els);
4111 auto target = ws.world.national_identity_get_nation_from_identity_holder(
trigger::payload(tval[1]).tag_id);
4114 if(ws.world.nation_get_owned_province_count(target) == 0 || ws.world.nation_get_owned_province_count(
trigger::to_nation(primary_slot)) == 0)
4144 if(ws.world.nation_get_owned_province_count(target) == 0 || ws.world.nation_get_owned_province_count(
trigger::to_nation(primary_slot)) == 0)
4173 if(
auto owner = ws.world.state_instance_get_nation_from_state_ownership(
trigger::to_state(this_slot)); owner)
4174 ef_war_no_ally_this_nation(tval, ws, primary_slot,
trigger::to_generic(owner), 0, r_lo, r_hi, els);
4178 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(this_slot)); owner)
4179 ef_war_no_ally_this_nation(tval, ws, primary_slot,
trigger::to_generic(owner), 0, r_lo, r_hi, els);
4184 ef_war_no_ally_this_nation(tval, ws, primary_slot,
trigger::to_generic(owner), 0, r_lo, r_hi, els);
4188 ef_war_no_ally_this_nation(tval, ws, primary_slot, from_slot, 0, r_lo, r_hi, els);
4192 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(from_slot)); owner)
4193 ef_war_no_ally_this_nation(tval, ws, primary_slot,
trigger::to_generic(owner), 0, r_lo, r_hi, els);
4197 auto postpone = int32_t(tval[2]);
4199 auto future_date = ws.current_date + postpone;
4212 auto postpone = int32_t(tval[2]);
4214 auto future_date = ws.current_date + postpone;
4223 auto postpone = int32_t(tval[2]);
4225 auto future_date = ws.current_date + postpone;
4236 auto postpone = int32_t(tval[2]);
4238 auto future_date = ws.current_date + postpone;
4247 auto postpone = int32_t(tval[2]);
4249 auto future_date = ws.current_date + postpone;
4260 auto postpone = int32_t(tval[2]);
4262 auto future_date = ws.current_date + postpone;
4271 auto postpone = int32_t(tval[2]);
4273 auto future_date = ws.current_date + postpone;
4284 auto postpone = int32_t(tval[2]);
4286 auto future_date = ws.current_date + postpone;
4295 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot)); owner)
4296 return ef_country_event_this_nation(tval, ws,
trigger::to_generic(owner), this_slot, 0, r_lo, r_hi, els);
4300 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot)); owner)
4301 return ef_country_event_immediate_this_nation(tval, ws,
trigger::to_generic(owner), this_slot, 0, r_lo, r_hi, els);
4305 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot)); owner)
4306 return ef_country_event_this_state(tval, ws,
trigger::to_generic(owner), this_slot, 0, r_lo, r_hi, els);
4310 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot)); owner)
4311 return ef_country_event_immediate_this_state(tval, ws,
trigger::to_generic(owner), this_slot, 0, r_lo, r_hi, els);
4315 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot)); owner)
4316 return ef_country_event_this_province(tval, ws,
trigger::to_generic(owner), this_slot, 0, r_lo, r_hi, els);
4320 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot)); owner)
4321 return ef_country_event_immediate_this_province(tval, ws,
trigger::to_generic(owner), this_slot, 0, r_lo, r_hi, els);
4325 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot)); owner)
4326 return ef_country_event_this_pop(tval, ws,
trigger::to_generic(owner), this_slot, 0, r_lo, r_hi, els);
4330 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot)); owner)
4331 return ef_country_event_immediate_this_pop(tval, ws,
trigger::to_generic(owner), this_slot, 0, r_lo, r_hi, els);
4353 assert(std::isfinite(amount));
4360 assert(std::isfinite(amount));
4368 assert(std::isfinite(factor));
4371 float new_total = 1.0f - s + std::max(0.0f, s + factor);
4374 for(
auto j : ws.world.in_ideology) {
4384 assert(std::isfinite(amount));
4387 float new_total = 100.0f - u + std::max(0.0f, u + 100.0f * amount);
4388 u = std::max(0.0f, u + 100.0f * amount);
4391 for(
auto j : ws.world.in_ideology) {
4395 ws.world.nation_get_upper_house(
trigger::to_nation(primary_slot), j) *= 100.0f / (new_total);
4405 assert(std::isfinite(adjustment));
4416 assert(std::isfinite(adjustment));
4425 assert(std::isfinite(adjustment));
4436 assert(std::isfinite(adjustment));
4447 assert(std::isfinite(adjustment));
4464 assert(std::isfinite(factor));
4466 for(
auto p : ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot))) {
4467 for(
auto pop : p.get_province().get_pop_location()) {
4469 float adjustment = factor * support;
4480 assert(std::isfinite(factor));
4482 for(
auto p : ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot))) {
4483 for(
auto pop : p.get_province().get_pop_location()) {
4485 float adjustment = factor * support;
4495 assert(std::isfinite(factor));
4497 for(
auto p : ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot))) {
4498 for(
auto pop : p.get_province().get_pop_location()) {
4500 float adjustment = factor * unemployed;
4511 assert(std::isfinite(factor));
4513 for(
auto p : ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot))) {
4514 for(
auto pop : p.get_province().get_pop_location()) {
4516 float adjustment = factor * support;
4527 assert(std::isfinite(factor));
4529 for(
auto p : ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot))) {
4530 for(
auto pop : p.get_province().get_pop_location()) {
4532 float adjustment = factor * support;
4542 assert(std::isfinite(factor));
4544 for(
auto p : ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot))) {
4545 for(
auto pop : p.get_province().get_pop_location()) {
4547 float adjustment = factor * unemployed;
4558 assert(std::isfinite(factor));
4561 for(
auto pop : ws.world.province_get_pop_location(p)) {
4562 auto support = pop_demographics::get_demo(ws, pop.get_pop(), demo_tag);
4563 float adjustment = factor * support;
4564 auto v = pop_demographics::get_militancy(ws, pop.get_pop());
4565 pop_demographics::set_militancy(ws, pop.get_pop(), std::clamp(v + adjustment, 0.0f, 10.0f));
4574 assert(std::isfinite(factor));
4577 for(
auto pop : ws.world.province_get_pop_location(p)) {
4578 auto support = pop_demographics::get_demo(ws, pop.get_pop(), demo_tag);
4579 float adjustment = factor * support;
4580 auto v = pop_demographics::get_militancy(ws, pop.get_pop());
4581 pop_demographics::set_militancy(ws, pop.get_pop(), std::clamp(v + adjustment, 0.0f, 10.0f));
4589 assert(std::isfinite(factor));
4592 for(
auto pop : ws.world.province_get_pop_location(p)) {
4593 auto unemployed = 1.0f - pop_demographics::get_raw_employment(ws, pop.get_pop());
4594 float adjustment = factor * unemployed;
4595 auto v = pop_demographics::get_militancy(ws, pop.get_pop());
4596 pop_demographics::set_militancy(ws, pop.get_pop(), std::clamp(v + adjustment, 0.0f, 10.0f));
4605 assert(std::isfinite(factor));
4608 for(
auto pop : ws.world.province_get_pop_location(p)) {
4609 auto support = pop_demographics::get_demo(ws, pop.get_pop(), demo_tag);
4610 float adjustment = factor * support;
4611 auto v = pop_demographics::get_consciousness(ws, pop.get_pop());
4612 pop_demographics::set_consciousness(ws, pop.get_pop(), std::clamp(v + adjustment, 0.0f, 10.0f));
4621 assert(std::isfinite(factor));
4624 for(
auto pop : ws.world.province_get_pop_location(p)) {
4625 auto support = pop_demographics::get_demo(ws, pop.get_pop(), demo_tag);
4626 float adjustment = factor * support;
4627 auto v = pop_demographics::get_consciousness(ws, pop.get_pop());
4628 pop_demographics::set_consciousness(ws, pop.get_pop(), std::clamp(v + adjustment, 0.0f, 10.0f));
4636 assert(std::isfinite(factor));
4639 for(
auto pop : ws.world.province_get_pop_location(p)) {
4640 auto unemployed = 1.0f - pop_demographics::get_raw_employment(ws, pop.get_pop());
4641 float adjustment = factor * unemployed;
4642 auto v = pop_demographics::get_consciousness(ws, pop.get_pop());
4643 pop_demographics::set_consciousness(ws, pop.get_pop(), std::clamp(v + adjustment, 0.0f, 10.0f));
4652 assert(std::isfinite(factor));
4654 for(
auto pop : ws.world.province_get_pop_location(
trigger::to_prov(primary_slot))) {
4656 float adjustment = factor * support;
4666 assert(std::isfinite(factor));
4668 for(
auto pop : ws.world.province_get_pop_location(
trigger::to_prov(primary_slot))) {
4670 float adjustment = factor * support;
4679 assert(std::isfinite(factor));
4681 for(
auto pop : ws.world.province_get_pop_location(
trigger::to_prov(primary_slot))) {
4683 float adjustment = factor * unemployed;
4693 assert(std::isfinite(factor));
4695 for(
auto pop : ws.world.province_get_pop_location(
trigger::to_prov(primary_slot))) {
4697 float adjustment = factor * support;
4707 assert(std::isfinite(factor));
4709 for(
auto pop : ws.world.province_get_pop_location(
trigger::to_prov(primary_slot))) {
4711 float adjustment = factor * support;
4720 assert(std::isfinite(factor));
4722 for(
auto pop : ws.world.province_get_pop_location(
trigger::to_prov(primary_slot))) {
4724 float adjustment = factor * unemployed;
4733 assert(std::isfinite(amount));
4735 v = std::max(v + amount, 0.0f);
4740 assert(std::isfinite(amount));
4741 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot)); owner) {
4742 auto& v = ws.world.nation_get_stockpiles(owner,
trigger::payload(tval[1]).com_id);
4743 v = std::max(v + amount, 0.0f);
4749 auto esv = ws.to_string_view(ename);
4751 auto n = l.get_leader().get_name();
4752 auto nsv = ws.to_string_view(n);
4761 auto l = fatten(ws.world, ws.world.create_leader());
4762 l.set_since(ws.current_date);
4763 l.set_is_admiral(
false);
4771 auto l = fatten(ws.world, ws.world.create_leader());
4772 l.set_since(ws.current_date);
4773 l.set_is_admiral(
true);
4785 auto new_total = 1.0f - s + std::max(0.0f, s + factor);
4788 for(
auto i : ws.world.in_issue_option) {
4799 for(
auto p : ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot))) {
4800 for(
auto pop : p.get_province().get_pop_location()) {
4802 auto new_total = 1.0f - s + std::max(0.0f, s + factor);
4805 for(
auto i : ws.world.in_issue_option) {
4817 dcon::state_definition_id{}, dcon::national_identity_id{},
trigger::to_nation(primary_slot));
4826 for(
auto p : ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot))) {
4827 for(
auto pop : p.get_province().get_pop_location()) {
4843 for(
auto pop : ws.world.province_get_pop_location(p)) {
4844 auto s = pop_demographics::get_demo(ws, pop.get_pop(), from_issue);
4845 pop_demographics::set_demo(ws, pop.get_pop(), from_issue, s - s * amount);
4846 auto s2 = pop_demographics::get_demo(ws, pop.get_pop(), to_issue);
4847 pop_demographics::set_demo(ws, pop.get_pop(), from_issue, s2 + s * amount);
4858 for(
auto pop : ws.world.province_get_pop_location(
trigger::to_prov(primary_slot))) {
4882 auto& v = ws.world.province_get_party_loyalty(
trigger::payload(tval[1]).prov_id, i);
4883 v = std::clamp(v + amount, -1.0f, 1.0f);
4889 auto& v = ws.world.province_get_party_loyalty(
trigger::to_prov(primary_slot), i);
4890 v = std::clamp(v + amount, -1.0f, 1.0f);
4896 auto cs = ws.world.province_get_state_membership(c);
4898 if(ws.world.province_get_modifier_values(p, sys::provincial_mod_offsets::min_build_railroad) <= 1.0f)
4901 ws.railroad_built.store(
true, std::memory_order::release);
4906 auto cs = ws.world.province_get_state_membership(c);
4908 if(ws.world.province_get_modifier_values(p, sys::provincial_mod_offsets::min_build_railroad) <= 1.0f)
4911 ws.railroad_built.store(
true, std::memory_order::release);
4917 if(ws.world.province_get_modifier_values(c, sys::provincial_mod_offsets::min_build_railroad) <= 1.0f) {
4919 ws.railroad_built.store(
true, std::memory_order::release);
4927 if(ws.world.province_get_modifier_values(c, sys::provincial_mod_offsets::min_build_railroad) <= 1.0f) {
4929 ws.railroad_built.store(
true, std::memory_order::release);
4936 auto cs = ws.world.province_get_state_membership(c);
4943 auto cs = ws.world.province_get_state_membership(c);
4963 auto itag = ws.world.rebel_faction_get_defection_target(
trigger::to_rebel(from_slot));
4964 if(
auto holder = ws.world.national_identity_get_nation_from_identity_holder(itag); holder)
4989 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot)); owner)
4999 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot)); owner)
5004 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot)); owner)
5005 return ef_add_country_modifier_no_duration(tval, ws,
trigger::to_generic(owner), 0, 0, 0, 0, els);
5009 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot)); owner)
5014 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot)); owner)
5015 return ef_relation_this_nation(tval, ws,
trigger::to_generic(owner), this_slot, 0, 0, 0, els);
5019 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot)); owner)
5020 return ef_relation_this_province(tval, ws,
trigger::to_generic(owner), this_slot, 0, 0, 0, els);
5024 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot)); owner)
5025 return ef_relation_this_nation(tval, ws,
trigger::to_generic(owner), from_slot, 0, 0, 0, els);
5029 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot)); owner)
5030 return ef_relation_this_province(tval, ws,
trigger::to_generic(owner), from_slot, 0, 0, 0, els);
5034 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot)); owner)
5039 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot)); owner)
5049 auto cs = ws.world.province_get_state_membership(c);
5051 if(ws.world.province_get_modifier_values(p, sys::provincial_mod_offsets::min_build_bank) <= 1.0f)
5058 auto cs = ws.world.province_get_state_membership(c);
5060 if(ws.world.province_get_modifier_values(p, sys::provincial_mod_offsets::min_build_bank) <= 1.0f)
5068 if(ws.world.province_get_modifier_values(c, sys::provincial_mod_offsets::min_build_bank) <= 1.0f)
5076 if(ws.world.province_get_modifier_values(c, sys::provincial_mod_offsets::min_build_bank) <= 1.0f)
5086 auto cs = ws.world.province_get_state_membership(c);
5088 if(ws.world.province_get_modifier_values(p, sys::provincial_mod_offsets::min_build_university) <= 1.0f)
5095 auto cs = ws.world.province_get_state_membership(c);
5097 if(ws.world.province_get_modifier_values(p, sys::provincial_mod_offsets::min_build_university) <= 1.0f)
5105 if(ws.world.province_get_modifier_values(c, sys::provincial_mod_offsets::min_build_university) <= 1.0f)
5113 if(ws.world.province_get_modifier_values(c, sys::provincial_mod_offsets::min_build_university) <= 1.0f)
5120 auto sprovs = ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot));
5121 while(sprovs.begin() != sprovs.end()) {
5132 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[1]).glob_id,
false);
5133 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[2]).glob_id,
false);
5137 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[1]).glob_id,
false);
5138 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[2]).glob_id,
false);
5139 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[3]).glob_id,
false);
5143 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[1]).glob_id,
false);
5144 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[2]).glob_id,
false);
5145 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[3]).glob_id,
false);
5146 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[4]).glob_id,
false);
5150 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[1]).glob_id,
false);
5151 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[2]).glob_id,
false);
5152 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[3]).glob_id,
false);
5153 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[4]).glob_id,
false);
5154 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[5]).glob_id,
false);
5158 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[1]).glob_id,
false);
5159 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[2]).glob_id,
false);
5160 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[3]).glob_id,
false);
5161 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[4]).glob_id,
false);
5162 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[5]).glob_id,
false);
5163 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[6]).glob_id,
false);
5167 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[1]).glob_id,
false);
5168 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[2]).glob_id,
false);
5169 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[3]).glob_id,
false);
5170 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[4]).glob_id,
false);
5171 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[5]).glob_id,
false);
5172 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[6]).glob_id,
false);
5173 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[7]).glob_id,
false);
5177 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[1]).glob_id,
false);
5178 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[2]).glob_id,
false);
5179 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[3]).glob_id,
false);
5180 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[4]).glob_id,
false);
5181 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[5]).glob_id,
false);
5182 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[6]).glob_id,
false);
5183 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[7]).glob_id,
false);
5184 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[8]).glob_id,
false);
5188 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[1]).glob_id,
false);
5189 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[2]).glob_id,
false);
5190 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[3]).glob_id,
false);
5191 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[4]).glob_id,
false);
5192 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[5]).glob_id,
false);
5193 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[6]).glob_id,
false);
5194 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[7]).glob_id,
false);
5195 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[8]).glob_id,
false);
5196 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[9]).glob_id,
false);
5200 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[1]).glob_id,
false);
5201 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[2]).glob_id,
false);
5202 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[3]).glob_id,
false);
5203 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[4]).glob_id,
false);
5204 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[5]).glob_id,
false);
5205 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[6]).glob_id,
false);
5206 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[7]).glob_id,
false);
5207 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[8]).glob_id,
false);
5208 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[9]).glob_id,
false);
5209 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[10]).glob_id,
false);
5213 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[1]).glob_id,
false);
5214 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[2]).glob_id,
false);
5215 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[3]).glob_id,
false);
5216 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[4]).glob_id,
false);
5217 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[5]).glob_id,
false);
5218 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[6]).glob_id,
false);
5219 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[7]).glob_id,
false);
5220 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[8]).glob_id,
false);
5221 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[9]).glob_id,
false);
5222 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[10]).glob_id,
false);
5223 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[11]).glob_id,
false);
5227 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[1]).glob_id,
false);
5228 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[2]).glob_id,
false);
5229 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[3]).glob_id,
false);
5230 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[4]).glob_id,
false);
5231 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[5]).glob_id,
false);
5232 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[6]).glob_id,
false);
5233 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[7]).glob_id,
false);
5234 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[8]).glob_id,
false);
5235 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[9]).glob_id,
false);
5236 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[10]).glob_id,
false);
5237 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[11]).glob_id,
false);
5238 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[12]).glob_id,
false);
5252 auto const p = ws.world.pop_get_province_from_pop_location(
trigger::to_pop(primary_slot));
5257 auto dnid = ws.world.nation_get_identity_from_identity_holder(
trigger::to_nation(this_slot));
5262 auto dnid = ws.world.nation_get_identity_from_identity_holder(
trigger::to_nation(from_slot));
5273 auto holder = ws.world.nation_get_identity_from_identity_holder(n);
5275 auto start = ws.world.national_identity_get_political_party_first(holder).id.index();
5276 auto end = start + ws.world.national_identity_get_political_party_count(holder);
5278 for(int32_t i = start; i < end; i++) {
5279 auto pid = dcon::political_party_id(dcon::political_party_id::value_base_t(i));
5281 ws.world.political_party_set_name(pid, new_name);
5287 auto rp = ws.world.nation_get_ruling_party(n);
5289 ws.world.political_party_set_name(rp, new_name);
5298 auto popt = ws.world.issue_option_get_parent_issue(new_opt);
5302 auto holder = ws.world.nation_get_identity_from_identity_holder(n);
5304 auto start = ws.world.national_identity_get_political_party_first(holder).id.index();
5305 auto end = start + ws.world.national_identity_get_political_party_count(holder);
5307 for(int32_t i = start; i < end; i++) {
5308 auto pid = dcon::political_party_id(dcon::political_party_id::value_base_t(i));
5310 ws.world.political_party_set_party_issues(pid, popt, new_opt);
5311 if(ws.world.nation_get_ruling_party(n) == pid)
5318 auto rp = ws.world.nation_get_ruling_party(n);
5320 ws.world.political_party_set_party_issues(rp, popt, new_opt);
5329#define EFFECT_BYTECODE_ELEMENT(code, name, arg) ef_##name,
5331#undef EFFECT_BYTECODE_ELEMENT
5336 es_x_neighbor_province_scope,
5337 es_x_neighbor_country_scope,
5339 es_x_country_scope_nation,
5340 es_x_empty_neighbor_province_scope,
5341 es_x_greater_power_scope,
5342 es_poor_strata_scope_nation,
5343 es_poor_strata_scope_state,
5344 es_poor_strata_scope_province,
5345 es_middle_strata_scope_nation,
5346 es_middle_strata_scope_state,
5347 es_middle_strata_scope_province,
5348 es_rich_strata_scope_nation,
5349 es_rich_strata_scope_state,
5350 es_rich_strata_scope_province,
5351 es_x_pop_scope_nation,
5352 es_x_pop_scope_state,
5353 es_x_pop_scope_province,
5354 es_x_owned_scope_nation,
5355 es_x_owned_scope_state,
5358 es_random_list_scope,
5360 es_owner_scope_state,
5361 es_owner_scope_province,
5362 es_controller_scope,
5364 es_country_scope_pop,
5365 es_country_scope_state,
5367 es_this_scope_nation,
5368 es_this_scope_state,
5369 es_this_scope_province,
5371 es_from_scope_nation,
5372 es_from_scope_state,
5373 es_from_scope_province,
5376 es_cultural_union_scope,
5378 es_sphere_owner_scope,
5379 es_independence_scope,
5380 es_flashpoint_tag_scope,
5381 es_crisis_state_scope,
5383 es_state_scope_province,
5384 es_x_substate_scope,
5385 es_capital_scope_province,
5386 es_x_core_scope_province,
5389 es_pop_type_scope_nation,
5390 es_pop_type_scope_state,
5391 es_pop_type_scope_province,
5392 es_region_proper_scope,
5396 es_x_event_country_scope,
5397 es_x_decision_country_scope,
5398 es_x_event_country_scope_nation,
5399 es_x_decision_country_scope_nation,
5400 es_from_bounce_scope,
5401 es_this_bounce_scope,
5402 es_random_by_modifier_scope,
5403 es_x_neighbor_province_scope_nation,
5404 es_x_empty_neighbor_province_scope_nation
5410 return effect_functions[*tval &
effect::code_mask](tval, ws, primary_slot, this_slot, from_slot, r_lo, r_hi, els);
5416 internal_execute_effect(state.effect_data.data() + state.effect_data_indices[key.index() + 1], state, primary, this_slot, from_slot, r_lo, r_hi, els);
dcon::text_key get_name() noexcept
#define assert(condition)
void remove_ai_data(sys::state &state, dcon::nation_id n)
void apply_invention(sys::state &state, dcon::nation_id target_nation, dcon::invention_id i_id)
void replace_cores(sys::state &state, dcon::national_identity_id old_tag, dcon::national_identity_id new_tag)
void remove_invention(sys::state &state, dcon::nation_id target_nation, dcon::invention_id i_id)
void remove_technology(sys::state &state, dcon::nation_id target_nation, dcon::technology_id t_id)
void apply_technology(sys::state &state, dcon::nation_id target_nation, dcon::technology_id t_id)
void update_nation_issue_rules(sys::state &state, dcon::nation_id n_id)
pop_satisfaction_wrapper_fat fatten(data_container const &c, pop_satisfaction_wrapper_id id) noexcept
void reduce_pop_size_safe(sys::state &state, dcon::pop_id pop_id, int32_t amount)
void post(sys::state &state, message const &m)
Pushes a diplomatic message to the list of pending diplomatic requests for the specified recipient (m...
constexpr dcon::commodity_id money(0)
void try_add_factory_to_state(sys::state &state, dcon::state_instance_id s, dcon::factory_type_id t)
uint32_t ef_consciousness_state(EFFECT_PARAMTERS)
uint32_t ef_add_province_modifier_state(EFFECT_PARAMTERS)
uint32_t ef_is_slave_province_yes(EFFECT_PARAMTERS)
uint32_t ef_remove_core_state_this_pop(EFFECT_PARAMTERS)
uint32_t es_x_decision_country_scope(EFFECT_PARAMTERS)
uint32_t es_x_greater_power_scope(EFFECT_PARAMTERS)
uint32_t ef_remove_core_state_from_nation(EFFECT_PARAMTERS)
uint32_t ef_release_vassal_province_from_nation(EFFECT_PARAMTERS)
uint32_t ef_add_accepted_culture_union_this(EFFECT_PARAMTERS)
uint32_t es_poor_strata_scope_nation(EFFECT_PARAMTERS)
uint32_t es_this_bounce_scope(EFFECT_PARAMTERS)
uint32_t ef_is_slave_province_no(EFFECT_PARAMTERS)
uint32_t ef_release_vassal_province_this_nation(EFFECT_PARAMTERS)
uint32_t ef_release_vassal_province_from_province(EFFECT_PARAMTERS)
uint32_t ef_reduce_pop_state(EFFECT_PARAMTERS)
uint32_t ef_annex_to_null_nation(EFFECT_PARAMTERS)
uint32_t es_if_scope(EFFECT_PARAMTERS)
uint32_t apply_subeffects(EFFECT_PARAMTERS)
uint32_t ef_reduce_pop_province(EFFECT_PARAMTERS)
uint32_t ef_remove_core_nation_this_pop(EFFECT_PARAMTERS)
constexpr uint16_t is_random_scope
uint32_t ef_set_country_flag_pop(EFFECT_PARAMTERS)
uint32_t ef_militancy_state(EFFECT_PARAMTERS)
uint32_t es_x_country_scope_nation(EFFECT_PARAMTERS)
uint32_t ef_annex_to_null_province(EFFECT_PARAMTERS)
uint32_t ef_reduce_pop_nation(EFFECT_PARAMTERS)
uint32_t es_x_decision_country_scope_nation(EFFECT_PARAMTERS)
uint32_t ef_release_vassal_province_random(EFFECT_PARAMTERS)
int32_t get_effect_scope_payload_size(uint16_t const *data)
uint32_t ef_bank_state(EFFECT_PARAMTERS)
uint32_t ef_remove_core_state_from_province(EFFECT_PARAMTERS)
uint32_t ef_remove_core_state_reb(EFFECT_PARAMTERS)
int32_t effect_scope_data_payload(uint16_t code)
void execute(sys::state &state, dcon::effect_key key, int32_t primary, int32_t this_slot, int32_t from_slot, uint32_t r_lo, uint32_t r_hi)
uint32_t ef_release_vassal_province_this_province(EFFECT_PARAMTERS)
constexpr uint16_t code_mask
uint32_t ef_fort_state(EFFECT_PARAMTERS)
uint32_t ef_flashpoint_tension_province(EFFECT_PARAMTERS)
uint32_t ef_consciousness_province(EFFECT_PARAMTERS)
uint32_t ef_infrastructure_state(EFFECT_PARAMTERS)
uint32_t internal_execute_effect(EFFECT_PARAMTERS)
uint32_t ef_remove_core_nation_this_nation(EFFECT_PARAMTERS)
uint32_t es_x_event_country_scope(EFFECT_PARAMTERS)
uint32_t ef_political_reform_province(EFFECT_PARAMTERS)
uint32_t es_x_neighbor_province_scope(EFFECT_PARAMTERS)
uint32_t ef_release_vassal_province_reb(EFFECT_PARAMTERS)
uint32_t es_generic_scope(EFFECT_PARAMTERS)
uint32_t ef_remove_core_tag_nation(EFFECT_PARAMTERS)
uint32_t ef_remove_core_state_this_province(EFFECT_PARAMTERS)
uint32_t ef_remove_core_nation_reb(EFFECT_PARAMTERS)
uint32_t ef_life_rating_state(EFFECT_PARAMTERS)
uint32_t ef_university_state(EFFECT_PARAMTERS)
uint32_t es_x_event_country_scope_nation(EFFECT_PARAMTERS)
uint32_t ef_remove_core_nation_this_state(EFFECT_PARAMTERS)
uint32_t es_x_country_scope(EFFECT_PARAMTERS)
int32_t get_generic_effect_payload_size(uint16_t const *data)
uint32_t es_x_empty_neighbor_province_scope(EFFECT_PARAMTERS)
uint32_t ef_add_accepted_culture_union_from(EFFECT_PARAMTERS)
constexpr uint16_t first_invalid_code
uint32_t ef_release_vassal_province(EFFECT_PARAMTERS)
uint32_t ef_naval_base_state(EFFECT_PARAMTERS)
constexpr uint16_t scope_has_limit
uint32_t ef_remove_core_state_this_state(EFFECT_PARAMTERS)
uint32_t ef_remove_core_state_this_nation(EFFECT_PARAMTERS)
uint32_t es_x_neighbor_country_scope(EFFECT_PARAMTERS)
uint32_t es_x_empty_neighbor_province_scope_nation(EFFECT_PARAMTERS)
uint32_t es_poor_strata_scope_state(EFFECT_PARAMTERS)
uint32_t es_x_neighbor_province_scope_nation(EFFECT_PARAMTERS)
uint32_t ef_remove_core_nation_from_nation(EFFECT_PARAMTERS)
uint32_t ef_remove_province_modifier_state(EFFECT_PARAMTERS)
uint32_t ef_militancy_nation(EFFECT_PARAMTERS)
uint32_t ef_remove_core_nation_from_province(EFFECT_PARAMTERS)
std::vector< dcon::province_id > country_get_province_adjacency(sys::state &state, dcon::nation_id nat_id)
uint32_t es_from_bounce_scope(EFFECT_PARAMTERS)
uint32_t ef_militancy_province(EFFECT_PARAMTERS)
uint32_t ef_social_reform_province(EFFECT_PARAMTERS)
uint32_t ef_remove_core_nation_this_province(EFFECT_PARAMTERS)
uint32_t ef_consciousness_nation(EFFECT_PARAMTERS)
uint32_t ef_add_province_modifier_state_no_duration(EFFECT_PARAMTERS)
uint32_t es_else_if_scope(EFFECT_PARAMTERS)
bool would_be_duplicate_instance(sys::state &state, dcon::national_event_id e, dcon::nation_id n, sys::date date)
void eject_ships(sys::state &state, dcon::province_id p)
void remove_from_common_allied_wars(sys::state &state, dcon::nation_id a, dcon::nation_id b)
void end_wars_between(sys::state &state, dcon::nation_id a, dcon::nation_id b)
bool has_truce_with(sys::state &state, dcon::nation_id attacker, dcon::nation_id target)
bool standard_war_joining_is_possible(sys::state &state, dcon::war_id wfor, dcon::nation_id n, bool as_attacker)
void add_wargoal(sys::state &state, dcon::war_id wfor, dcon::nation_id added_by, dcon::nation_id target, dcon::cb_type_id type, dcon::state_definition_id sd, dcon::national_identity_id tag, dcon::nation_id secondary_nation)
dcon::war_id find_war_between(sys::state const &state, dcon::nation_id a, dcon::nation_id b)
dcon::war_id create_war(sys::state &state, dcon::nation_id primary_attacker, dcon::nation_id primary_defender, dcon::cb_type_id primary_wargoal, dcon::state_definition_id primary_wargoal_state, dcon::national_identity_id primary_wargoal_tag, dcon::nation_id primary_wargoal_secondary)
void add_truce(sys::state &state, dcon::nation_id a, dcon::nation_id b, int32_t days)
void give_military_access(sys::state &state, dcon::nation_id accessing_nation, dcon::nation_id target)
void call_attacker_allies(sys::state &state, dcon::war_id wfor)
void remove_military_access(sys::state &state, dcon::nation_id accessing_nation, dcon::nation_id target)
void kill_leader(sys::state &state, dcon::leader_id l)
void call_defender_allies(sys::state &state, dcon::war_id wfor)
constexpr uint8_t level_in_sphere
constexpr uint8_t level_mask
void make_uncivilized(sys::state &state, dcon::nation_id n)
void break_alliance(sys::state &state, dcon::diplomatic_relation_id rel)
void adjust_prestige(sys::state &state, dcon::nation_id n, float delta)
void destroy_diplomatic_relationships(sys::state &state, dcon::nation_id n)
void make_vassal(sys::state &state, dcon::nation_id subject, dcon::nation_id overlord)
void release_vassal(sys::state &state, dcon::overlord_id rel)
void update_pop_acceptance(sys::state &state, dcon::nation_id n)
void make_alliance(sys::state &state, dcon::nation_id a, dcon::nation_id b)
void adjust_influence_with_overflow(sys::state &state, dcon::nation_id great_power, dcon::nation_id target, float delta)
void liberate_nation_from(sys::state &state, dcon::national_identity_id liberated, dcon::nation_id from)
float prestige_score(sys::state const &state, dcon::nation_id n)
float daily_research_points(sys::state &state, dcon::nation_id n)
void make_civilized(sys::state &state, dcon::nation_id n)
void adjust_relationship(sys::state &state, dcon::nation_id a, dcon::nation_id b, float delta)
void create_nation_based_on_template(sys::state &state, dcon::nation_id n, dcon::nation_id base)
void perform_nationalization(sys::state &state, dcon::nation_id n)
dcon::nation_id owner_of_pop(sys::state const &state, dcon::pop_id pop_ids)
auto nation_accepts_culture(sys::state const &state, T ids, U cul_ids)
void switch_player(sys::state &state, dcon::nation_id new_n, dcon::nation_id old_n)
void force_ruling_party_ideology(sys::state &state, dcon::nation_id n, dcon::ideology_id id)
void set_issue_option(sys::state &state, dcon::nation_id n, dcon::issue_option_id opt)
bool political_party_is_active(sys::state &state, dcon::nation_id n, dcon::political_party_id p)
void change_government_type(sys::state &state, dcon::nation_id n, dcon::government_type_id new_type)
void update_displayed_identity(sys::state &state, dcon::nation_id id)
void set_reform_option(sys::state &state, dcon::nation_id n, dcon::reform_option_id opt)
void set_ruling_party(sys::state &state, dcon::nation_id n, dcon::political_party_id p)
void start_election(sys::state &state, dcon::nation_id n)
void set_militancy(sys::state &state, dcon::pop_id p, float v)
float get_employment(sys::state const &state, dcon::pop_id p)
void set_demo(sys::state &state, dcon::pop_id p, dcon::pop_demographics_key k, float v)
void set_consciousness(sys::state &state, dcon::pop_id p, float v)
dcon::pop_demographics_key to_key(sys::state const &state, dcon::ideology_id v)
float get_literacy(sys::state const &state, dcon::pop_id p)
float get_consciousness(sys::state const &state, dcon::pop_id p)
float get_militancy(sys::state const &state, dcon::pop_id p)
float get_raw_employment(sys::state const &state, dcon::pop_id p)
void set_literacy(sys::state &state, T p, ve::fp_vector v)
float get_demo(sys::state const &state, dcon::pop_id p, dcon::pop_demographics_key k)
constexpr uint8_t impassible_bit
constexpr uint8_t coastal_bit
void enable_canal(sys::state &state, int32_t id)
void add_core(sys::state &state, dcon::province_id prov, dcon::national_identity_id tag)
void remove_core(sys::state &state, dcon::province_id prov, dcon::national_identity_id tag)
void for_each_province_in_state_instance(sys::state &state, dcon::state_instance_id s, F const &func)
void set_rgo(sys::state &state, dcon::province_id prov, dcon::commodity_id c)
void set_province_controller(sys::state &state, dcon::province_id p, dcon::nation_id n)
void change_province_owner(sys::state &state, dcon::province_id id, dcon::nation_id new_owner)
void trigger_revolt(sys::state &state, dcon::nation_id n, dcon::rebel_type_id t, dcon::ideology_id i, dcon::culture_id c, dcon::religion_id r)
uint64_t get_random(sys::state const &state, uint32_t value_in)
void remove_modifier_from_nation(sys::state &state, dcon::nation_id target_nation, dcon::modifier_id mod_id)
void update_single_nation_modifiers(sys::state &state, dcon::nation_id n)
void add_modifier_to_nation(sys::state &state, dcon::nation_id target_nation, dcon::modifier_id mod_id, sys::date expiration)
void add_modifier_to_province(sys::state &state, dcon::province_id target_prov, dcon::modifier_id mod_id, sys::date expiration)
void remove_modifier_from_province(sys::state &state, dcon::province_id target_prov, dcon::modifier_id mod_id)
std::string produce_simple_string(sys::state const &state, dcon::text_key id)
int32_t to_generic(dcon::province_id v)
dcon::state_instance_id to_state(int32_t v)
dcon::pop_id to_pop(int32_t v)
dcon::province_id to_prov(int32_t v)
int32_t read_int32_t_from_payload(uint16_t const *data)
bool evaluate(sys::state &state, dcon::trigger_key key, int32_t primary, int32_t this_slot, int32_t from_slot)
dcon::rebel_faction_id to_rebel(int32_t v)
float read_float_from_payload(uint16_t const *data)
dcon::nation_id to_nation(int32_t v)
float evaluate_multiplicative_modifier(sys::state &state, dcon::value_modifier_key modifier, int32_t primary, int32_t this_slot, int32_t from_slot)
#define EFFECT_BYTECODE_LIST
Holds data regarding a diplomatic message between two specified nations at a certain date,...
Holds important data about the game world, state, and other data regarding windowing,...
dcon::national_identity_id tag_id
dcon::invention_id invt_id
dcon::national_event_id nev_id
dcon::provincial_event_id pev_id
dcon::province_id prov_id
dcon::ideology_id ideo_id
dcon::technology_id tech_id
dcon::reform_option_id ropt_id
dcon::state_definition_id state_id
dcon::pop_type_id popt_id
dcon::issue_option_id opt_id