[crossfire] Discrete damage type

Mark Wedel mwedel at sonic.net
Sun Apr 22 00:32:44 CDT 2007


Nicolas Weeger wrote:
> Hello.
> 
> I just committed to SVN trunk changes that enable weapons to have discrete 
> damage for each attack type.
> 
> It works quite simply:
> * new object fields 'damage_<attacktype>', so 'damage_fire' and so, like 
> the 'dam' field in living structure
> * if at least one field is set, 'dam' is ignored for attack, and the discrete 
> values are used instead

  Random question to everyone at a whole - should the old 'dam' field go away at 
some point, that is to say, everything should use the discrete damage?

  This would require map & archetype updates, but that could all be automated - 
if attacktype is set for say AT_FIRE and AT_PHYSICAL, and dam is 10, then script 
would just remove that and add damage_fire 10 and damage_physical 10.

  It also means that attacktype basically goes away - instead, that information 
is conveyed in the discrete damage fields.

  Which leads to an interesting question right now:  If I set up the discrete 
damage values for an item, but don't update the attacktype to include those 
attacks, what happens?  I can think of 1 of 2 things:

1) Attacktype is ignored - if the discrete damage is set, that is used no matter 
what (meaning that attacktype basically could go away if everything was updated)
2) The discrete damage isn't used, since the attacktype isn't set.

  If #2, should probably be documented someplace.

> 
> 
> Implementation details, issues to check/fix:
> * the discrete damage are stored in a 'discrete_damage' array allocated only 
> if one value is set in archetype definition

  Are things smart enough to handle the case where I modify an archetype on the 
map to included a discrete damage type?  For example, suppose I take the 
standard longsword, which just has a standard dam value, but want to make a 
specialized weapon - something that still does mostly physical, but a little bit 
of fire, so I use the discrete damage values to do that.

  Will that work?  IMO, it should, because that is a pretty likely scenario, and 
from a map maker perspective, I shouldn't have to know the internals of how 
things work - I should be able to set up discrete damage types and just have it 
work.

> * i only changed hit_player_attacktype to handle this discrete damage. It is 
> used by many things, including spells attacks, i think.
> * i know some parts (specially spell attacks) alter dam based on casting spell 
> level. Thus that code should be changed to modify discrete_damage instead - 
> shouldn't be too hard

  Don't know if done, but I'd also suggest that things like examine object 
should dump that information.




More information about the crossfire mailing list