Opened 11 years ago

Closed 11 years ago

#664 closed bug (fixed (in master))

refactor get_brand_mult() & pseudo-by-use in attack.c

Reported by: takkaria Owned by: magnate
Milestone: 3.1.1 beta Keywords: id
Cc:

Description

get_brand_mult() should be taking a flagset rather than an object. can then rework the pseudo-by-use stuff so it prints a "your ring flares!" or whatever message, to make the effect of the item obvious to the player, apart from the extra verb used.

Change History (11)

comment:1 Changed 11 years ago by takkaria

  • Keywords id added

comment:2 Changed 11 years ago by magnate

  • Owner set to magnate
  • Status changed from new to assigned

Brand multipliers are crying out to be abstracted into monster/constants.h (or wherever). They're called in attack.c, obj-desc.c, randart.c to name but three. I will try this.

comment:3 Changed 11 years ago by magnate

Ok, [5b543d3] (SVN r1285) starts this. There are five bits left to do:

  1. Sort out the slays cache in obj-power.c (it needs to reduce to cache only the slay combinations found in ego-item.txt, as slay combos on artifacts are almost never repeated)
  1. Sort out the slay counting in parse_frequencies() in randart.c
  1. Factor out the slays and brands in self_knowledge() in spells2.c and use the new array instead
  1. Re-do the flag_type arrays in obj-info.c to derive from the new array
  1. Rework the pseudo-by-use stuff, which was actually the point of this ticket ...

comment:4 Changed 11 years ago by magnate

Hmmm. [285c320] (SVN r1287) sorts out (2) above (and allows separate parsing of SLAY_ and KILL_ in future, if we want). I'm inclined to skip (3) and leave the horrible long list in self_knowledge(). If this was Python it would be easy, but creating a temporary char array of [N_ELEMENTS(slay_table)][SCREEN_WID] to store the info[i] strings for slays and brands is going to render the function unreadable. Anyone wanting to add an extra brand/slay is going to have to edit spells2.c as well as obj-info.c ...

Still planning on fixing (1) and (4) above, then working on (5).

comment:5 Changed 11 years ago by magnate

Oops. I forgot

  1. Refactor the add_brand and add_slay parts of randart.c to use the new array.

comment:6 Changed 11 years ago by magnate

[48e29e6] (SVN r1291) does (4) above, and finally enables us to distinguish between brands and slays with if (s_ptr->brand).

comment:7 Changed 11 years ago by magnate

(without using TR1_BRAND_MASK, I meant.)

[afc1d49] (SVN r1293) sorts out (6). Three down, three to go.

comment:8 Changed 11 years ago by magnate

I'm opening a new ticket for (1), because it's really nothing to do with this one. I'll close this ticket when (3) and (5) are done.

comment:9 Changed 11 years ago by anonymous

I think [fec456d] (SVN r1350) sorts out (5), which just leaves the self_knowledge() function. Takkaria did say it sounded like less work to remove it altogether than to rewrite it ...

comment:10 Changed 11 years ago by takkaria

[65a9167] (SVN r1355) closes this one, really, at last, though there may well be more tweaking to be done in future.

comment:11 Changed 11 years ago by magnate

  • Resolution set to fixed
  • Status changed from assigned to closed

Ok, closing because of [65a9167] (SVN r1355). I'll open a new ticket for self_knowledge()

Note: See TracTickets for help on using tickets.