Please check out RetroMUD !

Member Discussions

terms



[Previous] [Next] [Post] [Reply] [Topics] [Summary] [Search]


1. Weird function workings Tue Dec 13, 2005 [11:11 AM]
Frax_TBW
Email not supplied
member since: Sep 24, 2005
Reply
I'm slowly going around making most class powers scale with the size of the character, and I have had no troubles with any other class so far, but when I got to the lich something odd started happening.

I have a requirement of 150k mana to start scaling up in power, but for some reason it only starts to scale suddenly at 310k (where it scales to the appropriate amount it should be at for 310k). Also, it is supposed to scale gradually, however the output does not change a single digit until reaching 470k, where it once again jumps suddenly.

I can't for the life of me figure out why this is going on.

Any help on the matter would be much appreciated.


if (ch->mana <2500)
{
send_to_char("You need 2500 mana.\n\r",ch);
return;
}

if (victim->position == POS_DEAD || ch->in_room != victim->in_room)
return;

count = 0;

for (i = 0; i<5 ; i++)
{
if (i==0)
{
sn = skill_lookup("purple sorcery");
dam = purple_magic;
if (ch->max_mana > 150000)
dam *= (ch->max_mana/150000);

}

if (i==1)
{
sn = skill_lookup("yellow sorcery");
dam = yellow_magic;
if (ch->max_mana > 150000)
dam *= (ch->max_mana/150000);
}

if (i==2)
{
sn = skill_lookup("green sorcery");
dam = green_magic;
if (ch->max_mana > 150000)
dam *= (ch->max_mana/150000);
}

if (i==3)
{
sn = skill_lookup("red sorcery");
dam=red_magic;
if (ch->max_mana > 150000)
dam *= (ch->max_mana/150000);
}

if (i==4)
{
sn = skill_lookup("blue sorcery");
dam=blue_magic;
if (ch->max_mana > 150000)
dam *= (ch->max_mana/150000);
}

if (is_affected(victim, sn))
continue;

count++;

af.type = sn;
af.duration = dam/4;
af.location = APPLY_HIT;
af.modifier = dam*2;
af.bitvector = 0;
affect_to_char(victim, &af);

af.type = sn;
af.duration = dam/4;
af.location = APPLY_AC;
af.modifier = -dam/2;
af.bitvector = 0;
affect_to_char(victim, &af);

af.type = sn;
af.duration = dam/4;
af.location = APPLY_MOVE;
af.modifier = dam*2;
af.bitvector = 0;
affect_to_char(victim, &af);

af.type = sn;
af.duration = dam/4;
af.location = APPLY_MANA;
af.modifier = dam*2;
af.bitvector = 0;
affect_to_char(victim, &af);

af.type = sn;
af.duration = dam/4;
af.location = APPLY_HITROLL;
af.modifier = dam/3;
af.bitvector = 0;
affect_to_char(victim, &af);

af.type = sn;
af.duration = dam/4;
af.location = APPLY_DAMROLL;
af.modifier = dam/3;
af.bitvector = 0;
affect_to_char(victim, &af);
}

ch->mana -= count * 500;
WAIT_STATE(ch,6);

sprintf(buf1, "You bless $N with the power of the elements.");
sprintf(buf2, "The power of the five elements fills your body.");
act(buf1, ch, NULL, victim, TO_CHAR);
act(buf2, ch, NULL, victim, TO_VICT);
return;

(Comment added by Frax_TBW on Tue Dec 13 13:12:34 2005)

Also, I'm working with a dystopia codebase, but I don't believe that has anything to do with this. I'm probably missing something pretty simple.

(Comment added by Frax_TBW on Tue Dec 13 14:05:48 2005)

I figured it out, needed to turn the integer into a double. =]




[Previous] [Next] [Post] [Reply] [Topics] [Summary] [Search]