[CF-Devel] Paralyze

Michael Toennies michael.toennies at nord-com.net
Wed Nov 21 08:10:34 CST 2001


Hi

I had changed the paralyzed effect on players some time ago.

Most effects work like this:

In the game, effect like blind or disease are objects insert in the
inventory
of the player or monster. This invisible object are applied to the inventory
and
invoke their effect. Non permanent effects has a ticker inside. Runs this
ticker out,
the object get destroyed and the creatures is free from the effect. Blind
works so.

Paralyze wasn't included like this.
It had worked like this:

I noticed, thats paralyze has no effect flag. Means, if you get paralyzed
through the spell
or effect, you got not marked as paralyzed. As i look in the code, i see
that the effect was
triggered only by setting the speed value of the object. Means the "you has
no speed left"
counter is set up by a high value. Thats very bad, because every speed
effect like encumberence
or land tile effects use this value too.

That makes it impossible to remove paralyze - thats the reason why there is
no "remove paralyze"
in the game - the server never knows why the speed is decreased . It can be
paralyze but also a
different effect.

Ok, in a first step, i added a FLAG_PARALYZE. Now, every time you stand
under the effect, you has
so long the FLAG_PARALYZE until you can move again.

That have a positive effect - the server knows now that you are paralyzed -
it can be shown and we
can include a remove paralyze spell.

Bad effect is, that i don't change it so much, that we use a paralyze_force
object. Because the
paralyze effect still use the speed value adding, you can't heal paralyze by
yourself - the server
never allows your object any action until your speed is set - even animation
and internal stuffs of
your player object are stopped! So be careful to insert new features using
values in a object.

Also, i find some strange stuff in the paralyze function.
Anyone knows why and how this is inside?

Michael


void paralyze_player(object *op, object *hitter, int dam)
{
    float effect,max;
    /* object *tmp; */

    /* This is strange stuff... someone knows for what this is
     * written? Well, i think this can and should be removed
    */

    /*
    if((tmp=present(PARAIMAGE,op->map,op->x,op->y))==NULL) {
	tmp=clone_arch(PARAIMAGE);
	tmp->x=op->x,tmp->y=op->y;
	insert_ob_in_map(tmp,op->map,tmp,INS_NO_MERGE | INS_NO_WALK_ON);
    }
    */

    /* Do this as a float - otherwise, rounding might very well reduce this
to 0 */
    effect = (float)dam * 3.0 * (100.0 - op->resist[ATNR_PARALYZE]) / 100;

    if (effect==0) return;

    SET_FLAG(op,FLAG_PARALYZED); /* we mark this object as paralyzed */
    animate_object(op); /* set the right animation for paralyze when needed
*/

    op->speed_left-=FABS(op->speed)*effect;
    /* tmp->stats.food+=(signed short) effect/op->speed; */

    /* max number of ticks to be affected for. */
    max = (100 - op->resist[ATNR_PARALYZE])/ 2;
    if (op->speed_left< -(FABS(op->speed)*max))
        op->speed_left  = (float) -(FABS(op->speed)*max);

/*      tmp->stats.food = (signed short) (max/FABS(op->speed)); */
}



    
    


More information about the crossfire mailing list