Source-first reverse engineering of a mainline Battle for Wesnoth campaign
22 — The Rise of Wesnoth
The final battle: Aethyr must die by Jevyan’s hand, Jevyan must then be destroyed, and exactly one orc leader must survive to carry the forged Ruby treaty back to the Green Isle.
Jevyan is destroyed after reading the forged treaty.
Jevyan dies while Aethyr is still alive.
All enemy leaders except one orc are defeated.
Two or more orc leaders remain when Jevyan falls, or every orc leader is killed.
The last orc escapes with the false belief that the elves possess the Ruby.
No witness survives to carry the deception back to the Green Isle.
Final-scenario inversion. The player must control the order and authorship of deaths, not simply maximize kills. Overperforming tactically can invalidate the strategic objective.
Map description
The 52 × 47 map is the campaign’s largest final battlefield. It mixes broad inland plains and forests with marshes, mountains, several island and coastal keeps, shallow and deep water, three destructible bridge systems, and seven staged galleons. Haldric begins in the northeastern interior; Jevyan holds the southeastern sea-castle region near 42,40. Four orc leaders occupy maritime, coastal, island, and northern positions.
Map system
Design role
Six hostile leaders
Jevyan plus four orc witnesses and one additional sea-castle orc force.
Four escape-boat routes
The surviving orc’s side selects a different extraction animation.
Three bridges
Cuttle Fish may destroy them according to player proximity.
Swamps around Jevyan
Provide random corpse-spawn terrain.
Shallow water beside deep water
Provides legal skeleton arrival points from the sea.
Sides and difficulty scaling
Side
Leader / roster
Gold / income
AI role
1 — Refugees
Haldric and full surviving party
350 / 300 / 250
Human controlled; 8 / 6 / 4 villages
2 — Jevyan
Jevyan Cloaked → Jevyan; broad undead roster
160 / 200 / 240; income 8 / 12 / 16
Passive leader protecting 42,40; more aggressive at night
3 — Sea castle
Tan-Vragish, Orcish Warlord; Naga and bats
100 / 125 / 150; income 3 / 5 / 7
Night-aggressive maritime force
4 — Coast orcs
Ut’Tan-Grorag, Orcish Warlord
150 / 180 / 210; income 4 / 8 / 12
Defensive grouping by day, offensive at night
5 — Island orcs
Tan-Erinak, Orcish Warlord
150 / 180 / 210; income 3 / 5 / 7
Difficulty-expanded orc, goblin, and Troll roster
6 — North orcs
Tan-Prodash, Orcish Warlord
150 / 180 / 210; income 3 / 5 / 7
Night aggression 0.75, zero caution, no grouping
Commander Aethyr as a carried objective
prestart recalls Aethyr and attaches misc/treaty-icon.png as a unit overlay. The icon turns the forged document into a visible objective carried by an ordinary persistent unit.
Aethyr event
Result
Attacks Jevyan
Dialogue reinforces that he is deliberately presenting himself as the treaty carrier.
Attacked by any enemy
Jessene warns him to be careful.
Last breath to a non-Jevyan killer
Immediate defeat because the treaty will not convince Jevyan.
Last breath to Jevyan
Aethyr completes his sacrifice.
Death to Jevyan
Jevyan discovers and reads the elven-script treaty, accepting the deception.
Jevyan and the survivor-order logic
The opening upgrades Jevyan Cloaked to the full Jevyan type.
If Jevyan dies while Aethyr remains alive, the scenario ends in defeat.
If Jevyan dies while at least two orc leaders remain, the orcs taunt the player and battle continues.
When only Jevyan and one orc remain, the dying next orc triggers retreat dialogue but does not yet end the level.
Once Jevyan is dead, Aethyr is dead, and exactly one orc remains, the survivor is stored, assigned a boat route, hidden, fake-moved to the coast, and carried away by a Transport Galleon.
If the final orc is killed, the scenario ends in defeat.
Side-specific escape routing
Surviving side
Leader
Boat staging
3
Tan-Vragish
5,38 → 1,38
4
Ut’Tan-Grorag
21,35 → 14,42
5
Tan-Erinak
38,27 → 12,27
6
Tan-Prodash
6,19 → 1,24
The survivor’s current type and coordinates are stored in last_orc_leader; escape_boat
Fallen allies rise again
Side-1 deaths, except Aethyr’s, invoke the campaign RISE_UP_RISE_UP macro when the killer does not already supply a corpse through its own plague behavior. The first allied death warns the player that Jevyan is raising the fallen.
Bridge-destruction director
At every new turn, each of three bridge systems is checked independently. A named Cuttle Fish appears and destroys the bridge when:
the bridge terrain still exists,
a player unit is within radius 8,
no player unit is within radius 2, and
no unit occupies the bridge itself.
Cuttle Fish
Bridge area
Terrain result
Squiddy
23,22–23
Shallow-water wreckage; ford-like on Easy
Inky
43,17–18
Shallow-water wreckage; ford-like on Easy
Beaky
42,30 and 41,31
Shallow-water wreckage; ford-like on Easy
The third event changes its dialogue depending on whether player units are north of the bridge: it can thwart an advance or a retreat.
Recurring undead ecology
System
Schedule
Spawn
Corpses
Anchor turns 2, 9, 16, 23, 30, 37, 44 choose a random later turn in the next five-turn window.
3 / 6 / 9 Walking Corpses on empty swamp within radius 14 of Jevyan’s castle.
Skeletons
Anchor turns 6, 16, 26, 36 choose a random later turn in the next four-turn window.
3 / 4 / 5 alternating Skeletons and Skeleton Archers in shallow water bordering deep water.
Both systems fire only while Jevyan remains alive. The random scheduling prevents the reinforcements from becoming completely predictable during an unlimited-turn battle.
Additional escalation
Trigger
Effect
Turn 10
Abraxas and Naga Fighters arrive; side 3 gains Naga Fighter recruitment.
Familiar dies while Jevyan lives
Jevyan gains 40 / 80 / 120 gold and immediately fires both corpse and skeleton spawn events.
Any orc leader dies
Jevyan gains 40 / 80 / 120 gold through JEVGOLD.
Lessons for campaign authors
Pattern
Reuse lesson
Require a particular killer
Use filter_second in last-breath and death events to distinguish valid sacrifice from failure.
Require one enemy survivor
Query living leaders after each death rather than relying on a normal defeat-all objective.
Turn a unit into a physical objective
An overlay can show carried story information without a custom unit type.
Destroy terrain conditionally
Proximity checks can alter routes only when the change will matter but is not instantly unfair.
Use randomized windows in unlimited scenarios
Recurring pressure remains uncertain without a fixed deadline.