Пример #1
0
        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));
                }
            }
        }