// vamp_s0_control - handles the vampire feats #include "dla_i0_strings" #include "prc_inc_spells" ///////////////////////// // PROTOTYPES ///////////////////////// void fnChildrenOfTheNight(object oPC,int nBlood); /////////////////////////////////////////////////////////////[ MAIN ]/////////// void main() { //PrintString("vamp_s0_control"); object oPC = OBJECT_SELF; int nFeat = PRCGetSpellId(); //object oSkin=GetItemInSlot(INVENTORY_SLOT_CARMOUR,oPC); object oSkin = GetPCSkin(oPC); int nLevel=GetLocalInt(oSkin,"nLevel"); int nBlood=GetLocalInt(oPC,"nBloodPool"); int nDmg; object oTarget=PRCGetSpellTargetObject(); string sTag; effect eEffect; int nMinHP; //PrintString("[Debug vamp_s0_control] Feat ID:"+IntToString(nFeat)); switch(nFeat) { // handle vampire radial abilities case 918: { // DRINK nDmg=0; nBlood=MyPRCGetRacialType(oTarget); if (nBlood==RACIAL_TYPE_DWARF||nBlood==RACIAL_TYPE_ELF||nBlood==RACIAL_TYPE_GNOME) nDmg=1; else if (nBlood==RACIAL_TYPE_GIANT||nBlood==RACIAL_TYPE_HALFELF||nBlood==RACIAL_TYPE_HALFLING) nDmg=1; else if (nBlood==RACIAL_TYPE_HALFORC||nBlood==RACIAL_TYPE_HUMAN||nBlood==RACIAL_TYPE_HUMANOID_GOBLINOID) nDmg=1; else if (nBlood==RACIAL_TYPE_HUMANOID_ORC||nBlood==RACIAL_TYPE_FEY) nDmg=1; if (nDmg==1) { // valid target nMinHP=nLevel*3; nDmg=FALSE; eEffect=GetFirstEffect(oTarget); while(GetEffectType(eEffect)!=EFFECT_TYPE_INVALIDEFFECT&&!nDmg) { // check effect nBlood=GetEffectType(eEffect); if (nBlood==EFFECT_TYPE_DAZED||nBlood==EFFECT_TYPE_DOMINATED) nDmg=TRUE; else if (nBlood==EFFECT_TYPE_PARALYZE||nBlood==EFFECT_TYPE_SLEEP) nDmg=TRUE; else if (nBlood==EFFECT_TYPE_STUNNED||nBlood==EFFECT_TYPE_CHARMED) nDmg=TRUE; eEffect=GetNextEffect(oTarget); } // check effect if (!nDmg) { // check hit points if (GetCurrentHitPoints(oTarget)<=nMinHP) nDmg=TRUE; } // check hit points if (nDmg) { // drink SetLocalObject(oPC,"oTarget",oTarget); AssignCommand(oPC,ClearAllActions()); AssignCommand(oPC,ExecuteScript("vamp_act_drink",oPC)); } // drink else { // message FloatingTextStringOnCreature("You can only feed on targets who are disabled by a spell or ability, or are at "+IntToString(nMinHP)+" hit points.",oPC,FALSE); } // message } // valid target else { // not high enough FloatingTextStringOnCreature("You don't think that thing's blood will do the job.",oPC,FALSE); } // not high enough break; } // DRINK case 919: { // ENERGY DRAIN if (nLevel>3&&nBlood>39) { // have ability SetLocalObject(oPC,"oTarget",oTarget); AssignCommand(oPC,ClearAllActions()); AssignCommand(oPC,ExecuteScript("vamp_act_edrain",oPC)); } // have ability else if (nLevel>3) { // insufficient blood FloatingTextStringOnCreature("Not enough blood!",oPC,FALSE); } // insufficient blood else { // not high enough FloatingTextStringOnCreature("Your vampire level is insufficient to use that ability.",oPC,FALSE); } // not high enough break; } // ENERGY DRAIN case 920: { // CREATE SPAWN if (nLevel>4) { // have ability if (nBlood>99) { // sufficient blood SetLocalObject(oPC,"oTarget",oTarget); AssignCommand(oPC,ClearAllActions()); AssignCommand(oPC,ExecuteScript("vamp_create_span",oPC)); } // sufficient blood else { // not enough blood FloatingTextStringOnCreature("You have need at least 100 blood!",oPC,FALSE); } // not enough blood } // have ability else { // not high enough FloatingTextStringOnCreature("Your vampire level is insufficient to use that ability.",oPC,FALSE); } // not high enough break; } // CREATE SPAWN case 921: { // HEAL if (nBlood>0) { // have ability nDmg=GetMaxHitPoints(oPC)-GetCurrentHitPoints(oPC); if (nDmg>0) { // player is damaged if (nDmg<25||nBlood<5) { // minor AssignCommand(oPC,ClearAllActions()); AssignCommand(oPC,ExecuteScript("vamp_act_heal5",oPC)); } // minor else { // major AssignCommand(oPC,ClearAllActions()); AssignCommand(oPC,ExecuteScript("vamp_act_heal25",oPC)); } // major } // player is damaged else { // no damage FloatingTextStringOnCreature("You have no damage!",oPC,FALSE); } // no damage } // have ability else { // not high enough FloatingTextStringOnCreature("You have no blood!",oPC,FALSE); } // not high enough break; } // HEAL case 924: { // DOMINATE / CHARM if (nLevel>1) { // have ability if (nLevel<3) { // Charm person if (nBlood>19) { // enough blood SetLocalObject(oPC,"oTarget",oTarget); AssignCommand(oPC,ClearAllActions()); AssignCommand(oPC,ExecuteScript("vamp_act_charm",oPC)); } // enough blood else { // need blood FloatingTextStringOnCreature("You have need at least 20 blood!",oPC,FALSE); } // need blood } // Charm person else { // dominate person if (nBlood>29) { // enough blood SetLocalObject(oPC,"oTarget",oTarget); AssignCommand(oPC,ClearAllActions()); AssignCommand(oPC,ExecuteScript("vamp_act_domi",oPC)); } // enough blood else { // need blood FloatingTextStringOnCreature("You have need at least 30 blood!",oPC,FALSE); } // need blood } // dominate person } // have ability else { // not high enough FloatingTextStringOnCreature("Your vampire level is insufficient to use that ability.",oPC,FALSE); } // not high enough break; } // DOMINATE / CHARM case 925: { // CONTROL nDmg=GetRacialType(oTarget); if (nDmg==RACIAL_TYPE_ANIMAL) { // animal control nDmg=0; // none sTag=GetTag(oTarget); if (sTag=="NW_DIREWOLF"||sTag=="NW_WOLFDIREBOSS"||sTag=="NW_WOLFWINT") nDmg=1; else if (sTag=="NW_WOLF"||sTag=="NW_WORG"||sTag=="UNC23") nDmg=1; if (sTag=="NW_RATDIRE001"||sTag=="NW_RAT001"||sTag=="NW_RAT002") nDmg=2; if (nDmg==1) { // wolf if (nBlood>29) { // sufficient blood SetLocalObject(oPC,"oTarget",oTarget); AssignCommand(oPC,ClearAllActions()); AssignCommand(oPC,ExecuteScript("vamp_act_ctwolf",oPC)); } // sufficient blood else { // need blood FloatingTextStringOnCreature("You have need at least 30 blood!",oPC,FALSE); } // need blood } // wolf else if (nDmg==2) { // rat if (nBlood>9) { // sufficient blood SetLocalObject(oPC,"oTarget",oTarget); AssignCommand(oPC,ClearAllActions()); AssignCommand(oPC,ExecuteScript("vamp_act_ctrat",oPC)); } // sufficient blood else { // need blood FloatingTextStringOnCreature("You have need at least 10 blood!",oPC,FALSE); } // need blood } // rat else { // other FloatingTextStringOnCreature("You have no affinity with that animal type!",oPC,FALSE); } // other } // animal control else if (nDmg==RACIAL_TYPE_UNDEAD) { // control undead if (nLevel>1) { // sufficient level if (nBlood>39) { // sufficient blood SetLocalObject(oPC,"oTarget",oTarget); AssignCommand(oPC,ClearAllActions()); AssignCommand(oPC,ExecuteScript("vamp_act_ctund",oPC)); } // sufficient blood else { // need blood FloatingTextStringOnCreature("You have need at least 40 blood!",oPC,FALSE); } // need blood } // sufficient level else { // not high enough FloatingTextStringOnCreature("Your vampire level is insufficient to use that ability.",oPC,FALSE); } // not high enough } // control undead else { // invalid target FloatingTextStringOnCreature("You cannot control that type of creature!",oPC,FALSE); } // invalid target break; } // CONTROL case 926: { // STUN ATTACK SetLocalObject(oPC,"oTarget",oTarget); AssignCommand(oPC,ClearAllActions()); AssignCommand(oPC,ExecuteScript("vamp_act_stun",oPC)); break; } // STUN ATTACK case 930: { // INFO sTag=DLA_SetStringColor("Blood Pool: ","666"); sTag=sTag+DLA_SetStringColor(IntToString(nBlood),"622")+"/150 "; sTag=sTag+DLA_SetStringColor("Vampire Experience:","666"); sTag=sTag+DLA_SetStringColor(IntToString(GetLocalInt(oPC,"nVampireXP")),"363"); sTag=sTag+DLA_SetStringColor(" Level:","666")+IntToString(nLevel)+DLA_SetStringColor(" Next Level At:","666"); sTag=sTag+DLA_SetStringColor(IntToString(1+(nLevel*5000)),"266"); sTag=sTag+DLA_SetStringColor(" Has a coffin place?:","666"); oTarget=GetLocalObject(oPC,"oCoffin"); if (GetIsObjectValid(oTarget)) sTag=sTag+DLA_SetStringColor(GetName(GetArea(oTarget)),"336"); else { sTag=sTag+DLA_SetStringColor("No","626"); } FloatingTextStringOnCreature(sTag,oPC,FALSE); break; } // INFO case 931: { // TRANSFORM if (nLevel>1) { // have ability if (nLevel<3) { // wolf if (nBlood>39) { // sufficient blood AssignCommand(oPC,ClearAllActions()); AssignCommand(oPC,ExecuteScript("vamp_act_wolf",oPC)); } // sufficient blood else { // need blood FloatingTextStringOnCreature("You have need at least 40 blood!",oPC,FALSE); } // need blood } // wolf else { // dire wolf if (nBlood>59) { // sufficient blood AssignCommand(oPC,ClearAllActions()); AssignCommand(oPC,ExecuteScript("vamp_act_dwolf",oPC)); } // sufficient blood else { // need blood FloatingTextStringOnCreature("You have need at least 60 blood!",oPC,FALSE); } // need blood } // dire wolf } // have ability else { // not high enough FloatingTextStringOnCreature("Your vampire level is insufficient to use that ability.",oPC,FALSE); } // not high enough break; } // TRANSFORM case 932: { // BURY AssignCommand(oPC,ClearAllActions()); AssignCommand(oPC,ExecuteScript("vamp_act_bury",oPC)); break; } // BURY case 933: { // Children of the night //PrintString(" case 933"); if (nBlood>19) { // sufficient blood AssignCommand(oPC,ClearAllActions(TRUE)); FloatingTextStringOnCreature("Calling Children of the Night!",oPC,FALSE); fnChildrenOfTheNight(oPC,nBlood); } // sufficient blood else { // need blood FloatingTextStringOnCreature("You have need at least 20 blood!",oPC,FALSE); } // need blood break; } // Children of the night default: { // unknown SendMessageToPC(oPC,"Feat ID:"+IntToString(nFeat)); break; } // unknown } // handle vampire radial abilities } /////////////////////////////////////////////////////////////[ MAIN ]/////////// //////////////////////// // FUNCTIONS //////////////////////// void fnChildrenOfTheNight(object oPC,int nBlood) { // PURPOSE: Handle Children of the Night - prevent crash SetLocalObject(oPC,"oTarget",PRCGetSpellTargetObject()); AssignCommand(oPC,ExecuteScript("vamp_act_summon",oPC)); } // fnChildrenOfTheNight()