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;
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);
1948 assert(std::isfinite(amount));
1953 auto tag = ws.world.nation_get_identity_from_identity_holder(
trigger::to_nation(primary_slot));
1955 auto old_holder = ws.world.national_identity_get_nation_from_identity_holder(
trigger::payload(tval[1]).tag_id);
1959 ws.world.nation_set_identity_from_identity_holder(old_holder, tag);
1965 auto prim_culture = ws.world.nation_get_primary_culture(
trigger::to_nation(primary_slot));
1966 auto cg = ws.world.culture_get_group_from_culture_group_membership(prim_culture);
1967 auto u = ws.world.culture_group_get_identity_from_cultural_union_of(cg);
1971 auto old_holder = ws.world.national_identity_get_nation_from_identity_holder(u);
1972 auto tag = ws.world.nation_get_identity_from_identity_holder(
trigger::to_nation(primary_slot));
1974 ws.world.nation_set_identity_from_identity_holder(
trigger::to_nation(primary_slot), u);
1977 ws.world.nation_set_identity_from_identity_holder(old_holder, tag);
1983 auto holder = ws.world.national_identity_get_nation_from_identity_holder(
trigger::payload(tval[1]).tag_id);
1989 }
else if(ws.world.nation_get_is_player_controlled(holder)) {
1993 auto old_controller = ws.world.nation_get_is_player_controlled(holder);
1994 ws.world.nation_set_is_player_controlled(holder, ws.world.nation_get_is_player_controlled(
trigger::to_nation(primary_slot)));
1995 ws.world.nation_set_is_player_controlled(
trigger::to_nation(primary_slot), old_controller);
1999 if(ws.world.nation_get_is_player_controlled(holder))
2003 ws.local_player_nation = holder;
2004 }
else if(ws.local_player_nation == holder) {
2010 auto prim_culture = ws.world.nation_get_primary_culture(
trigger::to_nation(primary_slot));
2011 auto cg = ws.world.culture_get_group_from_culture_group_membership(prim_culture);
2012 auto u = ws.world.culture_group_get_identity_from_cultural_union_of(cg);
2013 auto holder = ws.world.national_identity_get_nation_from_identity_holder(u);
2019 }
else if(ws.world.nation_get_is_player_controlled(holder)) {
2023 auto old_controller = ws.world.nation_get_is_player_controlled(holder);
2024 ws.world.nation_set_is_player_controlled(holder, ws.world.nation_get_is_player_controlled(
trigger::to_nation(primary_slot)));
2025 ws.world.nation_set_is_player_controlled(
trigger::to_nation(primary_slot), old_controller);
2029 if(ws.world.nation_get_is_player_controlled(holder))
2033 ws.local_player_nation = holder;
2034 }
else if(ws.local_player_nation == holder) {
2048 auto target = ws.world.national_identity_get_nation_from_identity_holder(
trigger::payload(tval[1]).tag_id);
2058 auto target = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(this_slot));
2068 auto target = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(from_slot));
2076 assert(std::isfinite(amount));
2077 inf = std::max(0.0f, inf + amount);
2081 auto holder = ws.world.national_identity_get_nation_from_identity_holder(
trigger::payload(tval[1]).tag_id);
2084 auto hprovs = ws.world.nation_get_province_ownership(holder);
2085 if(hprovs.begin() == hprovs.end()) {
2086 auto powner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot));
2094 auto holder = ws.world.national_identity_get_nation_from_identity_holder(
trigger::payload(tval[1]).tag_id);
2097 auto hprovs = ws.world.nation_get_province_ownership(holder);
2098 if(hprovs.begin() == hprovs.end()) {
2099 auto powner = ws.world.state_instance_get_nation_from_state_ownership(
trigger::to_state(primary_slot));
2109 auto hprovs = ws.world.nation_get_province_ownership(target);
2110 if(hprovs.begin() == hprovs.end()) {
2111 auto powner = ws.world.state_instance_get_nation_from_state_ownership(
trigger::to_state(primary_slot));
2120 auto target = ws.world.state_instance_get_nation_from_state_ownership(
trigger::to_state(this_slot));
2123 auto hprovs = ws.world.nation_get_province_ownership(target);
2124 if(hprovs.begin() == hprovs.end()) {
2125 auto powner = ws.world.state_instance_get_nation_from_state_ownership(
trigger::to_state(primary_slot));
2134 auto target = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(this_slot));
2137 auto hprovs = ws.world.nation_get_province_ownership(target);
2138 if(hprovs.begin() == hprovs.end()) {
2139 auto powner = ws.world.state_instance_get_nation_from_state_ownership(
trigger::to_state(primary_slot));
2151 auto hprovs = ws.world.nation_get_province_ownership(target);
2152 if(hprovs.begin() == hprovs.end()) {
2153 auto powner = ws.world.state_instance_get_nation_from_state_ownership(
trigger::to_state(primary_slot));
2162 return ef_secede_province_state_this_nation(tval, ws, primary_slot, from_slot, 0, r_hi, r_lo, els);
2165 return ef_secede_province_state_this_province(tval, ws, primary_slot, from_slot, 0, r_hi, r_lo, els);
2168 auto target = ws.world.rebel_faction_get_defection_target(
trigger::to_rebel(from_slot));
2169 auto holder = ws.world.national_identity_get_nation_from_identity_holder(target);
2172 auto hprovs = ws.world.nation_get_province_ownership(holder);
2173 if(hprovs.begin() == hprovs.end()) {
2174 auto powner = ws.world.state_instance_get_nation_from_state_ownership(
trigger::to_state(primary_slot));
2185 auto hprovs = ws.world.nation_get_province_ownership(target);
2186 if(hprovs.begin() == hprovs.end()) {
2187 auto powner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot));
2195 auto target = ws.world.state_instance_get_nation_from_state_ownership(
trigger::to_state(this_slot));
2198 auto hprovs = ws.world.nation_get_province_ownership(target);
2199 if(hprovs.begin() == hprovs.end()) {
2200 auto powner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot));
2208 auto target = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(this_slot));
2211 auto hprovs = ws.world.nation_get_province_ownership(target);
2212 if(hprovs.begin() == hprovs.end()) {
2213 auto powner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot));
2224 auto hprovs = ws.world.nation_get_province_ownership(target);
2225 if(hprovs.begin() == hprovs.end()) {
2226 auto powner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot));
2234 return ef_secede_province_this_nation(tval, ws, primary_slot, from_slot, 0, r_hi, r_lo, els);
2237 return ef_secede_province_this_province(tval, ws, primary_slot, from_slot, 0, r_hi, r_lo, els);
2240 auto target = ws.world.rebel_faction_get_defection_target(
trigger::to_rebel(from_slot));
2241 auto holder = ws.world.national_identity_get_nation_from_identity_holder(target);
2244 auto hprovs = ws.world.nation_get_province_ownership(holder);
2245 if(hprovs.begin() == hprovs.end()) {
2246 auto powner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot));
2254 auto holder = ws.world.national_identity_get_nation_from_identity_holder(
trigger::payload(tval[1]).tag_id);
2257 auto hprovs = ws.world.nation_get_province_ownership(holder);
2258 auto sprovs = ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot));
2259 if(sprovs.begin() == sprovs.end()) {
2262 while(hprovs.begin() != hprovs.end()) {
2271 auto hprovs = ws.world.nation_get_province_ownership(holder);
2272 auto sprovs = ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot));
2273 if(sprovs.begin() == sprovs.end()) {
2276 while(hprovs.begin() != hprovs.end()) {
2282 auto holder = ws.world.state_instance_get_nation_from_state_ownership(
trigger::to_state(this_slot));
2285 auto hprovs = ws.world.nation_get_province_ownership(holder);
2286 auto sprovs = ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot));
2287 if(sprovs.begin() == sprovs.end()) {
2290 while(hprovs.begin() != hprovs.end()) {
2296 auto holder = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(this_slot));
2299 auto hprovs = ws.world.nation_get_province_ownership(holder);
2300 auto sprovs = ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot));
2301 if(sprovs.begin() == sprovs.end()) {
2304 while(hprovs.begin() != hprovs.end()) {
2313 auto hprovs = ws.world.nation_get_province_ownership(holder);
2314 auto sprovs = ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot));
2315 if(sprovs.begin() == sprovs.end()) {
2318 while(hprovs.begin() != hprovs.end()) {
2327 auto hprovs = ws.world.nation_get_province_ownership(holder);
2328 auto sprovs = ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot));
2329 if(sprovs.begin() == sprovs.end()) {
2332 while(hprovs.begin() != hprovs.end()) {
2338 auto holder = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(from_slot));
2341 auto hprovs = ws.world.nation_get_province_ownership(holder);
2342 auto sprovs = ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot));
2343 if(sprovs.begin() == sprovs.end()) {
2346 while(hprovs.begin() != hprovs.end()) {
2352 auto holder = ws.world.national_identity_get_nation_from_identity_holder(
trigger::payload(tval[1]).tag_id);
2355 auto hprovs = ws.world.nation_get_province_ownership(holder);
2356 auto sprovs = ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot));
2357 if(hprovs.begin() == hprovs.end()) {
2360 while(sprovs.begin() != sprovs.end()) {
2369 auto hprovs = ws.world.nation_get_province_ownership(holder);
2370 auto sprovs = ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot));
2371 if(hprovs.begin() == hprovs.end()) {
2374 while(sprovs.begin() != sprovs.end()) {
2380 auto holder = ws.world.state_instance_get_nation_from_state_ownership(
trigger::to_state(this_slot));
2383 auto hprovs = ws.world.nation_get_province_ownership(holder);
2384 auto sprovs = ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot));
2385 if(hprovs.begin() == hprovs.end()) {
2388 while(sprovs.begin() != sprovs.end()) {
2394 auto holder = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(this_slot));
2397 auto hprovs = ws.world.nation_get_province_ownership(holder);
2398 auto sprovs = ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot));
2399 if(hprovs.begin() == hprovs.end()) {
2402 while(sprovs.begin() != sprovs.end()) {
2411 auto hprovs = ws.world.nation_get_province_ownership(holder);
2412 auto sprovs = ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot));
2413 if(hprovs.begin() == hprovs.end()) {
2416 while(sprovs.begin() != sprovs.end()) {
2425 auto hprovs = ws.world.nation_get_province_ownership(holder);
2426 auto sprovs = ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot));
2427 if(hprovs.begin() == hprovs.end()) {
2430 while(sprovs.begin() != sprovs.end()) {
2436 auto holder = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(from_slot));
2439 auto hprovs = ws.world.nation_get_province_ownership(holder);
2440 auto sprovs = ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot));
2441 if(hprovs.begin() == hprovs.end()) {
2444 while(sprovs.begin() != sprovs.end()) {
2459 auto owner = ws.world.state_instance_get_nation_from_state_ownership(
trigger::to_state(this_slot));
2460 return ef_release_this_nation(tval, ws, primary_slot,
trigger::to_generic(owner), 0, r_hi, r_lo, els);
2463 auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(this_slot));
2464 return ef_release_this_nation(tval, ws, primary_slot,
trigger::to_generic(owner), 0, r_hi, r_lo, els);
2468 return ef_release_this_nation(tval, ws, primary_slot,
trigger::to_generic(owner), 0, r_hi, r_lo, els);
2476 auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(from_slot));
2477 return ef_release_this_nation(tval, ws, primary_slot,
trigger::to_generic(owner), 0, r_hi, r_lo, els);
2480 auto holder = ws.world.national_identity_get_nation_from_identity_holder(
trigger::payload(tval[1]).tag_id);
2493 auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(this_slot));
2506 auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(from_slot));
2514 auto holder = ws.world.national_identity_get_nation_from_identity_holder(
trigger::payload(tval[1]).tag_id);
2532 auto holder = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(this_slot));
2550 auto holder = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(from_slot));
2561 building_level =
uint8_t(std::clamp(int32_t(building_level) + int32_t(
trigger::payload(tval[1]).signed_value),
2564 ws.railroad_built.store(
true, std::memory_order::release);
2570 building_level =
uint8_t(std::clamp(int32_t(building_level) + int32_t(
trigger::payload(tval[1]).signed_value),
2574 ws.railroad_built.store(
true, std::memory_order::release);
2581 assert(std::isfinite(amount));
2582 m = std::max(0.0f, m + amount);
2590 auto holder = ws.world.national_identity_get_nation_from_identity_holder(
trigger::payload(tval[1]).tag_id);
2601 auto holder = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(this_slot));
2612 auto holder = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(from_slot));
2619 auto target = ws.world.national_identity_get_nation_from_identity_holder(
trigger::payload(tval[1]).tag_id);
2629 auto target = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(this_slot));
2639 auto target = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(from_slot));
2645 auto holder = ws.world.national_identity_get_nation_from_identity_holder(
trigger::payload(tval[1]).tag_id);
2668 auto target = ws.world.national_identity_get_nation_from_identity_holder(
trigger::payload(tval[1]).tag_id);
2699 assert(std::isfinite(amount));
2700 plur = std::clamp(plur + amount, 0.0f, 100.0f);
2719 auto holder = ws.world.national_identity_get_nation_from_identity_holder(
trigger::payload(tval[1]).tag_id);
2720 if(holder && ws.world.nation_get_owned_province_count(holder) != 0 && ws.world.nation_get_owned_province_count(
trigger::to_nation(primary_slot)) != 0)
2730 auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(this_slot));
2731 if(owner && ws.world.nation_get_owned_province_count(owner) != 0 && ws.world.nation_get_owned_province_count(
trigger::to_nation(primary_slot)) != 0)
2741 auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(from_slot));
2742 if(owner && ws.world.nation_get_owned_province_count(owner) != 0 && ws.world.nation_get_owned_province_count(
trigger::to_nation(primary_slot)) != 0)
2747 auto holder = ws.world.national_identity_get_nation_from_identity_holder(
trigger::payload(tval[1]).tag_id);
2750 auto hprovs = ws.world.nation_get_province_ownership(holder);
2751 if(hprovs.begin() == hprovs.end()) {
2753 if(ws.world.nation_get_owned_province_count(holder) == 0)
2757 auto sr = ws.world.force_create_gp_relationship(holder,
trigger::to_nation(primary_slot));
2758 auto& flags = ws.world.gp_relationship_get_status(sr);
2763 auto rel = ws.world.nation_get_overlord_as_subject(holder);
2772 if(hprovs.begin() == hprovs.end()) {
2780 auto& flags = ws.world.gp_relationship_get_status(sr);
2793 auto holder = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(this_slot));
2796 auto hprovs = ws.world.nation_get_province_ownership(holder);
2797 if(hprovs.begin() == hprovs.end()) {
2800 if(ws.world.nation_get_owned_province_count(holder) == 0)
2804 auto sr = ws.world.force_create_gp_relationship(holder,
trigger::to_nation(primary_slot));
2805 auto& flags = ws.world.gp_relationship_get_status(sr);
2810 auto rel = ws.world.nation_get_overlord_as_subject(holder);
2819 if(hprovs.begin() == hprovs.end()) {
2827 auto& flags = ws.world.gp_relationship_get_status(sr);
2840 auto holder = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(from_slot));
2843 auto hprovs = ws.world.nation_get_province_ownership(holder);
2844 if(hprovs.begin() == hprovs.end()) {
2847 if(ws.world.nation_get_owned_province_count(holder) == 0)
2851 auto sr = ws.world.force_create_gp_relationship(holder,
trigger::to_nation(primary_slot));
2852 auto& flags = ws.world.gp_relationship_get_status(sr);
2857 auto rel = ws.world.nation_get_overlord_as_subject(holder);
2865 auto itag = ws.world.rebel_faction_get_defection_target(
trigger::to_rebel(from_slot));
2866 auto holder = ws.world.national_identity_get_nation_from_identity_holder(itag);
2869 auto hprovs = ws.world.nation_get_province_ownership(holder);
2870 if(hprovs.begin() == hprovs.end()) {
2872 if(ws.world.nation_get_owned_province_count(holder) == 0)
2876 auto sr = ws.world.force_create_gp_relationship(holder,
trigger::to_nation(primary_slot));
2877 auto& flags = ws.world.gp_relationship_get_status(sr);
2882 auto rel = ws.world.nation_get_overlord_as_subject(holder);
2894 auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot));
2896 return ef_release_vassal(tval, ws,
trigger::to_generic(owner), this_slot, from_slot, r_hi, r_lo, els);
2901 auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot));
2903 return ef_release_vassal_this_nation(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_province(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_from_nation(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_province(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_reb(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_random(tval, ws,
trigger::to_generic(owner), this_slot, from_slot, r_hi, r_lo, els);
2952 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[1]).glob_id,
true);
2956 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[1]).glob_id,
false);
2960 auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot));
2962 ws.world.nation_set_national_value(owner,
trigger::payload(tval[1]).mod_id);
2979 ws.world.province_set_is_slave(p,
false);
2980 bool mine = ws.world.commodity_get_is_mine(ws.world.province_get_rgo(p));
2981 for(
auto pop : ws.world.province_get_pop_location(p)) {
2982 if(pop.get_pop().get_poptype() == ws.culture_definitions.slaves) {
2983 pop.get_pop().set_poptype(mine ? ws.culture_definitions.laborers : ws.culture_definitions.farmers);
2990 if(ws.world.pop_get_poptype(
trigger::to_pop(primary_slot)) == ws.culture_definitions.slaves) {
2991 bool mine = ws.world.commodity_get_is_mine(
2992 ws.world.province_get_rgo(ws.world.pop_get_province_from_pop_location(
trigger::to_pop(primary_slot))));
2994 mine ? ws.culture_definitions.laborers : ws.culture_definitions.farmers);
3000 ws.world.province_set_is_slave(p,
false);
3001 bool mine = ws.world.commodity_get_is_mine(ws.world.province_get_rgo(p));
3002 for(
auto pop : ws.world.province_get_pop_location(p)) {
3003 if(pop.get_pop().get_poptype() == ws.culture_definitions.slaves) {
3004 pop.get_pop().set_poptype(mine ? ws.culture_definitions.laborers : ws.culture_definitions.farmers);
3022 auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot));
3039 auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot));
3048 auto income = ws.world.nation_get_total_poor_income(
trigger::to_nation(primary_slot)) +
3052 assert(std::isfinite(amount));
3053 auto combined_amount = income * amount;
3054 assert(std::isfinite(combined_amount));
3058 v = v + combined_amount;
3060 v = std::max(v + combined_amount, 0.0f);
3069 assert(std::isfinite(amount));
3081 assert(std::isfinite(amount));
3082 for(
auto p : ws.world.province_get_pop_location(
trigger::to_prov(primary_slot))) {
3083 p.get_pop().get_size() *= amount;
3089 assert(std::isfinite(amount));
3090 for(
auto pr : ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot))) {
3091 for(
auto p : pr.get_province().get_pop_location()) {
3092 p.get_pop().get_size() *= amount;
3099 assert(std::isfinite(amount));
3101 for(
auto p : ws.world.province_get_pop_location(pr)) {
3102 p.get_pop().get_size() *= amount;
3118 assert(std::isfinite(amount));
3126 assert(std::isfinite(amount));
3129 (ws.world.nation_get_modifier_values(
trigger::to_nation(primary_slot), sys::national_mod_offsets::prestige) + 1.0f) *
3137 assert(std::isfinite(amount));
3139 bp = std::max(0.0f, bp + (score)*amount);
3157 std::vector<dcon::reform_option_id> active_reforms;
3159 for(
auto issue : ws.world.in_reform) {
3161 ws.world.nation_get_reforms(nation_id, issue) != ws.world.reform_get_options(issue)[0])
3162 active_reforms.push_back(ws.world.reform_get_options(issue)[0]);
3164 for(int32_t i = tval[1] - 1; active_reforms.size() != 0 && i >= 0; --i) {
3167 active_reforms[r] = active_reforms.back();
3168 active_reforms.pop_back();
3175 std::vector<dcon::reform_option_id> active_reforms;
3177 for(
auto issue : ws.world.in_reform) {
3179 ws.world.nation_get_reforms(nation_id, issue) != ws.world.reform_get_options(issue)[0])
3180 active_reforms.push_back(ws.world.reform_get_options(issue)[0]);
3182 for(int32_t i = tval[1] - 1; active_reforms.size() != 0 && i >= 0; --i) {
3185 active_reforms[r] = active_reforms.back();
3186 active_reforms.pop_back();
3197 ws.world.province_set_crime(
trigger::to_prov(primary_slot), dcon::crime_id{});
3206 auto cs = ws.world.province_get_state_membership(c);
3223 ws.military_definitions.great_wars_enabled =
true;
3227 ws.military_definitions.great_wars_enabled =
false;
3231 ws.military_definitions.world_wars_enabled =
true;
3235 ws.military_definitions.world_wars_enabled =
false;
3239 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot)); owner) {
3240 auto owner_c = ws.world.nation_get_primary_culture(owner);
3241 for(
auto pop : ws.world.province_get_pop_location(
trigger::to_prov(primary_slot))) {
3242 pop.get_pop().set_culture(owner_c);
3243 pop.get_pop().set_is_primary_or_accepted_culture(
true);
3249 if(
auto owner = ws.world.state_instance_get_nation_from_state_ownership(
trigger::to_state(primary_slot)); owner) {
3250 auto owner_c = ws.world.nation_get_primary_culture(owner);
3252 for(
auto pop : ws.world.province_get_pop_location(p)) {
3253 pop.get_pop().set_culture(owner_c);
3254 pop.get_pop().set_is_primary_or_accepted_culture(true);
3262 auto owner_c = ws.world.nation_get_primary_culture(owner);
3264 ws.world.pop_set_is_primary_or_accepted_culture(
trigger::to_pop(primary_slot),
true);
3279 assert(std::isfinite(amount));
3285 for(
auto& im : ws.crisis_participants) {
3291 im.merely_interested =
true;
3292 im.supports_attacker =
false;
3300 auto& current_tension = ws.world.state_instance_get_flashpoint_tension(
trigger::to_state(primary_slot));
3302 assert(std::isfinite(amount));
3304 current_tension = std::clamp(current_tension + amount, 0.0f, 100.0f);
3308 auto state = ws.world.province_get_state_membership(
trigger::to_prov(primary_slot));
3312 auto& current_tension = ws.world.state_instance_get_flashpoint_tension(state);
3314 assert(std::isfinite(amount));
3316 current_tension = std::clamp(current_tension + amount, 0.0f, 100.0f);
3321 assert(std::isfinite(amount));
3323 ws.crisis_temperature = std::clamp(ws.crisis_temperature + amount, 0.0f, 100.0f);
3328 assert(std::isfinite(amount));
3336 assert(std::isfinite(amount));
3337 for(
auto p : ws.world.province_get_pop_location(
trigger::to_prov(primary_slot))) {
3345 assert(std::isfinite(amount));
3346 for(
auto pr : ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot))) {
3347 for(
auto p : pr.get_province().get_pop_location()) {
3356 assert(std::isfinite(amount));
3358 for(
auto p : ws.world.province_get_pop_location(pr)) {
3359 auto c = pop_demographics::get_consciousness(ws, p.get_pop());
3360 pop_demographics::set_consciousness(ws, p.get_pop(), std::clamp(c + amount, 0.0f, 10.0f));
3367 assert(std::isfinite(amount));
3375 assert(std::isfinite(amount));
3376 for(
auto p : ws.world.province_get_pop_location(
trigger::to_prov(primary_slot))) {
3384 assert(std::isfinite(amount));
3385 for(
auto pr : ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot))) {
3386 for(
auto p : pr.get_province().get_pop_location()) {
3395 assert(std::isfinite(amount));
3397 for(
auto p : ws.world.province_get_pop_location(pr)) {
3398 auto c = pop_demographics::get_militancy(ws, p.get_pop());
3399 pop_demographics::set_militancy(ws, p.get_pop(), std::clamp(c + amount, 0.0f, 10.0f));
3411 building_level =
uint8_t(std::clamp(int32_t(building_level) + int32_t(
trigger::payload(tval[1]).signed_value),
3419 if(building_level > 0) {
3420 auto si = ws.world.province_get_state_membership(
trigger::to_prov(primary_slot));
3421 ws.world.state_instance_set_naval_base_is_taken(si,
true);
3447 lvl = std::max<uint32_t>(lvl, building_level);
3450 auto si = ws.world.province_get_state_membership(
trigger::to_prov(primary_slot));
3451 ws.world.state_instance_set_naval_base_is_taken(si,
true);
3476 if(
auto owner = ws.world.state_instance_get_nation_from_state_ownership(
trigger::to_state(primary_slot)); owner)
3482 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot)); owner)
3488 if(
auto holder = ws.world.national_identity_get_nation_from_identity_holder(
trigger::payload(tval[1]).
tag_id); holder)
3499 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(this_slot)); owner)
3510 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(from_slot)); owner)
3516 if(
auto holder = ws.world.national_identity_get_nation_from_identity_holder(
trigger::payload(tval[1]).
tag_id); holder)
3526 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(this_slot)); owner)
3536 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(from_slot)); owner)
3575 if(
auto holder = ws.world.national_identity_get_nation_from_identity_holder(tag_target); holder) {
3585 if(
auto holder = ws.world.province_get_nation_from_province_ownership(
trigger::payload(tval[3]).
prov_id); holder) {
3605 if(
auto holder = ws.world.state_instance_get_nation_from_state_ownership(
trigger::to_state(this_slot)); holder) {
3615 if(
auto holder = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(this_slot)); holder) {
3645 if(
auto holder = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(from_slot)); holder) {
3656 if(
auto holder = ws.world.national_identity_get_nation_from_identity_holder(tag_target); holder) {
3657 ws.world.nation_get_available_cbs(holder).push_back(
3666 if(
auto holder = ws.world.province_get_nation_from_province_ownership(
trigger::payload(tval[3]).
prov_id); holder) {
3667 ws.world.nation_get_available_cbs(holder).push_back(
3684 if(
auto holder = ws.world.state_instance_get_nation_from_state_ownership(
trigger::to_state(this_slot)); holder) {
3685 ws.world.nation_get_available_cbs(holder).push_back(
3694 if(
auto holder = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(this_slot)); holder) {
3695 ws.world.nation_get_available_cbs(holder).push_back(
3705 ws.world.nation_get_available_cbs(holder).push_back(
3722 if(
auto holder = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(from_slot)); holder) {
3723 ws.world.nation_get_available_cbs(holder).push_back(
3732 auto holder = ws.world.national_identity_get_nation_from_identity_holder(tag_target);
3734 for(
uint32_t i = cbs.size(); i-- > 0;) {
3735 if(cbs.at(i).cb_type == type && cbs.at(i).target == holder)
3743 auto holder = ws.world.province_get_nation_from_province_ownership(
trigger::payload(tval[2]).prov_id);
3745 for(
uint32_t i = cbs.size(); i-- > 0;) {
3746 if(cbs.at(i).cb_type == type && cbs.at(i).target == holder)
3756 for(
uint32_t i = cbs.size(); i-- > 0;) {
3757 if(cbs.at(i).cb_type == type && cbs.at(i).target == holder)
3765 auto holder = ws.world.state_instance_get_nation_from_state_ownership(
trigger::to_state(this_slot));
3767 for(
uint32_t i = cbs.size(); i-- > 0;) {
3768 if(cbs.at(i).cb_type == type && cbs.at(i).target == holder)
3776 auto holder = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(this_slot));
3778 for(
uint32_t i = cbs.size(); i-- > 0;) {
3779 if(cbs.at(i).cb_type == type && cbs.at(i).target == holder)
3789 for(
uint32_t i = cbs.size(); i-- > 0;) {
3790 if(cbs.at(i).cb_type == type && cbs.at(i).target == holder)
3800 for(
uint32_t i = cbs.size(); i-- > 0;) {
3801 if(cbs.at(i).cb_type == type && cbs.at(i).target == holder)
3809 auto holder = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(from_slot));
3811 for(
uint32_t i = cbs.size(); i-- > 0;) {
3812 if(cbs.at(i).cb_type == type && cbs.at(i).target == holder)
3821 auto holder = ws.world.national_identity_get_nation_from_identity_holder(tag_target);
3823 auto cbs = ws.world.nation_get_available_cbs(holder);
3824 for(
uint32_t i = cbs.size(); i-- > 0;) {
3825 if(cbs.at(i).cb_type == type && cbs.at(i).target ==
trigger::to_nation(primary_slot))
3834 auto holder = ws.world.province_get_nation_from_province_ownership(
trigger::payload(tval[2]).prov_id);
3836 auto cbs = ws.world.nation_get_available_cbs(holder);
3837 for(
uint32_t i = cbs.size(); i-- > 0;) {
3838 if(cbs.at(i).cb_type == type && cbs.at(i).target ==
trigger::to_nation(primary_slot))
3848 auto cbs = ws.world.nation_get_available_cbs(holder);
3849 for(
uint32_t i = cbs.size(); i-- > 0;) {
3850 if(cbs.at(i).cb_type == type && cbs.at(i).target ==
trigger::to_nation(primary_slot))
3858 auto holder = ws.world.state_instance_get_nation_from_state_ownership(
trigger::to_state(this_slot));
3860 auto cbs = ws.world.nation_get_available_cbs(holder);
3861 for(
uint32_t i = cbs.size(); i-- > 0;) {
3862 if(cbs.at(i).cb_type == type && cbs.at(i).target ==
trigger::to_nation(primary_slot))
3871 auto holder = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(this_slot));
3873 auto cbs = ws.world.nation_get_available_cbs(holder);
3874 for(
uint32_t i = cbs.size(); i-- > 0;) {
3875 if(cbs.at(i).cb_type == type && cbs.at(i).target ==
trigger::to_nation(primary_slot))
3886 auto cbs = ws.world.nation_get_available_cbs(holder);
3887 for(
uint32_t i = cbs.size(); i-- > 0;) {
3888 if(cbs.at(i).cb_type == type && cbs.at(i).target ==
trigger::to_nation(primary_slot))
3898 auto cbs = ws.world.nation_get_available_cbs(holder);
3899 for(
uint32_t i = cbs.size(); i-- > 0;) {
3900 if(cbs.at(i).cb_type == type && cbs.at(i).target ==
trigger::to_nation(primary_slot))
3908 auto holder = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(from_slot));
3910 auto cbs = ws.world.nation_get_available_cbs(holder);
3911 for(
uint32_t i = cbs.size(); i-- > 0;) {
3912 if(cbs.at(i).cb_type == type && cbs.at(i).target ==
trigger::to_nation(primary_slot))
3920 auto target = ws.world.national_identity_get_nation_from_identity_holder(
trigger::payload(tval[1]).tag_id);
3921 if(ws.world.nation_get_owned_province_count(target) == 0 || ws.world.nation_get_owned_province_count(
trigger::to_nation(primary_slot)) == 0)
3928 if(ws.world.nation_get_owned_province_count(target) == 0 || ws.world.nation_get_owned_province_count(
trigger::to_nation(primary_slot)) == 0)
3934 auto target = ws.world.state_instance_get_nation_from_state_ownership(
trigger::to_state(this_slot));
3935 if(ws.world.nation_get_owned_province_count(target) == 0 || ws.world.nation_get_owned_province_count(
trigger::to_nation(primary_slot)) == 0)
3941 auto target = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(this_slot));
3942 if(ws.world.nation_get_owned_province_count(target) == 0 || ws.world.nation_get_owned_province_count(
trigger::to_nation(primary_slot)) == 0)
3949 if(ws.world.nation_get_owned_province_count(target) == 0 || ws.world.nation_get_owned_province_count(
trigger::to_nation(primary_slot)) == 0)
3956 if(ws.world.nation_get_owned_province_count(target) == 0 || ws.world.nation_get_owned_province_count(
trigger::to_nation(primary_slot)) == 0)
3962 auto target = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(this_slot));
3963 if(ws.world.nation_get_owned_province_count(target) == 0 || ws.world.nation_get_owned_province_count(
trigger::to_nation(primary_slot)) == 0)
3969 for(
auto drel : ws.world.nation_get_diplomatic_relation(
trigger::to_nation(primary_slot))) {
3970 auto other_nation = drel.get_related_nations(0) !=
trigger::to_nation(primary_slot) ? drel.get_related_nations(0) : drel.get_related_nations(1);
3971 if(drel.get_are_allied()) {
3972 for(
auto wfor : ws.world.nation_get_war_participant(
trigger::to_nation(primary_slot))) {
3977 std::memset(&m, 0,
sizeof(m));
3979 m.to = other_nation;
3981 m.data.war = wfor.get_war();
3989 std::memset(&m, 0,
sizeof(m));
3991 m.to = other_nation;
3993 m.data.war = wfor.get_war();
4015 auto target = ws.world.national_identity_get_nation_from_identity_holder(
trigger::payload(tval[1]).tag_id);
4018 if(ws.world.nation_get_owned_province_count(target) == 0 || ws.world.nation_get_owned_province_count(
trigger::to_nation(primary_slot)) == 0)
4049 if(ws.world.nation_get_owned_province_count(target) == 0 || ws.world.nation_get_owned_province_count(
trigger::to_nation(primary_slot)) == 0)
4079 if(
auto owner = ws.world.state_instance_get_nation_from_state_ownership(
trigger::to_state(this_slot)); owner)
4080 return ef_war_this_nation(tval, ws, primary_slot,
trigger::to_generic(owner), 0, r_lo, r_hi, els);
4084 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(this_slot)); owner)
4085 return ef_war_this_nation(tval, ws, primary_slot,
trigger::to_generic(owner), 0, r_lo, r_hi, els);
4090 return ef_war_this_nation(tval, ws, primary_slot,
trigger::to_generic(owner), 0, r_lo, r_hi, els);
4094 return ef_war_this_nation(tval, ws, primary_slot, from_slot, 0, r_lo, r_hi, els);
4097 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(from_slot)); owner)
4098 return ef_war_this_nation(tval, ws, primary_slot,
trigger::to_generic(owner), 0, r_lo, r_hi, els);
4102 auto target = ws.world.national_identity_get_nation_from_identity_holder(
trigger::payload(tval[1]).tag_id);
4105 if(ws.world.nation_get_owned_province_count(target) == 0 || ws.world.nation_get_owned_province_count(
trigger::to_nation(primary_slot)) == 0)
4135 if(ws.world.nation_get_owned_province_count(target) == 0 || ws.world.nation_get_owned_province_count(
trigger::to_nation(primary_slot)) == 0)
4164 if(
auto owner = ws.world.state_instance_get_nation_from_state_ownership(
trigger::to_state(this_slot)); owner)
4165 ef_war_no_ally_this_nation(tval, ws, primary_slot,
trigger::to_generic(owner), 0, r_lo, r_hi, els);
4169 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(this_slot)); owner)
4170 ef_war_no_ally_this_nation(tval, ws, primary_slot,
trigger::to_generic(owner), 0, r_lo, r_hi, els);
4175 ef_war_no_ally_this_nation(tval, ws, primary_slot,
trigger::to_generic(owner), 0, r_lo, r_hi, els);
4179 ef_war_no_ally_this_nation(tval, ws, primary_slot, from_slot, 0, r_lo, r_hi, els);
4183 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(from_slot)); owner)
4184 ef_war_no_ally_this_nation(tval, ws, primary_slot,
trigger::to_generic(owner), 0, r_lo, r_hi, els);
4188 auto postpone = int32_t(tval[2]);
4190 auto future_date = ws.current_date + postpone;
4203 auto postpone = int32_t(tval[2]);
4205 auto future_date = ws.current_date + postpone;
4214 auto postpone = int32_t(tval[2]);
4216 auto future_date = ws.current_date + postpone;
4227 auto postpone = int32_t(tval[2]);
4229 auto future_date = ws.current_date + postpone;
4238 auto postpone = int32_t(tval[2]);
4240 auto future_date = ws.current_date + postpone;
4251 auto postpone = int32_t(tval[2]);
4253 auto future_date = ws.current_date + postpone;
4262 auto postpone = int32_t(tval[2]);
4264 auto future_date = ws.current_date + postpone;
4275 auto postpone = int32_t(tval[2]);
4277 auto future_date = ws.current_date + postpone;
4286 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot)); owner)
4287 return ef_country_event_this_nation(tval, ws,
trigger::to_generic(owner), this_slot, 0, r_lo, r_hi, els);
4291 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot)); owner)
4292 return ef_country_event_immediate_this_nation(tval, ws,
trigger::to_generic(owner), this_slot, 0, r_lo, r_hi, els);
4296 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot)); owner)
4297 return ef_country_event_this_state(tval, ws,
trigger::to_generic(owner), this_slot, 0, r_lo, r_hi, els);
4301 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot)); owner)
4302 return ef_country_event_immediate_this_state(tval, ws,
trigger::to_generic(owner), this_slot, 0, r_lo, r_hi, els);
4306 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot)); owner)
4307 return ef_country_event_this_province(tval, ws,
trigger::to_generic(owner), this_slot, 0, r_lo, r_hi, els);
4311 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot)); owner)
4312 return ef_country_event_immediate_this_province(tval, ws,
trigger::to_generic(owner), this_slot, 0, r_lo, r_hi, els);
4316 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot)); owner)
4317 return ef_country_event_this_pop(tval, ws,
trigger::to_generic(owner), this_slot, 0, r_lo, r_hi, els);
4321 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot)); owner)
4322 return ef_country_event_immediate_this_pop(tval, ws,
trigger::to_generic(owner), this_slot, 0, r_lo, r_hi, els);
4344 assert(std::isfinite(amount));
4351 assert(std::isfinite(amount));
4359 assert(std::isfinite(factor));
4362 float new_total = 1.0f - s + std::max(0.0f, s + factor);
4365 for(
auto j : ws.world.in_ideology) {
4375 assert(std::isfinite(amount));
4378 float new_total = 100.0f - u + std::max(0.0f, u + 100.0f * amount);
4379 u = std::max(0.0f, u + 100.0f * amount);
4382 for(
auto j : ws.world.in_ideology) {
4386 ws.world.nation_get_upper_house(
trigger::to_nation(primary_slot), j) *= 100.0f / (new_total);
4396 assert(std::isfinite(adjustment));
4407 assert(std::isfinite(adjustment));
4416 assert(std::isfinite(adjustment));
4427 assert(std::isfinite(adjustment));
4438 assert(std::isfinite(adjustment));
4455 assert(std::isfinite(factor));
4457 for(
auto p : ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot))) {
4458 for(
auto pop : p.get_province().get_pop_location()) {
4460 float adjustment = factor * support;
4471 assert(std::isfinite(factor));
4473 for(
auto p : ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot))) {
4474 for(
auto pop : p.get_province().get_pop_location()) {
4476 float adjustment = factor * support;
4486 assert(std::isfinite(factor));
4488 for(
auto p : ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot))) {
4489 for(
auto pop : p.get_province().get_pop_location()) {
4491 float adjustment = factor * unemployed;
4502 assert(std::isfinite(factor));
4504 for(
auto p : ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot))) {
4505 for(
auto pop : p.get_province().get_pop_location()) {
4507 float adjustment = factor * support;
4518 assert(std::isfinite(factor));
4520 for(
auto p : ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot))) {
4521 for(
auto pop : p.get_province().get_pop_location()) {
4523 float adjustment = factor * support;
4533 assert(std::isfinite(factor));
4535 for(
auto p : ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot))) {
4536 for(
auto pop : p.get_province().get_pop_location()) {
4538 float adjustment = factor * unemployed;
4549 assert(std::isfinite(factor));
4552 for(
auto pop : ws.world.province_get_pop_location(p)) {
4553 auto support = pop_demographics::get_demo(ws, pop.get_pop(), demo_tag);
4554 float adjustment = factor * support;
4555 auto v = pop_demographics::get_militancy(ws, pop.get_pop());
4556 pop_demographics::set_militancy(ws, pop.get_pop(), std::clamp(v + adjustment, 0.0f, 10.0f));
4565 assert(std::isfinite(factor));
4568 for(
auto pop : ws.world.province_get_pop_location(p)) {
4569 auto support = pop_demographics::get_demo(ws, pop.get_pop(), demo_tag);
4570 float adjustment = factor * support;
4571 auto v = pop_demographics::get_militancy(ws, pop.get_pop());
4572 pop_demographics::set_militancy(ws, pop.get_pop(), std::clamp(v + adjustment, 0.0f, 10.0f));
4580 assert(std::isfinite(factor));
4583 for(
auto pop : ws.world.province_get_pop_location(p)) {
4584 auto unemployed = 1.0f - pop_demographics::get_raw_employment(ws, pop.get_pop());
4585 float adjustment = factor * unemployed;
4586 auto v = pop_demographics::get_militancy(ws, pop.get_pop());
4587 pop_demographics::set_militancy(ws, pop.get_pop(), std::clamp(v + adjustment, 0.0f, 10.0f));
4596 assert(std::isfinite(factor));
4599 for(
auto pop : ws.world.province_get_pop_location(p)) {
4600 auto support = pop_demographics::get_demo(ws, pop.get_pop(), demo_tag);
4601 float adjustment = factor * support;
4602 auto v = pop_demographics::get_consciousness(ws, pop.get_pop());
4603 pop_demographics::set_consciousness(ws, pop.get_pop(), std::clamp(v + adjustment, 0.0f, 10.0f));
4612 assert(std::isfinite(factor));
4615 for(
auto pop : ws.world.province_get_pop_location(p)) {
4616 auto support = pop_demographics::get_demo(ws, pop.get_pop(), demo_tag);
4617 float adjustment = factor * support;
4618 auto v = pop_demographics::get_consciousness(ws, pop.get_pop());
4619 pop_demographics::set_consciousness(ws, pop.get_pop(), std::clamp(v + adjustment, 0.0f, 10.0f));
4627 assert(std::isfinite(factor));
4630 for(
auto pop : ws.world.province_get_pop_location(p)) {
4631 auto unemployed = 1.0f - pop_demographics::get_raw_employment(ws, pop.get_pop());
4632 float adjustment = factor * unemployed;
4633 auto v = pop_demographics::get_consciousness(ws, pop.get_pop());
4634 pop_demographics::set_consciousness(ws, pop.get_pop(), std::clamp(v + adjustment, 0.0f, 10.0f));
4643 assert(std::isfinite(factor));
4645 for(
auto pop : ws.world.province_get_pop_location(
trigger::to_prov(primary_slot))) {
4647 float adjustment = factor * support;
4657 assert(std::isfinite(factor));
4659 for(
auto pop : ws.world.province_get_pop_location(
trigger::to_prov(primary_slot))) {
4661 float adjustment = factor * support;
4670 assert(std::isfinite(factor));
4672 for(
auto pop : ws.world.province_get_pop_location(
trigger::to_prov(primary_slot))) {
4674 float adjustment = factor * unemployed;
4684 assert(std::isfinite(factor));
4686 for(
auto pop : ws.world.province_get_pop_location(
trigger::to_prov(primary_slot))) {
4688 float adjustment = factor * support;
4698 assert(std::isfinite(factor));
4700 for(
auto pop : ws.world.province_get_pop_location(
trigger::to_prov(primary_slot))) {
4702 float adjustment = factor * support;
4711 assert(std::isfinite(factor));
4713 for(
auto pop : ws.world.province_get_pop_location(
trigger::to_prov(primary_slot))) {
4715 float adjustment = factor * unemployed;
4724 assert(std::isfinite(amount));
4726 v = std::max(v + amount, 0.0f);
4731 assert(std::isfinite(amount));
4732 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot)); owner) {
4733 auto& v = ws.world.nation_get_stockpiles(owner,
trigger::payload(tval[1]).com_id);
4734 v = std::max(v + amount, 0.0f);
4740 auto esv = ws.to_string_view(ename);
4742 auto n = l.get_leader().get_name();
4743 auto nsv = ws.to_string_view(n);
4752 auto l = fatten(ws.world, ws.world.create_leader());
4753 l.set_since(ws.current_date);
4754 l.set_is_admiral(
false);
4762 auto l = fatten(ws.world, ws.world.create_leader());
4763 l.set_since(ws.current_date);
4764 l.set_is_admiral(
true);
4776 auto new_total = 1.0f - s + std::max(0.0f, s + factor);
4779 for(
auto i : ws.world.in_issue_option) {
4790 for(
auto p : ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot))) {
4791 for(
auto pop : p.get_province().get_pop_location()) {
4793 auto new_total = 1.0f - s + std::max(0.0f, s + factor);
4796 for(
auto i : ws.world.in_issue_option) {
4808 dcon::state_definition_id{}, dcon::national_identity_id{},
trigger::to_nation(primary_slot));
4817 for(
auto p : ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot))) {
4818 for(
auto pop : p.get_province().get_pop_location()) {
4834 for(
auto pop : ws.world.province_get_pop_location(p)) {
4835 auto s = pop_demographics::get_demo(ws, pop.get_pop(), from_issue);
4836 pop_demographics::set_demo(ws, pop.get_pop(), from_issue, s - s * amount);
4837 auto s2 = pop_demographics::get_demo(ws, pop.get_pop(), to_issue);
4838 pop_demographics::set_demo(ws, pop.get_pop(), from_issue, s2 + s * amount);
4849 for(
auto pop : ws.world.province_get_pop_location(
trigger::to_prov(primary_slot))) {
4873 auto& v = ws.world.province_get_party_loyalty(
trigger::payload(tval[1]).prov_id, i);
4874 v = std::clamp(v + amount, -1.0f, 1.0f);
4880 auto& v = ws.world.province_get_party_loyalty(
trigger::to_prov(primary_slot), i);
4881 v = std::clamp(v + amount, -1.0f, 1.0f);
4887 auto cs = ws.world.province_get_state_membership(c);
4889 if(ws.world.province_get_modifier_values(p, sys::provincial_mod_offsets::min_build_railroad) <= 1.0f)
4892 ws.railroad_built.store(
true, std::memory_order::release);
4897 auto cs = ws.world.province_get_state_membership(c);
4899 if(ws.world.province_get_modifier_values(p, sys::provincial_mod_offsets::min_build_railroad) <= 1.0f)
4902 ws.railroad_built.store(
true, std::memory_order::release);
4908 if(ws.world.province_get_modifier_values(c, sys::provincial_mod_offsets::min_build_railroad) <= 1.0f) {
4910 ws.railroad_built.store(
true, std::memory_order::release);
4918 if(ws.world.province_get_modifier_values(c, sys::provincial_mod_offsets::min_build_railroad) <= 1.0f) {
4920 ws.railroad_built.store(
true, std::memory_order::release);
4927 auto cs = ws.world.province_get_state_membership(c);
4934 auto cs = ws.world.province_get_state_membership(c);
4954 auto itag = ws.world.rebel_faction_get_defection_target(
trigger::to_rebel(from_slot));
4955 if(
auto holder = ws.world.national_identity_get_nation_from_identity_holder(itag); holder)
4980 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot)); owner)
4990 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot)); owner)
4995 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot)); owner)
4996 return ef_add_country_modifier_no_duration(tval, ws,
trigger::to_generic(owner), 0, 0, 0, 0, els);
5000 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot)); owner)
5005 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot)); owner)
5006 return ef_relation_this_nation(tval, ws,
trigger::to_generic(owner), this_slot, 0, 0, 0, els);
5010 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot)); owner)
5011 return ef_relation_this_province(tval, ws,
trigger::to_generic(owner), this_slot, 0, 0, 0, els);
5015 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot)); owner)
5016 return ef_relation_this_nation(tval, ws,
trigger::to_generic(owner), from_slot, 0, 0, 0, els);
5020 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot)); owner)
5021 return ef_relation_this_province(tval, ws,
trigger::to_generic(owner), from_slot, 0, 0, 0, els);
5025 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot)); owner)
5030 if(
auto owner = ws.world.province_get_nation_from_province_ownership(
trigger::to_prov(primary_slot)); owner)
5040 auto cs = ws.world.province_get_state_membership(c);
5042 if(ws.world.province_get_modifier_values(p, sys::provincial_mod_offsets::min_build_bank) <= 1.0f)
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)
5059 if(ws.world.province_get_modifier_values(c, sys::provincial_mod_offsets::min_build_bank) <= 1.0f)
5067 if(ws.world.province_get_modifier_values(c, sys::provincial_mod_offsets::min_build_bank) <= 1.0f)
5077 auto cs = ws.world.province_get_state_membership(c);
5079 if(ws.world.province_get_modifier_values(p, sys::provincial_mod_offsets::min_build_university) <= 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)
5096 if(ws.world.province_get_modifier_values(c, sys::provincial_mod_offsets::min_build_university) <= 1.0f)
5104 if(ws.world.province_get_modifier_values(c, sys::provincial_mod_offsets::min_build_university) <= 1.0f)
5111 auto sprovs = ws.world.nation_get_province_ownership(
trigger::to_nation(primary_slot));
5112 while(sprovs.begin() != sprovs.end()) {
5123 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[1]).glob_id,
false);
5124 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[2]).glob_id,
false);
5128 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[1]).glob_id,
false);
5129 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[2]).glob_id,
false);
5130 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[3]).glob_id,
false);
5134 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[1]).glob_id,
false);
5135 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[2]).glob_id,
false);
5136 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[3]).glob_id,
false);
5137 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[4]).glob_id,
false);
5141 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[1]).glob_id,
false);
5142 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[2]).glob_id,
false);
5143 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[3]).glob_id,
false);
5144 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[4]).glob_id,
false);
5145 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[5]).glob_id,
false);
5149 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[1]).glob_id,
false);
5150 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[2]).glob_id,
false);
5151 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[3]).glob_id,
false);
5152 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[4]).glob_id,
false);
5153 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[5]).glob_id,
false);
5154 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[6]).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);
5164 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[7]).glob_id,
false);
5168 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[1]).glob_id,
false);
5169 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[2]).glob_id,
false);
5170 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[3]).glob_id,
false);
5171 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[4]).glob_id,
false);
5172 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[5]).glob_id,
false);
5173 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[6]).glob_id,
false);
5174 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[7]).glob_id,
false);
5175 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[8]).glob_id,
false);
5179 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[1]).glob_id,
false);
5180 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[2]).glob_id,
false);
5181 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[3]).glob_id,
false);
5182 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[4]).glob_id,
false);
5183 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[5]).glob_id,
false);
5184 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[6]).glob_id,
false);
5185 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[7]).glob_id,
false);
5186 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[8]).glob_id,
false);
5187 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[9]).glob_id,
false);
5191 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[1]).glob_id,
false);
5192 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[2]).glob_id,
false);
5193 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[3]).glob_id,
false);
5194 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[4]).glob_id,
false);
5195 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[5]).glob_id,
false);
5196 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[6]).glob_id,
false);
5197 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[7]).glob_id,
false);
5198 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[8]).glob_id,
false);
5199 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[10]).glob_id,
false);
5204 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[1]).glob_id,
false);
5205 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[2]).glob_id,
false);
5206 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[3]).glob_id,
false);
5207 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[4]).glob_id,
false);
5208 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[5]).glob_id,
false);
5209 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[6]).glob_id,
false);
5210 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[7]).glob_id,
false);
5211 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[8]).glob_id,
false);
5212 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[9]).glob_id,
false);
5213 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[10]).glob_id,
false);
5214 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[11]).glob_id,
false);
5218 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[1]).glob_id,
false);
5219 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[2]).glob_id,
false);
5220 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[3]).glob_id,
false);
5221 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[4]).glob_id,
false);
5222 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[5]).glob_id,
false);
5223 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[6]).glob_id,
false);
5224 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[7]).glob_id,
false);
5225 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[8]).glob_id,
false);
5226 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[9]).glob_id,
false);
5227 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[10]).glob_id,
false);
5228 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[11]).glob_id,
false);
5229 ws.national_definitions.set_global_flag_variable(
trigger::payload(tval[12]).glob_id,
false);
5243 auto const p = ws.world.pop_get_province_from_pop_location(
trigger::to_pop(primary_slot));
5248 auto dnid = ws.world.nation_get_identity_from_identity_holder(
trigger::to_nation(this_slot));
5253 auto dnid = ws.world.nation_get_identity_from_identity_holder(
trigger::to_nation(from_slot));
5264 auto holder = ws.world.nation_get_identity_from_identity_holder(n);
5266 auto start = ws.world.national_identity_get_political_party_first(holder).id.index();
5267 auto end = start + ws.world.national_identity_get_political_party_count(holder);
5269 for(int32_t i = start; i < end; i++) {
5270 auto pid = dcon::political_party_id(dcon::political_party_id::value_base_t(i));
5272 ws.world.political_party_set_name(pid, new_name);
5278 auto rp = ws.world.nation_get_ruling_party(n);
5280 ws.world.political_party_set_name(rp, new_name);
5289 auto popt = ws.world.issue_option_get_parent_issue(new_opt);
5293 auto holder = ws.world.nation_get_identity_from_identity_holder(n);
5295 auto start = ws.world.national_identity_get_political_party_first(holder).id.index();
5296 auto end = start + ws.world.national_identity_get_political_party_count(holder);
5298 for(int32_t i = start; i < end; i++) {
5299 auto pid = dcon::political_party_id(dcon::political_party_id::value_base_t(i));
5301 ws.world.political_party_set_party_issues(pid, popt, new_opt);
5302 if(ws.world.nation_get_ruling_party(n) == pid)
5309 auto rp = ws.world.nation_get_ruling_party(n);
5311 ws.world.political_party_set_party_issues(rp, popt, new_opt);
5320#define EFFECT_BYTECODE_ELEMENT(code, name, arg) ef_##name,
5322#undef EFFECT_BYTECODE_ELEMENT
5327 es_x_neighbor_province_scope,
5328 es_x_neighbor_country_scope,
5330 es_x_country_scope_nation,
5331 es_x_empty_neighbor_province_scope,
5332 es_x_greater_power_scope,
5333 es_poor_strata_scope_nation,
5334 es_poor_strata_scope_state,
5335 es_poor_strata_scope_province,
5336 es_middle_strata_scope_nation,
5337 es_middle_strata_scope_state,
5338 es_middle_strata_scope_province,
5339 es_rich_strata_scope_nation,
5340 es_rich_strata_scope_state,
5341 es_rich_strata_scope_province,
5342 es_x_pop_scope_nation,
5343 es_x_pop_scope_state,
5344 es_x_pop_scope_province,
5345 es_x_owned_scope_nation,
5346 es_x_owned_scope_state,
5349 es_random_list_scope,
5351 es_owner_scope_state,
5352 es_owner_scope_province,
5353 es_controller_scope,
5355 es_country_scope_pop,
5356 es_country_scope_state,
5358 es_this_scope_nation,
5359 es_this_scope_state,
5360 es_this_scope_province,
5362 es_from_scope_nation,
5363 es_from_scope_state,
5364 es_from_scope_province,
5367 es_cultural_union_scope,
5369 es_sphere_owner_scope,
5370 es_independence_scope,
5371 es_flashpoint_tag_scope,
5372 es_crisis_state_scope,
5374 es_state_scope_province,
5375 es_x_substate_scope,
5376 es_capital_scope_province,
5377 es_x_core_scope_province,
5380 es_pop_type_scope_nation,
5381 es_pop_type_scope_state,
5382 es_pop_type_scope_province,
5383 es_region_proper_scope,
5387 es_x_event_country_scope,
5388 es_x_decision_country_scope,
5389 es_x_event_country_scope_nation,
5390 es_x_decision_country_scope_nation,
5391 es_from_bounce_scope,
5392 es_this_bounce_scope,
5393 es_random_by_modifier_scope,
5394 es_x_neighbor_province_scope_nation,
5395 es_x_empty_neighbor_province_scope_nation
5401 return effect_functions[*tval &
effect::code_mask](tval, ws, primary_slot, this_slot, from_slot, r_lo, r_hi, els);
5407 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)
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
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