wiki:NewEgos

Version 1 (modified by magnate, 7 years ago) (diff)

caution save

A Guide to Affixes

by magnate

Introduction

This work was based on some ideas vaguely expressed in http://angband-dev.blogspot.com/2011/09/so-what-exactly-is-ego-item-anyway.html

It started off with wanting to address some pet peeves with ego item generation (the hackish OBJECT_XTRA_TYPE_ defines, the rigid nature of the better ego types, etc.). It was also inspired by Eytan Zweig's item prefixes (#587), and grew from there. The basic idea is to allow for a greater variety of magical items and smoother progression from a dagger (1d4) (+0,+0) to a 6d5 Holy Avenger (and so on for other equipment).

What hasn't changed

All the old ego items are still generatable almost exactly as they used to look. Slay weapons, branded weapons, Defender/HA/Gondolin/Westernesse weapons, Elvenkind armours and boots, Robes of Permanence, etc.

What has changed

I say "almost" because there are two noticeable differences. Some of the high-end items will have all four IGNORE_ flags where they only used to have one or two (e.g. Gondolin). More significantly, most items will have lower to-hit/to-dam values than under the old system - though this can now be addressed purely through editing ego_item.txt and ego_themes.txt

Ah yes, themes. Let's get down to the code. The ego_item type still exists, and they're still stored in the global e_info[] array, but they're not called egos any more, they're called affixes (because you can have MAX_AFFIXES of them). There are some (IMO) useful changes to the type:

  • The C: line now takes seven parameters rather than three. As well as to_h/to_d/to_a, you can now modify base AC, weight, dice and sides. The first two of these are percentage mods (and are signed so can be negative), the last two are just extra dice and sides (but can also be negative). Full credit to Eytan Zweig for inspiring these.
  • The M: line is assumed to be NO_MINIMUM:NO_MINIMUM:NO_MINIMUM if it's absent. So no worries about accidentally removing armour penalties.
  • The X: line is gone. Rarity is no longer used, and random flags are now done by R: or R2: lines. R: lines specify flag types (sustains, high resists, etc.), while R2: lines allow specification of an exact flag mask. So if you want, you can have an affix that adds one of SUST_STR or SUST_CON but nothing else. You cannot add pval flags this way though - I wrote a spec for a Z: line to do this, but it is difficult to box around MAX_PVALS so I have left this for another day.
  • The T: line now deals with rarity as well as kind legality. For each tval/min-sval/max-sval group, you can specify an alloc_prob and a min and max depth. EGO_TVALS_MAX has been increased accordingly. So you can have the same affix appear with different likelihood and at different depths for different items. Acid-resistant shields can be much rarer (or less rare) than acid-resistant cloaks, for example.
  • The T: line also includes a "level" field, which specifies how good the affix is considered for this object group at these depths. So far I've defined four levels: "good", "great", "uber" and "artifact", but we could have more. The last is in case we want to have affixes only found on randarts. More on levels in a minute, but one point to note is that you can redefine the same object group here. So:

T:soft armour:0:99:great:10:1 to 25
T:soft armour:0:99:good:25:26 to 100

would mean that this affix is considered "great" at low levels but merely "good" at deeper depths - for soft armour.

Ok, so those are affixes. I stripped out all the "compound" egos, with multiple attributes, and boiled affixes right down, so that each only provides one or two things. Resist affixes still give the IGNORE_ flag, and the five x3 brands still give both RESIST_ and IGNORE_ flags, but otherwise most affixes only provide one flag. I've added the EyAngband? prefixes, which modify the base properties of armour and weapons (AC, hit/dam, dice/sides) - I left out only the inappropriate race-specific ones (Ey has lots of weird races), and guesstimated on some.