Files
HeroesStone_PRC8/_module/nss/07_randommagdam.nss
Jaysyn904 1eefc84201 Initial Commit
Initial Commit.
2025-09-14 15:40:46 -04:00

40 lines
1.3 KiB
Plaintext

//::///////////////////////////////////////////////
//:: 07_randommagdam
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
OnActionTaken handler for delivering a random amount of dammage
for failing to activate the Flux Point (see below)
*/
//:://////////////////////////////////////////////
//:: Created By: ruelk
//:: Created On: 2/21/04
//:://////////////////////////////////////////////
void main()
{
object oPC = GetPCSpeaker();
//this integer is the percent chance that the PC will
//experience the magical backlash. The chance is
//equal to 50 - Spellcraft skill level
int nChance = 50 - GetSkillRank(SKILL_SPELLCRAFT,oPC);
if (d100()<=nChance)
{//The PC failed and did something to cause a backlash
//The damage is based on the PC's level. One d4 per level.
//Basically the better you are the more your mistake is going to cost you
effect eEffect = EffectDamage(d4(GetHitDice(oPC)), DAMAGE_TYPE_MAGICAL, DAMAGE_POWER_ENERGY);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oPC);
//We apply a visual to look like raw magic is hitting the PC
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_DISPEL_GREATER), GetLocation(oPC));
//Tell the PC what just happened
SendMessageToPC(oPC, "Your failure has triggered a magical backlash.");
}
}