Game tutorial and rules - PatPL/mp-turn-based-game GitHub Wiki
Your goal is to destroy your enemy's base.
Game GUI
- Available upgrades - permanent base upgrades such as better per round income, or improved stats of new units
- Create unit - buy and place new units on the battlefield
- End turn - calculate this turn and wait until your enemy ends their turn.
Unit shop GUI
Choose a unit on the left, and then choose its lane. Upon purchase, the unit will appear on your selected base field. You can't choose an occupied field.
Unit stats
- Health - unit's health. Unit will die, once it reaches zero. Can be improved with a base upgrade
- Damage - unit's damage. Target's health will be lowered by that amount once attacked. Can be improved with a base upgrade
- Range - unit's range. Enemy can't be attacked, if it's further away than this.
- Speed - unit's speed. How many tiles per turn can this unit move.
- Cost - unit's cost.
Unit behavior, battle, and turn calculation
You receive your gold income right after ending your turn. you will not receive gold when your enemy is ending their turn.
Unit behavior
First, all units will attempt to attack the nearest enemy within their RANGE, starting from the ones closest to your base.
If the enemy happens to die after the first attack, next attacking unit will target the next enemy in line, if it's still in range
On attack, unit's target can perform a counterattack. Counterattack will happen if all conditions are met:
- Targeted unit has the attacker in range
- Targeted unit in not a ranged unit (RANGE = 1)
In short, counterattacks only happen if a melee unit is attacked at close range.
Counterattacks happen instantly. Two units at low health can kill each other in one turn.
Killing an enemy unit grants you 20 gold, regardless of how expensive that unit was. Same goes for your enemy though, so keep that in mind, and try to avoid spamming cheap units.
After the attacks, units will attempt to move forward, starting with the ones closest to the enemy base. A unit can move forward, if it didn't attack, or if it dealt a killing blow to its target during the attack phase. A unit will only move forward, if it doesn't have an enemy in range, and in case of units with (SPEED > 1), a unit will stop moving as soon, as an enemy gets in its range. The only exception to that rule is when a ranged unit kills an enemy while on a base field, it will move one field forward, even if it already has another enemy in range
Consider following scenario again.
There are 4 possible outcomes:
- 1, 2, 3 attack the blue unit. It survives. Red units don't move
- 1, 2 attack, 3 kills the blue unit. Only unit 3 moves
- 1 attacks, 2 kills the blue unit. Units 2, 3 move
- 1 attacks, and kills the blue unit. All red units move
Units on base fields are immune to damage. Instead, enemy units will attack the base directly. Units on base fields are also immune to counterattacks. In the following example, during blue's turn, blue can attack the red unit with impunity, even though all of the counterattack conditions are met. Units attacking the base may still receive a counterattack. Even worse, ranged units on base fields can counterattack as well, and they deal double damage while doing so!