MyOtheHedgeFox wrote:I thought to try and implement
my idea of Gauntlets of Lightning into the Stone Soup code.
Basically, they give electrocution brand to UC attacks.
Whew, that's a difficult request as so far there's no instance of armour conferring weapon brands. The closest is probably the bracers' archery brand, so searching the code for SPARM_ARCHERY could give you some ideas where to start.
Still, to give you some pointers in the right direction (all files can be found in the source sub-directory):
1. look at
art-data.txt for artefact definitions in general (start out with the gloves conferring rElec or something)
2. you'll need to define a new artefact property for the elec brand: add a new property to
special_armour_type in
itemprop-enum.h3. call
player_equip_ego_type(ARM_GLOVES, <your new property>) in the
apply_damage_brand function in
melee_attack.cc under the
if (weapon) check to set
brand to SPWPN_ELECTROCUTION
Depending on whether the combat overhaul has already been merged into trunk, this information might not be accurate anymore. In general, it might be a good idea to put the weapon brand check on armour into a method of its own in case other such brands are added. Also, this ignores the case of auxiliary unarmed attacks both for the sake of simplicity and because I think that would make the artefact overpowered as it would in effect allow the player to use two weapon brands at the same time.
To add the discharge effect, you could either run another
player_equip_ego_type check at the end of the SPWPN_ELECTROCUTION case block or at the end of the entire switch-case block where the chaos brand is checked a second time. (In both cases, make sure that the player is not wielding a weapon!) Static discharge is defined in
cast_discharge in
spl-damage.cc but you might have to adjust the (currently static) method
_discharge_monsters instead if you want to directly target the attacked monster. Use
defender->pos to get its current position. If you only want this to apply if the monster hasn't been killed yet, check for
defender->alive.
You might also wish to add your new property to
describe.cc and
itemname.cc, though maybe that's only necessary if it's ever supposed to crop up randomly - otherwise, the artefact description (in the dat/ directory nowadays) might be enough.
Good luck!
Note that I'm not a developer anymore. The idea sounds cool but also really powerful. If it's considered overpowered, it's unlikely to make it into the game.