//:///////////////////////////////////////////////////////////////////////////// /* swm_bloodfly_hb.nss [Jaysyn / 20221230] Bloodflies bite and seek to draw blood from their targets. A bloodfly swarm deals 1d6 damage to any creature whose space it occupies at the end of its move. Blood Drain (Ex): Each creature that begins its turn with a mini-kank swarm in its space suffers 1 points of Constitution damage from blood loss as the mini-kanks feed (Reflex DC 17 half). The save DC is Dexterity-based and includes a +2 racial bonus. Distraction (Ex): Any living creature that begins its turns with a mini-kank swarm in its space must succeed on a DC 12 Fortitude save or be nauseated for 1 round. The save DC is Constitution-based. */ //:///////////////////////////////////////////////////////////////////////////// #include "prc_inc_spells" void main() { //:: Declare major variables object oCaster = GetAreaOfEffectCreator(); object oTarget = GetFirstInPersistentObject(OBJECT_SELF, OBJECT_TYPE_CREATURE); int iDexMod = GetAbilityModifier(ABILITY_DEXTERITY, oCaster); int iConMod = GetAbilityModifier(ABILITY_CONSTITUTION, oCaster); int nCon; int iHD = GetHitDice(oCaster); int iDexDC = 12 + (iHD/2) + iDexMod; //:: Bloodflies have a +2 racial bonus on this DC int iConDC = 10 + (iHD/2) + iConMod; int nDrain = 1; effect eImp = EffectVisualEffect(VFX_IMP_POISON_S); effect eVis = EffectVisualEffect(VFX_DUR_AURA_PULSE_RED_BLACK); effect eVis2 = EffectVisualEffect(VFX_DUR_FLIES); effect eNausea = EffectNausea(oTarget, 0.0f); effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_NEGATIVE); effect eDistract = EffectLinkEffects(eNausea, eVis); eDistract = EffectLinkEffects(eDistract, eVis2); eDistract = EffectLinkEffects(eDistract, eDur); eDistract = TagEffect(eDistract, "BloodflyDistraction"); effect eVis3 = EffectVisualEffect(VFX_IMP_REDUCE_ABILITY_SCORE); effect eCon = EffectAbilityDecrease(ABILITY_CONSTITUTION, nDrain); effect eDur2 = EffectVisualEffect(VFX_DUR_CESSATE_NEGATIVE); effect eDrain = EffectLinkEffects(eCon, eDur); eDrain = SupernaturalEffect(eDrain); eDrain = TagEffect(eDrain, "BloodflyBloodDrain"); effect eSwarmDmg = EffectDamage(d6(1), DAMAGE_TYPE_SLASHING, DAMAGE_POWER_NORMAL); effect eSwarmHit = EffectVisualEffect(VFX_IMP_DISEASE_S); effect eBite = EffectLinkEffects(eSwarmDmg, eSwarmHit); eBite = SupernaturalEffect(eBite); eBite = TagEffect(eBite, "BloodflyBite"); //:: Determine if oTarget can die from ability loss int bKillEm = FALSE; if ( !GetIsPC(oTarget) || GetGameDifficulty() == GAME_DIFFICULTY_CORE_RULES || GetGameDifficulty() == GAME_DIFFICULTY_DIFFICULT ) bKillEm = TRUE; //:: Run the swarm effect loop while(GetIsObjectValid(oTarget)) { if(GetIsEnemy(oTarget, oCaster)) { //:: Apply physical swarm damage ApplyEffectToObject(DURATION_TYPE_PERMANENT, eBite, oTarget); //:: Distraction (Nausea) saving throw if (!PRCMySavingThrow(SAVING_THROW_FORT, oTarget, iConDC, SAVING_THROW_TYPE_NONE, oCaster)) { //:: Apply Nausea effect for 1 round ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDistract, oTarget, 5.75f); } //:: Blood Drain saving throw if (!PRCMySavingThrow(SAVING_THROW_REFLEX, oTarget, iDexDC, SAVING_THROW_TYPE_NONE, oCaster)) { //:: Check for immunity to ability decrease if (!GetIsImmune(oTarget, IMMUNITY_TYPE_ABILITY_DECREASE)) { //:: If they fail this save, aren't immune & have less than a 3 Constitution, kill them int nCon = GetAbilityScore(oTarget, ABILITY_CONSTITUTION); if ( ( nCon - nDrain ) < 3 && bKillEm ) { effect eVis4 = EffectVisualEffect(VFX_IMP_DEATH); effect eHP2 = EffectDamage( 9999, DAMAGE_TYPE_MAGICAL , DAMAGE_POWER_PLUS_TWENTY); effect eDeath2 = EffectDeath(); ApplyEffectToObject(DURATION_TYPE_INSTANT,eVis4,oTarget); ApplyEffectToObject(DURATION_TYPE_INSTANT,eDeath2,oTarget); ApplyEffectToObject(DURATION_TYPE_INSTANT,eHP2,oTarget); } //:: Apply CON damage ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDrain, oTarget); ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis3, oTarget); } } } oTarget = GetNextInPersistentObject(); } }