SighPie / HFM

# Historical Flavour Mod
102 stars 61 forks source link

Fix conflicting Treaty Port event triggers #117

Open Suprcheese opened 6 years ago

Suprcheese commented 6 years ago

Negotiating an unequal treaty for a valuable Chinese treaty port is a sound imperialistic strategy, but some of the choices for treaty ports are more valuable than others, due to the extremely lucrative Precious Goods RGO.

Most of the ports are fixed with regards to the potential for Precious Goods, but a few provinces such as Shanghai have their event trigger scripted such that they will only switch RGOs if their population is below a certain threshold. This is all well and good, but the problem is there are two possible Treaty Port events: one that activates Precious Goods and one that does not. The problem is that some ports like Shanghai could have the wrong event fire due to overlapping trigger conditions.

The first event, id = 90954 : https://github.com/SighPie/HFM/blob/Development/HFM/events/CivilizationAndGunBoats.txt#L4541-L4590

This event is restricted to only certain provinces, and provides them with the Precious Goods RGO. Notice provinces 1569, 1566, 2632, and 1538 have population thresholds, among other triggering conditions. This event has a MTTH of 8 months.

The second event, id = 90958 : https://github.com/SighPie/HFM/blob/Development/HFM/events/CivilizationAndGunBoats.txt#L4704-L4739

This version of a treaty port does not provide the Precious Goods RGO, and also has a MTTH of 8 months. It will trigger for any port other than the ones explicitly enumerated, such as if provinces 1566 or 1569 exceed the population threshold. There is a big problem, though: Shanghai (province_id = 1538) is not explicitly enumerated here, but it is in the first event. This means that if one initially obtains the Shanghai treaty port underneath the population limit, both of these event trigger conditions are satisfied, and since they both have MTTH of 8 months, they are both equally likely to trigger. This means you can potentially be denied your Precious Goods, despite satisfying the conditions. While the same could happen, in theory, for province 2632 (Kwangchowan), this is highly unlikely because in order for it to switch to Precious Goods, Hong Kong must not have already switched, but Hong Kong will nearly always have switched after the first Opium War.

In any event, I have added additional trigger conditions to hopefully fix this issue.

Suprcheese commented 6 years ago

Well, hmm, I had wanted the second commit to be a separate pull request, but it seems to have automatically added it to this one. I suppose that's all right in the end, since it's a similar bugfix:

The event for Russia to lease Port Arthur from the Qing had incorrectly given a province modifier to Lüshun, rather than giving a timed country modifier to Russia like all the other Treaty Port decisions. I changed it to be properly matching all the other Treaty Port decisions.

moretrim commented 5 years ago

@Suprcheese

The event for Russia to lease Port Arthur from the Qing had incorrectly given a province modifier to Lüshun, rather than giving a timed country modifier to Russia like all the other Treaty Port decisions.

While the other treaty port decisions do put a timed country modifier on the seizing power, some (but not all? presumably depending on pop and RGO) treaty port provinces do seem to be designed to receive a province modifier.

The similar names easily lead to confusion, so for reference here's the code for transferring the same port of Lüshun aka Port Arthur aka 1481:

https://github.com/SighPie/HFM/blob/5e69825ac6dec19bef85db9d7e762d024b65cd03/HFM/decisions/Treaty%20Ports.txt#L286-L292