HoS_PRC8/_mod/_module/nss/rts_it_mag51.nss
Jaysyn904 04165202c0 Initial upload
Initial upload
2024-11-25 19:36:07 -05:00

252 lines
11 KiB
Plaintext

// Ring of Mana Mastery
//=================================================
#include "rtsh_multiplay"
void main()
{
object oPC=GetItemActivator();
object oTarget=GetItemActivatedTarget();
location lLoc=GetItemActivatedTargetLocation();
object oItem=GetItemActivated();
effect eVFX1;
effect eVFX2;
effect eVFX3;
object oOb=GetItemInSlot(INVENTORY_SLOT_RIGHTRING,oPC);
int nN=FALSE;
int nMana=fnGetTeamMana(oPC);
if (GetTag(oOb)==GetTag(oItem)) nN=TRUE;
else if (GetTag(GetItemInSlot(INVENTORY_SLOT_LEFTRING,oPC))==GetTag(oItem)) nN=TRUE;
if (nN)
{ // wearing ring
if (oTarget==OBJECT_INVALID)
{ // location
if (nMana<5)
{ // syphon energy
oOb=CreateObject(OBJECT_TYPE_PLACEABLE,"rts_marker",lLoc,FALSE);
eVFX1=EffectBeam(VFX_BEAM_LIGHTNING,oOb,BODY_NODE_HAND);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eVFX1,oPC,2.0);
SendMessageToPC(oPC,"You feel mana course into your body. 1 mana has been added to your pool.");
nMana=nMana+1;
fnSetTeamMana(oPC,nMana);
DestroyObject(oOb);
} // syphon energy
else
{ // Lightning Strike
eVFX1=EffectVisualEffect(VFX_IMP_LIGHTNING_M);
eVFX2=EffectVisualEffect(VFX_FNF_SCREEN_SHAKE);
eVFX3=EffectKnockdown();
SendMessageToPC(oPC,"You feel 5 mana sucked through the ring.");
nMana=nMana-5;
fnSetTeamMana(oPC,nMana);
ApplyEffectAtLocation(DURATION_TYPE_INSTANT,eVFX1,lLoc,3.0);
DelayCommand(0.8,ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY,eVFX2,lLoc,3.0));
nN=1;
oPC=CreateObject(OBJECT_TYPE_PLACEABLE,"rts_marker",lLoc,FALSE);
oOb=GetNearestCreature(CREATURE_TYPE_IS_ALIVE,TRUE,oPC);
while (oOb!=OBJECT_INVALID&&GetDistanceBetween(oPC,oOb)<5.0)
{ // major knockdown
DelayCommand(1.1,ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eVFX3,oOb,6.0));
nN++;
oOb=GetNearestCreature(CREATURE_TYPE_IS_ALIVE,TRUE,oPC,nN);
} // major knockdown
DestroyObject(oPC);
} // Lightning Strike
} // location
else if (oTarget==oPC)
{ // self
if (nMana>9)
{ // 10 mana burst
eVFX1=EffectVisualEffect(VFX_IMP_LIGHTNING_M);
eVFX2=EffectVisualEffect(VFX_FNF_SCREEN_SHAKE);
eVFX3=EffectKnockdown();
SendMessageToPC(oPC,"You feel 10 mana sucked through the ring.");
nMana=nMana-10;
fnSetTeamMana(oPC,nMana);
ApplyEffectToObject(DURATION_TYPE_INSTANT,eVFX1,oPC,3.0);
DelayCommand(0.8,ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eVFX2,oPC,3.0));
nN=1;
oOb=GetNearestCreature(CREATURE_TYPE_IS_ALIVE,TRUE,oPC);
while (oOb!=OBJECT_INVALID&&GetDistanceBetween(oPC,oOb)<10.0)
{ // major knockdown
DelayCommand(1.1,ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eVFX3,oOb,6.0));
nN++;
oOb=GetNearestCreature(CREATURE_TYPE_IS_ALIVE,TRUE,oPC,nN);
} // major knockdown
AssignCommand(oPC,ClearAllActions());
AssignCommand(oPC,ActionCastSpellAtObject(SPELL_REMOVE_DISEASE,oPC,METAMAGIC_ANY,TRUE));
} // 10 mana burst
else if (nMana>4)
{ // Burn disease away
eVFX1=EffectVisualEffect(VFX_IMP_FLAME_M);
SendMessageToPC(oPC,"You feel 5 mana sucked through the ring.");
nMana=nMana-5;
fnSetTeamMana(oPC,nMana);
ApplyEffectToObject(DURATION_TYPE_INSTANT,eVFX1,oPC,3.0);
AssignCommand(oPC,ClearAllActions());
AssignCommand(oPC,ActionCastSpellAtObject(SPELL_REMOVE_DISEASE,oPC,METAMAGIC_ANY,TRUE));
} // Burn disease away
else
{ // Not enough mana
SendMessageToPC(oPC,"Your mana reserves are too low to use that power.");
} // Not enough mana
} // self
else if (GetObjectType(oTarget)==OBJECT_TYPE_PLACEABLE)
{ // placeable
if (GetPlotFlag(oTarget)==TRUE)
{ // plot placeable
eVFX1=EffectBeam(VFX_BEAM_LIGHTNING,oTarget,BODY_NODE_HAND);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eVFX1,oPC,2.0);
SendMessageToPC(oPC,"You feel mana course into your body. 1 mana has been added to your pool.");
nMana=nMana+1;
fnSetTeamMana(oPC,nMana);
} // plot placeable
else
{ // not plot
eVFX1=EffectBeam(VFX_BEAM_LIGHTNING,oTarget,BODY_NODE_HAND);
eVFX2=EffectDamage(10);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eVFX1,oPC,2.0);
ApplyEffectToObject(DURATION_TYPE_INSTANT,eVFX2,oTarget,1.0);
SendMessageToPC(oPC,"You feel mana course into your body. 2 mana has been added to your pool.");
nMana=nMana+2;
fnSetTeamMana(oPC,nMana);
} // not plot
} // placeable
else if (GetObjectType(oTarget)==OBJECT_TYPE_DOOR)
{ // door
if (GetTransitionTarget(oTarget)!=OBJECT_INVALID)
{ // transition type
if (nMana>9)
{ // teleport
eVFX1=EffectBeam(VFX_BEAM_ODD,oTarget,BODY_NODE_HAND);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eVFX1,oPC,3.5);
SendMessageToPC(oPC,"You feel 10 mana sucked through the ring. Then you feel a wrenching sensation.");
nMana=nMana-10;
fnSetTeamMana(oPC,nMana);
eVFX2=EffectVisualEffect(VFX_IMP_POLYMORPH);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eVFX2,oPC,4.0);
AssignCommand(oPC,ClearAllActions());
DelayCommand(2.0,AssignCommand(oPC,JumpToObject(GetTransitionTarget(oTarget))));
} // teleport
else
{ // insufficient power
SendMessageToPC(oPC,"Insufficient mana to teleport beyond that door.");
} // insufficient power
} // transition type
else
{ // free standing
if (GetPlotFlag(oTarget)==TRUE)
{ // plot door
eVFX1=EffectBeam(VFX_BEAM_LIGHTNING,oTarget,BODY_NODE_HAND);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eVFX1,oPC,2.0);
SendMessageToPC(oPC,"You feel mana course into your body. 1 mana has been added to your pool.");
nMana=nMana+1;
fnSetTeamMana(oPC,nMana);
} // plot door
else
{ // non-plot door consume it
eVFX1=EffectBeam(VFX_BEAM_LIGHTNING,oTarget,BODY_NODE_HAND);
eVFX2=EffectDamage(10);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eVFX1,oPC,2.0);
ApplyEffectToObject(DURATION_TYPE_INSTANT,eVFX2,oTarget,1.0);
SendMessageToPC(oPC,"You feel mana course into your body. 2 mana has been added to your pool.");
nMana=nMana+2;
fnSetTeamMana(oPC,nMana);
} // non-plot door consume it
} // free standing
} // door
else if (GetObjectType(oTarget)==OBJECT_TYPE_ITEM)
{ // item
if(GetItemCharges(oTarget)>0)
{ // has charges
eVFX1=EffectBeam(VFX_BEAM_LIGHTNING,oTarget,BODY_NODE_HAND);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eVFX1,oPC,2.0);
SendMessageToPC(oPC,"You feel mana course into your body. 10 mana has been added to your pool.");
nMana=nMana+10;
fnSetTeamMana(oPC,nMana);
nN=GetItemCharges(oTarget);
SetItemCharges(oTarget,nN-1);
} // has charges
else
{ // no charges
if (nMana<31)
{ // no effect
SendMessageToPC(oPC,"This ring appears to have no effect with the "+GetName(oTarget)+".");
} // no effect
else
{ // recharge
eVFX1=EffectBeam(VFX_BEAM_LIGHTNING,oPC,BODY_NODE_HAND);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eVFX1,oTarget,2.0);
SendMessageToPC(oPC,"You feel 31 mana ripped from your body and hurled into the "+GetName(oTarget)+"!");
nMana=nMana-31;
fnSetTeamMana(oPC,nMana);
SetItemCharges(oTarget,3);
} // recharge
} // no charges
} // item
else if (GetObjectType(oTarget)==OBJECT_TYPE_CREATURE)
{ // creature
if (GetHasSpell(SPELL_DAZE,oTarget)!=FALSE)
{ // rip spells from the target
eVFX1=EffectBeam(VFX_BEAM_LIGHTNING,oTarget,BODY_NODE_CHEST);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eVFX1,oPC,2.0);
SendMessageToPC(oTarget,"The strange energy from "+GetName(oPC)+" is tugging at your mind.");
SetIsTemporaryEnemy(oPC,oTarget);
SetIsTemporaryEnemy(oTarget,oPC);
AssignCommand(oTarget,ActionAttack(oPC));
nN=d20()+GetWillSavingThrow(oTarget);
if (nN>18)
{ // failed
SendMessageToPC(oTarget,"You made your will save.");
SendMessageToPC(oPC,GetName(oTarget)+" made their will save.");
} // failed
else
{ // rip a spell
SendMessageToPC(oTarget,"You have forgotten a memorized spell.");
SendMessageToPC(oPC,"You feel 5 mana course into your body.");
nMana=nMana+5;
fnSetTeamMana(oPC,nMana);
DecrementRemainingSpellUses(oTarget,SPELL_DAZE);
} // rip a spell
} // rip spells from the target
else
{ // no spells - temporary constitution damage
eVFX1=EffectBeam(VFX_BEAM_LIGHTNING,oTarget,BODY_NODE_CHEST);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eVFX1,oPC,2.0);
SendMessageToPC(oTarget,"The strange energy from "+GetName(oPC)+" is tugging at your heart.");
SetIsTemporaryEnemy(oPC,oTarget);
SetIsTemporaryEnemy(oTarget,oPC);
AssignCommand(oTarget,ActionAttack(oPC));
nN=d20()+GetFortitudeSavingThrow(oTarget);
if (nN>18)
{ // failed
SendMessageToPC(oTarget,"You made your fortitude save.");
SendMessageToPC(oPC,GetName(oTarget)+" made their fortitude save.");
} // failed
else
{ // convert constitution to energy
SendMessageToPC(oTarget,"You feel a portion of your healthiness fade away.");
SendMessageToPC(oPC,"You feel 2 mana rush into your body.");
nMana=nMana+2;
fnSetTeamMana(oPC,nMana);
eVFX2=EffectAbilityDecrease(ABILITY_CONSTITUTION,1);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eVFX2,oTarget,240.0);
} // convert constitution to energy
} // no spells - temporary constitution damage
} // creature
else
{ // weird target
oOb=CreateObject(OBJECT_TYPE_PLACEABLE,"rts_marker",lLoc,FALSE);
eVFX1=EffectBeam(VFX_BEAM_LIGHTNING,oOb,BODY_NODE_HAND);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eVFX1,oPC,2.0);
SendMessageToPC(oPC,"You feel mana course into your body. 1 mana has been added to your pool.");
nMana=nMana+1;
fnSetTeamMana(oPC,nMana);
DestroyObject(oOb);
} // weird target
} // wearing ring
else
{ // not wearing
SendMessageToPC(oPC,"The ring is useless unless you are wearing it.");
} // not wearing
}