[crossfire] Curse bug

Mark Wedel mwedel at sonic.net
Thu Nov 16 22:46:33 CST 2006


Nicolas Weeger (Laposte) wrote:
> Hello.
> 
> About the bug 
> https://sourceforge.net/tracker/index.php?func=detail&aid=1551398&group_id=13833&atid=113833 
> (curse breaks custom monsters), I suggest a hackish fix (which hopefully 
> wouldn't break anything):
> 
> when creating the curse itself (ie not recasting spell), store (using 
> key/values) the current ac/wc/path_[repelled|denied]. Do *not* call 
> fix_player, as that breaks custom monster (set FLAG_NO_FIX_PLAYER before 
> calling insert_ob_in_ob).
> 
> Then when the force expires, just restore original values. This means force 
> has to be identified as a "curse", of course.

  that seems like a reasonable idea.  I wonder if a new flag like 'original stat 
values stored away' should be added for a couple reasons:

1) When curse (or other spell) ends, it would easily know it should retrieve 
those values from the key/value list.

2) If another curse spell is cast while already under the effects of one (or 
other similar type of spell), it can quickly know that the original values have 
aleadry been stored away, so don't store the current values.

  I'll add that there has been a longstanding bug related to custom monsters and 
applying equipment (they would lose their customizations when they do so) - the 
solution has been to just make it so those monsters won't apply anything.

  This change could also be used to fix that - store away the original values in 
that case.

  I wonder if to simplify things, it would actually be easier to modify 
fix_player to look and see if there are customized values - it could be 
something like:

  if (has_customized_values) {
    str = get_key_value(orig_str)
    int = get_key_value(org_int)
  } else {
    str = op->clone.Str;
    int = op->clone.Int
  }
  ...
  op->Str = str;
  op->Int = int;

  and so on.  The only harder part in this case is figure out how/when to store 
away those original values.  It could make most sense to just do after the 
object is loaded from the original map.




More information about the crossfire mailing list