77 lines
2.4 KiB
JavaScript
77 lines
2.4 KiB
JavaScript
// Diplomatic treaties. A treaty is proposed by one nation, accepted by another,
|
|
// and then lives on until it is broken or superseded. The catalogue is
|
|
// data-driven so a new treaty type only needs an entry here and a case in
|
|
// `_applyTreatyEffect`.
|
|
//
|
|
// `payload` names the field a proposal must carry (a city id, a unit list, a
|
|
// resource basket or a sum of money), and the UI uses `needs` to decide which
|
|
// picker to show.
|
|
|
|
export const TREATY_PEACE = "peace";
|
|
export const TREATY_ALLIANCE = "alliance";
|
|
export const TREATY_FREE_TRADE = "free_trade";
|
|
export const TREATY_GIVE_CITY = "give_city";
|
|
export const TREATY_GIVE_MILITARY = "give_military";
|
|
export const TREATY_GIVE_RESOURCES = "give_resources";
|
|
export const TREATY_GIVE_MONEY = "give_money";
|
|
export const TREATY_JOINT_RESEARCH = "joint_research";
|
|
|
|
export const TREATIES = [
|
|
{
|
|
id: TREATY_PEACE,
|
|
name: "Peace",
|
|
description: "Ends the war between the two signatories and sends their troops home.",
|
|
},
|
|
{
|
|
id: TREATY_ALLIANCE,
|
|
name: "Alliance",
|
|
description:
|
|
"The signatories spare each other's forces; attacking one breaks the pact and draws its allies into the war.",
|
|
},
|
|
{
|
|
id: TREATY_FREE_TRADE,
|
|
name: "Free trade",
|
|
description: "Lifts every tariff between the two signatories.",
|
|
},
|
|
{
|
|
id: TREATY_GIVE_CITY,
|
|
name: "Give city",
|
|
description: "Transfers one of the proposer's cities to the other signatory.",
|
|
payload: "city",
|
|
},
|
|
{
|
|
id: TREATY_GIVE_MILITARY,
|
|
name: "Give military materials",
|
|
description: "Transfers units to the other signatory. Infantry cannot be gifted.",
|
|
payload: "units",
|
|
},
|
|
{
|
|
id: TREATY_GIVE_RESOURCES,
|
|
name: "Give resources",
|
|
description: "Transfers stores of steel, high-tech, luxury or food.",
|
|
payload: "resources",
|
|
},
|
|
{
|
|
id: TREATY_GIVE_MONEY,
|
|
name: "Give money",
|
|
description: "Transfers a sum of money from the proposer's treasury.",
|
|
payload: "money",
|
|
},
|
|
{
|
|
id: TREATY_JOINT_RESEARCH,
|
|
name: "Joint research",
|
|
description:
|
|
"Each signatory also earns the research points the others produce, except on military technology.",
|
|
},
|
|
];
|
|
|
|
export function treatyById(id) {
|
|
return TREATIES.find((treaty) => treaty.id === id) || null;
|
|
}
|
|
|
|
// News stages, so one feed entry can announce a treaty at each step.
|
|
export const TREATY_PROPOSED = "proposed";
|
|
export const TREATY_SIGNED = "signed";
|
|
export const TREATY_REJECTED = "rejected";
|
|
export const TREATY_BROKEN = "broken";
|