[CF-Devel] attack patch (list was down, i resend this)

Michael Toennies michael.toennies at nord-com.net
Mon Nov 26 19:38:55 CST 2001


Hi

As i talked about, i had done the bug fixing and changing in the attack
routines.

Because this code depends in several ways from other code parts,
every single change invokes more changes in other modules.

Also, i found several bugs & strange things in this way.

Aside some "code lifting" (removing redundant code and so on)
i fix some bugs, change some basic game and add 3 neu arch commands.

History:

I started this, because i find out that the STAND_STILL cmd not works
as it should. It seems that it was not implemented right. Also, there
was some strange things in the way, friendly object was handled.

So don't fight a friendly object back when it was attacked by an monster and
the player don't fight the same monster.

In the time i fixed this, i found some more bugs. Here a short list of what
is new:

New arch cmds
-------------
NEUTRAL <bool>               Object is neutral. It will not attack others
and will not be attacked
NO_ATTACK <bool>             Object NEVER attacks in any way!
NO_DAMAGE <bool>             Object NEVER can be damaged (and never dies).

With this 3 commands, we can make real NPC. The neutral cmd is only for make
the stuff round.

Throwing
--------
The throw code/part of CF is a sad thing. Player never use it and the code
was somewhat broken and
senseless. I changed this: Monster now never throw any item without
IS_THROWN is set. So, they don't
throw money or special objects anymore. This makes throw tougher! Be
careful.

Also, there was a major bug: about 50% of all throw or missile action, the
monster step in his missile
or hit herself. Then the monster was his own enemy and it started to kill
herself. Thats the reason why
some major monsters are killing herself after some time.

Because we run in heavy intern engine problems to sync a monster with his
missile, i changed it so,
that a owner never can be hit from his own missile. Also, a object can't be
his own enemy anymore.

This has some inpact on game play.
TODO: if a missile was reflected, i will include a flag and then a owner can
be hit again from the
missile but will not marked as own enemy.

To avoid any discussion about this: If someone don't like this, he is free
to code some more clever
solution. But be warned, this is a major project and will change alot of the
core code. My solution
will maybe not perfect, but i counter a real senseless problem (you fire a
arrow and then you make a
fast step that you will be hit from it?) with a small one.

This bugfix makes throwing much more sensefull and dangerous. Also, we
remove the suicide problem with
it.

Pushing
-------

Pushing was broken too. It only asks for unaggressive monsters. Make a
object friendly 1 and unaggressive 1
and you was be able to attack it - very senseless and that was the reason
why the NPC system makes so
much problems (they start to attack you).

I changed it so:
- you never can push a stand_still monster (you got a message about it)
- you can't attack friendly or neutral monsters with pushing anymore
- if you MOVE in a evil, unaggressive monster, you push it
- if you RUN in a evil, unaggressive monster, you attack it

Sleep
-----

Because the problems above, some guy start to insert a SLEEP 1 in every
monster arch. This avoid
senseless moving (stand_still broken) or senseless attack (hitting
yourself).

Of course, its senseless to make all monster sleeping as default.
Pets having a problem when starting sleeping (code will remove it).

I had insert a warning message in the arch paser when a arch still has sleep
1 as default.
If you want make a object sleeping, this should include in the map.

Please remove all SLEEP 1 from monsters.

Notice, that it will make later a big difference, that a monster sleeps or
not.
The advanced mapcmd/client will draw sleep sign above sleeping monsters and
skills/spells
like invinsible,stealth or hiding will make use of it.

I had fixed several problems with "not awakening monsters". Sometimes they
got hit to death and don't
awake.


Attackers & friendly object
---------------------------
As part of the way CF was coded, friendly monsters don't attack non friendly
monsters. There was a small
hack, that they maybe attack the enemy of a player. But in many ways, a evil
monster start to kill the
friendly one, and the friendly one can't attack back.

Now, every time a monster attacks another, it marks itself inside the others
as attacker.
The attacked monster then use this ptr if it has no valid enemy to attack
back.

Now, you can make a map, where royal guards guard a entry and attack the
incoming monsters.
Also, if you throw a fireball at a friendly object, the object attacks short
back!

I avoided fights between objects of same kind. Non friendly objects don't
attack non friendly objects,
and friendly not friendly. Thats needed, because when this is not set, every
spell from a monster will hit
many others and then all start to fight against the others.

Look at this code to check it out:
        enemy->attacked_by = op;       /* our ptr */
        enemy->attacked_by_count = op->count; /* our tag */

Misc fixes
----------
- Monsters now cast spells again on objects next to them (find_player_path()
was return a 0 if
  object was in direct space to attacker)
- alot i can't remember or simply get fixed as side effect :)

Well, this are alot changes.
I need some serious testing now.
As i tested it out, all works fine.
But report me any "strange" action you notice.
And be careful - it should be harder now!

Michael


    
    


More information about the crossfire mailing list