//:://////////////////////////////////////////////////////////////////////////// //:: // tar_lake_hb.nss /* Just in case the players are dumb enough to jump into a lake of boiling tar. "Should the PCs be inclined to dive into the tar, they suffer the following effects: 1/2 normal swim movement; 1d4 heat damage per round and zero visibility. The mephits, of course, suffer none of these effects. Magic, such as freedom of movement, water breathing, endure, resist, or protection from energy (fire) and true seeing can all help while within the tar." */ // //:: //:://////////////////////////////////////////////////////////////////////////// #include "prc_inc_spells" #include "prc_feat_const" #include "x0_i0_match" //:: 1d4 fire damage per round from the hot tar. void ApplyHeatEffect(object oCreature) { int iHeatDam = d4(1); DelayCommand(0.0f, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectDamage(iHeatDam, DAMAGE_TYPE_FIRE), oCreature, 6.0f)); } //:: Can't breathe in tar void ApplySuffocationEffect(object oCreature) { int iConstitution = GetAbilityScore(oCreature, ABILITY_CONSTITUTION); int iBreathRounds = iConstitution * 2; int iSuffocationDC = 10; // Starting suffocation DC int iCurrentRound = GetLocalInt(oCreature, "SuffocationRound"); if (iCurrentRound <= iBreathRounds) { if (GetResRef(OBJECT_SELF) != "mepooze001" && GetResRef(OBJECT_SELF) != "tarmephit001" && !GetHasFeat(FEAT_WATER_BREATHING, oCreature) && !GetHasFeat(FEAT_BREATHLESS, oCreature) && !GetHasSpellEffect(SPELL_WATER_BREATHING, oCreature) && (MyPRCGetRacialType(oCreature) != RACIAL_TYPE_UNDEAD) && (MyPRCGetRacialType(oCreature) != RACIAL_TYPE_CONSTRUCT)) { SendMessageToPC(oCreature, "You are struggling to breathe in the tar!"); if (d20() + GetFortitudeSavingThrow(oCreature) >= iSuffocationDC) { SendMessageToPC(oCreature, "You manage to hold your breath and avoid suffocation for now."); } else { SendMessageToPC(oCreature, "You are suffocating in the tar!"); if (iCurrentRound == 1) { AssignCommand(oCreature, ActionPlayAnimation(ANIMATION_LOOPING_SPASM, 0.5f, 6.0f)); SetCurrentHitPoints(oCreature, 1); } else if (iCurrentRound == 2) { SetCurrentHitPoints(oCreature, 0); } else if (iCurrentRound == 3) { ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_DEATH), oCreature); ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectDeath(), oCreature); } iCurrentRound++; } } // Store the updated round counter back in the creature's local variables SetLocalInt(oCreature, "SuffocationRound", iCurrentRound); } } //:: Tar slows creatures other than Tar Mephits to 1/2 speed //:: unless they are under the effect of Freedom of Movement void ApplySlowEffect(object oCreature) { if (GetResRef(OBJECT_SELF) != "mepooze001" && GetResRef(OBJECT_SELF) != "tarmephit001" && !GetHasSpellEffect(SPELL_FREEDOM_OF_MOVEMENT, oCreature) || GetHasEffect(IMMUNITY_TYPE_MOVEMENT_SPEED_DECREASE, oCreature)) { // Object has either Freedom of Movement spell effect or IMMUNITY_TYPE_MOVEMENT_SPEED_DECREASE effect SendMessageToPC(GetFirstPC(), "This object has Freedom of Movement or immunity to movement speed decrease!"); } ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectMovementSpeedDecrease(50), oCreature, 6.0f); } //:: Can't see in tar without True Seeing or Blindsight void ApplySightEffect(object oCreature) { // Check if the PC has zero visibility if (GetResRef(OBJECT_SELF) != "mepooze001" && GetResRef(OBJECT_SELF) != "tarmephit001" && !GetHasSpellEffect(SPELL_TRUE_SEEING, oCreature) && !GetHasFeat(FEAT_BLINDSIGHT_5_FT, oCreature) && !GetHasFeat(FEAT_BLINDSIGHT_10_FT, oCreature) && !GetHasFeat(FEAT_BLINDSIGHT_5_FEET, oCreature) && !GetHasFeat(FEAT_BLINDSIGHT_10_FEET, oCreature) && !GetHasFeat(FEAT_BLINDSIGHT_60_FEET, oCreature) && !GetHasFeat(FEAT_PRESTIGE_BLINDSIGHT, oCreature)) { ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectBlindness(), oCreature, 6.0f); } } void main() { object oArea = GetArea(OBJECT_SELF); object oCreature = GetFirstObjectInArea(oArea, OBJECT_TYPE_CREATURE); string sResref = GetResRef(oCreature); while (GetIsObjectValid(oCreature)) { //:: Calculate the armor penalty int iArmorPenalty = 0; object oArmor = GetItemInSlot(INVENTORY_SLOT_CHEST, oCreature); if (GetIsObjectValid(oArmor)) { iArmorPenalty = GetItemACValue(oArmor); } //:: Calculate the DC for the Strength check int iStrengthDC = 15 + iArmorPenalty; //:: Be an Ooze Mephit or roll a Strength check against the DC if (GetResRef(OBJECT_SELF) != "mepooze001" && GetResRef(OBJECT_SELF) != "tarmephit001" || GetAppearanceType(oCreature) != APPEARANCE_TYPE_MEPHIT_OOZE || d20() + GetAbilityModifier(ABILITY_STRENGTH, oCreature) < iStrengthDC) { //:: Apply the other effects since the Strength check failed SendMessageToPC(oCreature, "You are floundering in the tar!"); ApplySightEffect(oCreature); ApplySuffocationEffect(oCreature); } //:: Tar is always hot & slowing ApplyHeatEffect(oCreature); ApplySlowEffect(oCreature); oCreature = GetNextObjectInArea(oArea, OBJECT_TYPE_CREATURE); } }