Combat
A player fights an NPC with its fists, as ModernUO’s classic (pre-AOS) combat does; the NPC fights back and dies when its hit points are gone. Weapons and armor of items are built; parry and the combat events of Lua are not.
Starting a fight
Section titled “Starting a fight”A player clicks a mobile, which sends the attack request (0x05), or a script calls
combat.attack(attacker, target). The fight starts when:
- both are in the world, on the same map, and the target is not the attacker, is alive and is not invulnerable
(
notoriety = "invulnerable"); - the target is not hidden from the attacker, is within the view range (
ultima.world.view_range) and in line of sight.
A player goes into war mode and is told whom it fights (0xAA). A refused request is answered with a clear
target (0xAA with zero), so the client does not keep the target highlighted.
The vendors (every template that inherits basevendor), the bankers and the guards are invulnerable, with a
yellow name, as in ModernUO: they cannot be attacked. Monsters and animals are grey or red, not blue.
A player who attacks an innocent (a blue name) that is not already fighting it becomes a criminal, and the guards come. Attacking anyone else, a monster, a criminal or one that is fighting the player, is no crime.
Peace (war mode off) ends the fight of a player. Any fight ends when the target leaves the world, dies or goes to
another map, after combatant_seconds (60) without a swing, or by combat.stop.
The swing
Section titled “The swing”Every tenth of a second a fighter whose delay is over, and whose target is within max_range tiles (1) and
15 units of height, swings. The first swing is at once; the delay after each is
15000 / ((stamina + 100) * speed) / global_attack_speed seconds, speed 30 for fistsso 2.5 seconds at 100 stamina. A swing:
- shows a hidden attacker;
- costs a player
attack_staminastamina (0 by default; UOX3 takes 2); - is told to its player (
0x2F) and plays the swing animation of the body (the punch of a human, the first attack of a monster or an animal); - rolls the hit with the Wrestling of both,
(attacker + 50) / ((defender + 50) * 2), which also teaches the Wrestling of a player; - on a miss plays the miss sound (
0x239) and no more; - on a hit plays the hit sound (the
attacksound of the template of an NPC, else the fists’0x135) and thehurtsound of the target, plays its hurt animation and does the damage.
The damage
Section titled “The damage”- The base is the weapon a player holds (a number from its
damage_minto itsdamage_max), the dice of the template of an NPC (damage), or 1 to 8 for fists. - Raised by the attacker’s tactics (
+ (tactics - 50)%), strength and anatomy (strength/5%,anatomy/5%, and 10% more at anatomy 100). Tactics and anatomy are tried at every hit and teach a player. An axe is raised the same way by Lumberjacking (lumberjacking/5%, and 10% more at 100), which a blow does not try. - Halved when the target is a player or the attacker is an NPC; a player hitting an NPC does all of it.
npc_damage_ratedivides what an NPC does to a player. - The armor takes its share off. A player is hit on a part of the body, chosen as ModernUO chooses it (neck 7%,
hands 7%, arms 14%, head 15%, legs 22%, chest 35%), and the piece it wears there takes half to all of its
armor_ratingoff; a part with no armor takes nothing. An NPC has one number, theArmorof its template, and a zone’s share of it, from half to all, is taken. At least 1 is done. - The shield blocks first, as the classic pre-AOS rule: a player that wears one (the thing of the two-handed layer
that is no weapon, by its
armor_rating) rolls its Parry behind a chance of (Parry points − the shield’s rating × 2) / 100, never less than 1%; a passed roll takes the rating’s half off a blow, its whole off an arrow, and shows the sparkle0x37B9; a failed one takes nothing. The roll trains Parry, and no shield means no roll at all. - The damage is shown over the target to the players in the fight (
0x0B,display_damage_numbers) and the health bar moves. - A hit that does damage leaves blood on the ground: a piece under the one hit and from one to
blood_piecesaround it, within a tile, one of the seven graphics of ModernUO’s blood (0x1645,0x122Ato0x122F), in the hue of the creature. They are ground items of theblood_splash_*templates and go afterblood_seconds(5), as ModernUO’s and Source-X’s; the ground items are checked every 5 seconds, so a piece can last that much longer. A creature whose template saysblood_hue = -1does not bleed: the undead and the golems. A player bleeds red. Fists, swords and arrows bleed alike; there is no blood from a spell, yet. Blood is for show: it gives way when the pool of reserved item serials runs short, so the loot and the split stacks keep theirs, and a piece never lies off the map.
The status window of a player shows the damage of its fists, 1 to 8 with the same bonuses of tactics, strength and
anatomy (the least is never under 1), and of Lumberjacking for an axe; the status of an NPC shows none.
A mobile with no hit points left dies as when a game master kills it, with the attacker as its killer and its corpse: an NPC leaves the world, a player stays as a ghost. A ghost does not fight, and nobody fights it.
The NPC fights back
Section titled “The NPC fights back”An NPC that is hit, or missed, and fights no one, fights the one who swings, at its own pace. One that fights
another turns on a new aggressor that is closer than its target (the classic rule) and not hidden from it, and keeps its
swing delay: the change gives no free swing. A hidden one, or one farther away, changes nothing; a target that is dead,
gone, on another map or run out is replaced at once; and a player never turns by itself. A tamed creature or a summon keeps
the target it was commanded, whoever hits it. An NPC with the prop combat.passive set to true
never answers a blow, and nor does one with the prop combat.flees, which a script sets for good: creature.lua sets
it for the animals of scared_animal.lua, which run instead, and any script made with the flees option does the same,
unless the creature is tamed, which fights when hit. The combat service knows no script id. A creature that fights runs when its hit points fall under its flee_at percent (20 for a
monster, 10 for an animal unless the template says; -1 never), see creature.lua.
A script also hears on_health_low, once, when the hit points fall under the template’s low_health_at (25 percent
unless it says), and on_mana_low: see Mobile scripts. They are hooks and leave flee_at as it is.
The archerguard template is a town guard that shoots. A player that is hit does not fight back by itself: it clicks. The monsters of
monster.lua go for a player and, beside it, combat.attack it.
Aggressor lists
Section titled “Aggressor lists”Every harmful act, a blow, a spell, the act of poisoning, notes who did it to whom, for players and NPCs, for two minutes
([ultima.murder] aggressor_seconds). The lists are in memory: a restart forgets them.
-
A player is a criminal for an attack on an innocent only when the innocent did not act against it and it did not act against the innocent before. Answering a spell, or coming back to a fight after another target, is no crime.
-
A victim that dies is asked to report those that attacked it as criminals: see Murder counts.
-
A script reads them with
mobile.aggressors(serial)andmobile.aggressed(serial). -
An innocent that a player fought, or that fought it, is grey to that player for as long as the entry lives (and the player is grey to it); a third player still sees it blue. A criminal, a murderer, a guild colour or an invulnerable keeps its own. The names are drawn again when an entry is born and within five seconds of its end.
-
The corpse of a player keeps who it fought; they may loot it with no new crime (see Murder counts).
The guards read the criminal flag, not the lists. The damage each player dealt is kept apart, for the right to loot a creature’s corpse (Death); a party or guild that may loot is not built yet.
Settings
Section titled “Settings”[ultima.combat], see Server configuration: global_attack_speed, attack_stamina,
npc_damage_rate, max_range, combatant_seconds, display_damage_numbers, blood_enabled, blood_pieces,
blood_seconds and item_wear_enabled.
The combat module: combat.attack(attacker, target), combat.stop(mobile), combat.target(mobile) and
combat.range(mobile); combat.armor_rating(mobile) (the armor rating of what it wears, as the status shows it; 0 for none); and, for what practices on a dummy or a butte, combat.weapon(mobile) (the skill, whether it is
a bow, its range, its projectile and ammunition), combat.swing(mobile, x, y) (turns and plays the swing, no fight)
and combat.spend_ammo(mobile) (takes an arrow or a bolt).
Weapons and armor
Section titled “Weapons and armor”What a player holds in its hands is read from the templates of the items on the one-handed and two-handed layers: the
first with a damage_max is the weapon. It gives the swing speed, the damage, the skill of the hit chance
(swordsmanship for a sword, an axe or a pole arm, mace fighting for a mace or a staff, fencing for a spear or a dagger) and
the sounds and the swing of its kind:
| Kind | Hit, miss | Swing (one hand, two hands) |
|---|---|---|
sword |
0x23B, 0x23A |
slash (9, 13) |
axe |
0x232, 0x23A |
slash (9, 13) |
pole_arm |
0x237, 0x238 |
slash (13) |
mace |
0x233, 0x239 |
bash (11, 12) |
staff |
0x233, 0x239 |
bash (11, 12) |
fencing |
0x23B, 0x238 |
pierce (10, 14) |
A weapon with no kind, which UOX3 does not list, is fought with Wrestling and sounds as fists. The defender’s hit skill is the one of its own weapon, Wrestling when it holds none. A bow, a crossbow and a thrown weapon are read and not fought with yet: such a player fights with its fists. An NPC fights with its template, whatever it wears.
A crafted item’s quality counts: an exceptional weapon does 20% more damage and a low one 20% less, added to the bonuses above; an exceptional piece of armor gives 8 more armor and a low one 8 less, never below 0; a shield’s rating too counts its quality. See Blacksmithing.
The tooltip of a weapon shows its base damage and speed, as its template says them (damage_min to damage_max and
the raw speed), not the final damage of a hit with its wielder’s bonuses and its quality; a piece of armor shows its
armor rating with its quality, and a piece with a strength_required shows it (not enforced yet). See
Packets and handlers.
A rider swings with the actions of a mount (one hand, two hands, bow or crossbow) instead of the ones of a walker; see mounts.
The armor rating of the whole player, which the status window shows, is the armor of each part weighted by the share
of the blows it takes (rounded), and the damage shown there is the weapon’s, with the bonuses. The numbers are those of UOX3’s
eras, converted by moongate-convert uox (see Migrate from UOX3); a plain graphic inherits the LBR
numbers, ModernUO’s classic ones.
Archers
Section titled “Archers”An NPC that holds a bow or a crossbow shoots instead of fighting from beside its target, as ModernUO’s and
UOX3’s archers do. The range is the weapon’s: 10 cells for a bow, 8 for a crossbow. It must see its target: with no
line of sight it keeps the fight but does not shoot, and its creature script
walks it to where it does. Ranges are counted in squares, the larger of the two differences along X and Y, as the scripts and the line of sight count them: a diagonal neighbour is one cell away. The line of sight is from eye to eye. A shot is a swing like any other: the weapon’s speed and the NPC’s stamina give the delay,
the hit is rolled with the Archery skill against what the target defends with, the damage is the template’s dice
(not the bow’s), and the arrow 0x0F42, or the bolt 0x1BFE, flies from the shooter to the target, hit or missed.
A human body plays the shooting action of its weapon; a monster body plays its attack. The sound is the creature’s own
attack, else the bow’s, 0x234 on a hit and 0x238 on a miss. An NPC’s ammo is never counted, and it need not stand still.
A player holding a bow or a crossbow shoots the same way, with the damage of the weapon (a plain bow’s 8 to 41, which the status window shows), and with these differences, as ModernUO and UOX3 have them:
- Each shot spends one arrow (bow) or one bolt (crossbow), found in the backpack or in a bag in it. With none, nothing flies and the swing is lost: its delay is paid all the same, and no message is shown, as in ModernUO.
- Of the shots, hit or missed, 40 percent leave an arrow or a bolt on the ground at the target’s feet, to be picked up.
- The player must have stood still for a second: a step, not a turn, within
archery_stand_still_seconds([ultima.combat]) of the shot delays it. 0 asks for nothing. - The Archery skill is the one rolled, and the one that gains; a bow in the hands of the target is what it defends with.
Durability
Section titled “Durability”A weapon or a piece of armor a player wears wears out in a fight, as in ModernUO, when its template has max_hits. A
piece has hits and maximum hits, kept as the props durability and max_durability of the item; a piece that has
never worn is whole.
- A hit of a player wears its weapon by 1, one time in 25. Fists do not wear.
- A blow that lands on a part with armor wears that piece, one time in 4: by 0 or 1, or by half of what the piece
absorbed (at least 1) when the attacker’s weapon is a mace. A staff or a crook (the
staffkind) wears armor by 0 or 1, as ModernUO’s staves do. - With no hits left, the rest of the wear comes off the maximum and the player reads “Your equipment is severely damaged.”; a piece with no maximum left is destroyed.
- The damage of a weapon and the armor rating of a piece go from 50% with no hits to 100% with all of them, and the status window follows.
- The tooltip shows
durability hits / maximum. item_wear_enabled = falsein[ultima.combat]turns the wear off; the pieces keep the hits they have.
NPCs do not wear: their armor and their damage are those of their template. A crafter mends a piece from the crafting gump.
Special moves
Section titled “Special moves”With special_moves = true the weapon carries its AOS special moves, see Weapon special moves.
Resistances
Section titled “Resistances”With resistances = true the damage has an element and the five resistances of the target lessen it, and a melee blow
uses the physical resistance instead of the roll of the armor, see Resistances.
Not yet
Section titled “Not yet”Parry of a weapon (only a shield blocks, as before AOS), a quiver (ammunition is taken from the backpack), the
strength a weapon or armor asks for (strength_required is kept, not used), the fame and karma shares of a kill,
and the combat events of Lua (attack, hit, miss,
get_hit).
See also
Section titled “See also”Made with ❤️ by Tom
