Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document unit bribe cost #2433

Merged
merged 1 commit into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/Manuals/Server/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ place to start is the ``#questions-and-answers`` or ``#technicalities`` channels
command-line.rst
commands.rst
options.rst
maths.rst
settings-file.rst
fcdb.rst
:maxdepth: 2
47 changes: 47 additions & 0 deletions docs/Manuals/Server/maths.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
.. SPDX-License-Identifier: GPL-3.0-or-later
.. SPDX-FileCopyrightText: Louis Moureaux <[email protected]>

Formulas
********

This page describes how Freeciv21 computes what happens in the game. It is
intended as a reference for ruleset authors and players who want to heavily
optimize their actions. Developers may occasionally find it useful, too.

Unit Bribe Cost
===============

The amount of gold needed to bribe a unit is primarily governed by who much the
unit costs, the ``base_bribe_cost`` ruleset setting, and how far the unit is
from the nearest capital city (capped to 32 tiles). The amount of gold the
opposing player has also plays a role. The base cost is computed as follows:

.. math::
\text{base cost} =
\frac{\text{owner gold} + \texttt{base\_bribe\_cost}}{2 + \text{distance}}
\times \frac{\text{unit cost in shields}}{10}

Several multiplicative factors are applied on top of the base cost:

* Rulesets can modify this cost through the
:ref:`Unit_Bribe_Cost_Pct effect <effect-unit-bribe-cost-pct>`:

.. math::
f_\text{effects} = 1 + \frac{\texttt{Unit\_Bribe\_Cost\_Pct}}{100}

* Veteran units are more expensive. The cost is increased by two factors, the
combat power factor :math:`f_\text{power}` and the relative speed of the unit
compared to a green one, :math:`f_\text{MP}`.
* Finally, a discount is given if the unit is short on HP, reducing the cost by
up to 50% if the unit has no HP. This is computed as follows:

.. math::
f_\text{HP} =
\frac{1}{2} \left( 1 + \frac{\text{unit HP}}{\text{base HP}} \right)

The total bribe cost is then computed as:

.. math::
\text{final cost} = \text{base cost}
\times f_\text{effects} \times f_\text{power}
\times f_\text{MP} \times f_\text{HP}
Loading