private static void ProcessNoAir(CLRScriptBase script, uint Creature) { if (!GetNeedsToBreathe(script, Creature)) { return; } script.ApplyEffectToObject(CLRScriptBase.DURATION_TYPE_TEMPORARY, script.ExtraordinaryEffect(script.EffectSilence()), Creature, 6.0f); if (!CurrentDrownStatus.ContainsKey(Creature)) { CurrentDrownStatus.Add(Creature, 1); } else { CurrentDrownStatus[Creature]++; } if(CurrentDrownStatus[Creature] > script.GetAbilityScore(Creature, CLRScriptBase.ABILITY_CONSTITUTION, CLRScriptBase.FALSE) * 2) { if(!CurrentDrownDC.ContainsKey(Creature)) { CurrentDrownDC.Add(Creature, 10); } else { CurrentDrownDC[Creature]++; } int conCheck = script.d20(1); int conMod = script.GetAbilityModifier(CLRScriptBase.ABILITY_CONSTITUTION, Creature); if(conCheck + conMod < CurrentDrownDC[Creature]) { script.SendMessageToPC(Creature, String.Format("*Constitution: {0} + {1} = {2} v. DC {3} :: Failure!*", conCheck, conMod, conCheck + conMod, CurrentDrownDC[Creature])); int Damage = 0; string Message; int HP = script.GetCurrentHitPoints(Creature); if(HP > 1) { Damage = script.GetCurrentHitPoints(Creature) - 1; Message = "You're suffocating! If you don't find air NOW, you will DIE!"; } else if(HP > 0) { Damage = 2; Message = "You have lost consciousness. Unless someone comes to rescue you, you will die."; } else { Damage = 10; Message = "You have suffocated"; } script.ApplyEffectToObject(CLRScriptBase.DURATION_TYPE_INSTANT, script.EffectDamage(Damage, CLRScriptBase.DAMAGE_TYPE_MAGICAL, CLRScriptBase.DAMAGE_POWER_ENERGY, CLRScriptBase.TRUE), Creature, 0.0f); script.SendMessageToPC(Creature, Message); return; } else { script.SendMessageToPC(Creature, "You are barely clutching to consciousness! Get air NOW!"); return; } } else { int SecondsLeft = ((script.GetAbilityScore(Creature, CLRScriptBase.ABILITY_CONSTITUTION, CLRScriptBase.FALSE) * 2) - CurrentDrownStatus[Creature]) * 6; if(SecondsLeft > 60) { script.SendMessageToPC(Creature, String.Format("You can hold your breath for {0} more seconds.", SecondsLeft)); } else if(SecondsLeft > 30) { script.SendMessageToPC(Creature, String.Format("Careful! You can only hold your breath for {0} more seconds!", SecondsLeft)); } else { script.SendMessageToPC(Creature, String.Format("** WARNING ** If you don't find air within {0} seconds, you will DIE!", SecondsLeft)); } } }
private static NWEffect GetTrapEffect(CLRScriptBase s, ALFA.Shared.ActiveTrap trap, uint target) { int damage = 0; for (int count = 0; count < trap.DiceNumber; count++) { damage += s.Random(trap.DiceType) + 1; } if (trap.SaveDC > -1) { if (s.ReflexSave(target, trap.SaveDC, SAVING_THROW_TYPE_TRAP, s.GetObjectByTag(trap.Tag, 0)) != TRUE) { if (s.GetHasFeat(FEAT_IMPROVED_EVASION, target, TRUE) == TRUE) damage /= 2; } else { if (s.GetHasFeat(FEAT_EVASION, target, TRUE) == TRUE) damage = 0; else damage /= 2; } } else { int roll = new Random().Next(20) + 1; int final = roll + trap.AttackBonus; string hitormiss = " *hit* "; if (final < s.GetAC(target, FALSE) && roll != 20) { hitormiss = " *miss* "; damage = 0; } s.SendMessageToPC(target, "<C=DarkViolet>Trap</C><C=DarkOrange> attacks " + s.GetName(target) + ":" + hitormiss + ": " + roll + " + " + trap.AttackBonus + " = " + final); } NWEffect eVis = s.EffectVisualEffect(VFX_COM_HIT_DIVINE, FALSE); List<int> damageTypes = new List<int>(); if ((trap.DamageType & DAMAGE_TYPE_ACID) == DAMAGE_TYPE_ACID) { damageTypes.Add(DAMAGE_TYPE_ACID); eVis = s.EffectVisualEffect(VFX_COM_HIT_ACID, FALSE); } if ((trap.DamageType & DAMAGE_TYPE_BLUDGEONING) == DAMAGE_TYPE_BLUDGEONING) { damageTypes.Add(DAMAGE_TYPE_BLUDGEONING); eVis = s.EffectVisualEffect(VFX_COM_BLOOD_CRT_RED, FALSE); } if ((trap.DamageType & DAMAGE_TYPE_COLD) == DAMAGE_TYPE_COLD) { damageTypes.Add(DAMAGE_TYPE_COLD); eVis = s.EffectVisualEffect(VFX_COM_HIT_FROST, FALSE); } if ((trap.DamageType & DAMAGE_TYPE_DIVINE) == DAMAGE_TYPE_DIVINE) { damageTypes.Add(DAMAGE_TYPE_DIVINE); eVis = s.EffectVisualEffect(VFX_COM_HIT_DIVINE, FALSE); } if ((trap.DamageType & DAMAGE_TYPE_ELECTRICAL) == DAMAGE_TYPE_ELECTRICAL) { damageTypes.Add(DAMAGE_TYPE_ELECTRICAL); eVis = s.EffectVisualEffect(VFX_COM_HIT_ELECTRICAL, FALSE); } if ((trap.DamageType & DAMAGE_TYPE_FIRE) == DAMAGE_TYPE_FIRE) { damageTypes.Add(DAMAGE_TYPE_FIRE); eVis = s.EffectVisualEffect(VFX_COM_HIT_FIRE, FALSE); } if ((trap.DamageType & DAMAGE_TYPE_MAGICAL) == DAMAGE_TYPE_MAGICAL) { damageTypes.Add(DAMAGE_TYPE_MAGICAL); eVis = s.EffectVisualEffect(VFX_COM_HIT_DIVINE, FALSE); } if ((trap.DamageType & DAMAGE_TYPE_NEGATIVE) == DAMAGE_TYPE_NEGATIVE) { damageTypes.Add(DAMAGE_TYPE_NEGATIVE); eVis = s.EffectVisualEffect(VFX_COM_HIT_NEGATIVE, FALSE); } if ((trap.DamageType & DAMAGE_TYPE_PIERCING) == DAMAGE_TYPE_PIERCING) { damageTypes.Add(DAMAGE_TYPE_PIERCING); eVis = s.EffectVisualEffect(VFX_COM_BLOOD_CRT_RED, FALSE); } if ((trap.DamageType & DAMAGE_TYPE_POSITIVE) == DAMAGE_TYPE_POSITIVE) { damageTypes.Add(DAMAGE_TYPE_POSITIVE); eVis = s.EffectVisualEffect(VFX_COM_HIT_DIVINE, FALSE); } if ((trap.DamageType & DAMAGE_TYPE_SLASHING) == DAMAGE_TYPE_SLASHING) { damageTypes.Add(DAMAGE_TYPE_SLASHING); eVis = s.EffectVisualEffect(VFX_COM_BLOOD_CRT_RED, FALSE); } if ((trap.DamageType & DAMAGE_TYPE_SONIC) == DAMAGE_TYPE_SONIC) { damageTypes.Add(DAMAGE_TYPE_SONIC); eVis = s.EffectVisualEffect(VFX_COM_HIT_SONIC, FALSE); } if (damage == 0) { return eVis; } NWEffect eDam = eVis; damage /= damageTypes.Count; if (damage < 1) damage = 1; foreach (int dmgType in damageTypes) { eDam = s.EffectLinkEffects(eDam, s.EffectDamage(damage, dmgType, DAMAGE_POWER_NORMAL, FALSE)); } return eDam; }
public static void Dismount(CLRScriptBase script, uint Character, uint Cloak, NWLocation Location) { string resRef = ""; if (script.GetLocalInt(Cloak, ACR_IS_WARHORSE) == 1) { resRef = "abr_cr_an_horse_pal_"; int nPalLevel = script.GetLevelByClass(CLRScriptBase.CLASS_TYPE_PALADIN, Character); if (nPalLevel >= 15) resRef += "15"; else if (nPalLevel >= 11) resRef += "11"; else if (nPalLevel >= 8) resRef += "8"; else if (nPalLevel >= 5) resRef += "5"; else resRef = "abr_cr_an_horse03"; } else { switch (script.GetTag(Cloak)) { case "acr_ooc_horse01": resRef = "abr_cr_an_horse01"; break; case "acr_ooc_horse02": resRef = "abr_cr_an_horse02"; break; case "acr_ooc_horse03": resRef = "abr_cr_an_horse03"; break; default: // Looks like we're not actually dismounting a horse. return; } } uint Horse = script.CreateObject(CLRScriptBase.OBJECT_TYPE_CREATURE, resRef, Location, CLRScriptBase.FALSE, ""); script.SetLocalInt(Horse, ACR_HORSE_OWNER, script.GetLocalInt(Character, ACR_CID)); script.SetLocalInt(Horse, ACR_HORSE_ID, script.GetLocalInt(Cloak, ACR_HORSE_ID)); int damage = script.GetCurrentHitPoints(Horse) - script.GetLocalInt(Cloak, ACR_HORSE_HP); if(damage > 0) { script.ApplyEffectToObject(CLRScriptBase.DURATION_TYPE_INSTANT, script.EffectDamage(damage, CLRScriptBase.DAMAGE_TYPE_MAGICAL, CLRScriptBase.DAMAGE_POWER_PLUS_TWENTY, CLRScriptBase.TRUE), Horse, 0.0f); } if (script.GetLocalInt(Cloak, ACR_IS_WARHORSE) == 1) { script.AddHenchman(Character, Horse); script.SetLocalInt(Horse, ACR_IS_WARHORSE, 1); script.SetLocalObject(Character, ACR_PAL_WARHORSE, Horse); } uint Item = GetOwnershipItemById(script, Character, script.GetLocalInt(Cloak, ACR_HORSE_ID)); script.SetLocalObject(Item , ACR_HORSE_OBJECT, Horse); script.SetLocalObject(Horse, ACR_HORSE_OBJECT, Character); script.SetLocalString(Item, ACR_HORSE_PERS_LOC_AREA, script.GetTag(script.GetArea(Horse))); script.SetLocalFloat(Item, ACR_HORSE_PERS_LOC_X, script.GetPosition(Horse).x); script.SetLocalFloat(Item, ACR_HORSE_PERS_LOC_Y, script.GetPosition(Horse).y); script.SetLocalFloat(Item, ACR_HORSE_PERS_LOC_Z, script.GetPosition(Horse).z); script.SetPlotFlag(Cloak, CLRScriptBase.FALSE); script.DestroyObject(Cloak, 0.0f, CLRScriptBase.FALSE); isWarhorse.Remove(Character); }