Here is the code for the boost spells I (badly) wrote. Critiques welcome.
A brief summary:
divine favor = 2x exp
divine rage = 2x damage
divine valor = 2x qp
divine spirit = 2x pneuma
I personally don't like these names much and I'd rather see them changed before implementation, same goes for the echoes. They are placeholders, nothing more.
[b]merc.h[/b]
[code]
#define MAX_SKILL 256
#define AFF2_DIVINE_FAVOR (V)
#define AFF2_DIVINE_RAGE (W)
#define AFF2_DIVINE_VALOR (X)
#define AFF2_DIVINE_SPIRIT (Y)
[/code]
[b]magic.c[/b]
[code]
void spell_divine_favor(int sn, int level, CHAR_DATA *ch, void *vo, int target)
{
CHAR_DATA *victim;
AFFECT_DATA af;
bool perm = FALSE;
if (level > 9000) // Is an obj
{
level -= 9000;
perm = TRUE;
}
if ((IS_NPC(ch)) || (ch->tot_level < MAX_LEVEL))
{
send_to_char("Only IMPs can cast this spell.\n\r",ch);
return;
}
/* character target */
victim = (CHAR_DATA *) vo;
if (perm == TRUE && is_affected(victim, sn))
{
affect_strip(victim, sn);
}
else
if (IS_AFFECTED2(victim, AFF2_DIVINE_FAVOR))
{
if (victim == ch)
send_to_char("You are already favored by the gods.\n\r",ch);
else
act("$N is already favored by the gods.",ch,NULL,victim,TO_CHAR);
return;
}
af.where = TO_AFFECTS;
af.type = sn;
af.level = level;
if (perm)
af.duration = -1;
else
af.duration = level/10;
af.location = APPLY_NONE;
af.modifier = 0;
af.bitvector = 0;
af.bitvector2 = AFF2_DIVINE_FAVOR;
affect_to_char(victim, &af);
send_to_char("You begin to glow with a radiant white aura.\n\r", victim);
act("$n glows with a radiant white aura.", victim, NULL, NULL, TO_ROOM);
}
void spell_divine_rage(int sn, int level, CHAR_DATA *ch, void *vo, int target)
{
CHAR_DATA *victim;
AFFECT_DATA af;
bool perm = FALSE;
if (level > 9000) // Is an obj
{
level -= 9000;
perm = TRUE;
}
if ((IS_NPC(ch)) || (ch->tot_level < MAX_LEVEL))
{
send_to_char("Only IMPs can cast this spell.\n\r",ch);
return;
}
/* character target */
victim = (CHAR_DATA *) vo;
if (perm == TRUE && is_affected(victim, sn))
{
affect_strip(victim, sn);
}
else
if (IS_AFFECTED2(victim, AFF2_DIVINE_RAGE))
{
if (victim == ch)
send_to_char("You are already favored by the gods.\n\r",ch);
else
act("$N is already favored by the gods.",ch,NULL,victim,TO_CHAR);
return;
}
af.where = TO_AFFECTS;
af.type = sn;
af.level = level;
if (perm)
af.duration = -1;
else
af.duration = level/10;
af.location = APPLY_NONE;
af.modifier = 0;
af.bitvector = 0;
af.bitvector2 = AFF2_DIVINE_RAGE;
affect_to_char(victim, &af);
send_to_char("You begin to glow with a fiery red aura.\n\r", victim);
act("$n glows with a fiery red aura.", victim, NULL, NULL, TO_ROOM);
}
void spell_divine_valor(int sn, int level, CHAR_DATA *ch, void *vo, int target)
{
CHAR_DATA *victim;
AFFECT_DATA af;
bool perm = FALSE;
if (level > 9000) // Is an obj
{
level -= 9000;
perm = TRUE;
}
if ((IS_NPC(ch)) || (ch->tot_level < MAX_LEVEL))
{
send_to_char("Only IMPs can cast this spell.\n\r",ch);
return;
}
/* character target */
victim = (CHAR_DATA *) vo;
if (perm == TRUE && is_affected(victim, sn))
{
affect_strip(victim, sn);
}
else
if (IS_AFFECTED2(victim, AFF2_DIVINE_VALOR))
{
if (victim == ch)
send_to_char("You are already favored by the gods.\n\r",ch);
else
act("$N is already favored by the gods.",ch,NULL,victim,TO_CHAR);
return;
}
af.where = TO_AFFECTS;
af.type = sn;
af.level = level;
if (perm)
af.duration = -1;
else
af.duration = 2;
af.location = APPLY_NONE;
af.modifier = 0;
af.bitvector = 0;
af.bitvector2 = AFF2_DIVINE_VALOR;
affect_to_char(victim, &af);
send_to_char("You begin to glow with a powerful gold aura.\n\r", victim);
act("$n glows with a powerful gold aura.", victim, NULL, NULL, TO_ROOM);
}
void spell_divine_spirit(int sn, int level, CHAR_DATA *ch, void *vo, int target)
{
CHAR_DATA *victim;
AFFECT_DATA af;
bool perm = FALSE;
if (level > 9000) // Is an obj
{
level -= 9000;
perm = TRUE;
}
if ((IS_NPC(ch)) || (ch->tot_level < MAX_LEVEL))
{
send_to_char("Only IMPs can cast this spell.\n\r",ch);
return;
}
/* character target */
victim = (CHAR_DATA *) vo;
if (perm == TRUE && is_affected(victim, sn))
{
affect_strip(victim, sn);
}
else
if (IS_AFFECTED2(victim, AFF2_DIVINE_SPIRIT))
{
if (victim == ch)
send_to_char("You are already favored by the gods.\n\r",ch);
else
act("$N is already favored by the gods.",ch,NULL,victim,TO_CHAR);
return;
}
af.where = TO_AFFECTS;
af.type = sn;
af.level = level;
if (perm)
af.duration = -1;
else
af.duration = 2;
af.location = APPLY_NONE;
af.modifier = 0;
af.bitvector = 0;
af.bitvector2 = AFF2_DIVINE_SPIRIT;
affect_to_char(victim, &af);
send_to_char("You begin to glow with a pulsing blue aura.\n\r", victim);
act("$n glows with a pulsing blue aura.", victim, NULL, NULL, TO_ROOM);
}
[/code]
[b]magic.h[/b]
[code]
DECLARE_SPELL_FUN( spell_divine_spirit );
DECLARE_SPELL_FUN( spell_divine_valor );
DECLARE_SPELL_FUN( spell_divine_rage );
DECLARE_SPELL_FUN( spell_divine_favor );
[/code]
[b]bit.c (as affect2)[/b]
[code]
if ( vector & AFF2_DIVINE_FAVOR ) strcat( buf, " divine_favor" );
if ( vector & AFF2_DIVINE_RAGE ) strcat( buf, " divine_rage" );
if ( vector & AFF2_DIVINE_SPIRIT ) strcat( buf, " divine_spirit" );
if ( vector & AFF2_DIVINE_VALOR ) strcat( buf, " divine_valor" );
[/code]
[b]const.c[/b]
[code]
"divine favor", { 31, 31, 31, 31 }, { 10, 10, 10, 10},
spell_divine_favor, TAR_CHAR_DEFENSIVE, POS_STANDING,
NULL, SLOT(100), 100, 4,
"", "The radiant white aura surrounding you fades.", ""
},
{
"divine rage", { 31, 31, 31, 31 }, { 10, 10, 10, 10},
spell_divine_rage, TAR_CHAR_DEFENSIVE, POS_STANDING,
NULL, SLOT(101), 100, 4,
"", "The fiery red aura surrounding you fades.", ""
},
{
"divine spirit", { 31, 31, 31, 31 }, { 10, 10, 10, 10},
spell_divine_spirit, TAR_CHAR_DEFENSIVE, POS_STANDING,
NULL, SLOT(102), 100, 4,
"", "The pulsing blue aura surrounding you fades.", ""
},
{
"divine valor", { 31, 31, 31, 31 }, { 10, 10, 10, 10},
spell_divine_valor, TAR_CHAR_DEFENSIVE, POS_STANDING,
NULL, SLOT(103), 100, 4,
"", "The powerful gold aura surrounding you fades.", ""
},
[/code]
[b]act_obj2.c (immediately after the check for pneuma boost)[/b]
[code]
else
if ((IS_AFFECTED2(ch, AFF2_DIVINE_SPIRIT)) && (boost_table[BOOST_PNEUMA].boost == 100)) //Boost for divine spirit.
{
send_to_char("{WThe gods smile upon you and double your pneuma! {x\n\r", ch);
ch->pneuma += (i * 2);
}
[/code]
[b]fight.c (immediately after the check for damage boost)[/b]
[code]
// Damage boost for divine rage.
if ((IS_AFFECTED2(ch, AFF2_DIVINE_RAGE)) && (boost_table[BOOST_DAMAGE].boost == 100) && (IS_NPC(victim)))
dam = (dam * 2);
[/code]
[b]fight.c (immediately after the check for exp boost)[/b]
[code]
if (IS_AFFECTED2(ch, AFF2_DIVINE_FAVOR))
{
if (boost_table[BOOST_EXPERIENCE].boost != 100 || boost_table[BOOST_RECKONING].boost != 100)
{
sprintf(buf, "The favor of the gods cannot boost your experience any higher. \n\r");
send_to_char(buf, gch);
}
else
{
sprintf(buf, "{WThe favor of the gods doubles your experience! {x\n\r");
send_to_char(buf, gch);
xp = (xp * 2);
}
}
[/code]
[b]quest.c (once again, after the check for qp boost)[/b]
[code]
// Boost for divine valor.
if ((IS_AFFECTED2(ch, AFF2_DIVINE_VALOR)) && (boost_table[BOOST_QP].boost == 100))
{
pointreward = (pointreward * 2);
}
sprintf(buf,
"As a reward, I am giving you %d quest points and %d silver.",
pointreward, reward);
do_say(mob,buf);
// Only display "QUEST POINTS boost!" if a qp boost is active -- Areo
if(boost_table[BOOST_QP].boost != 100)
send_to_char("{WQUEST POINTS boost!{x\n\r", ch);
// Echo for divine valor.
if ((IS_AFFECTED2(ch, AFF2_DIVINE_VALOR)) && (boost_table[BOOST_QP].boost == 100))
send_to_char("{WThe gods smile upon you and double your quest points! {x\n\r", ch);
[/code]