Exemple #1
0
        public override void DoTurn()
        {
            try {
                base.DoTurn();

                fSatiety -= 1;

                NWField map = CurrentField;
                if (Hallucinations)
                {
                    PrepareHallucinations();
                }

                // processing Skidbladnir
                Effect ef = Effects.FindEffectByID(EffectID.eid_Sail);
                if (ef != null)
                {
                    Item       ship    = FindItem("Skidbladnir");
                    EntityList members = ship.Contents;

                    for (int i = members.Count - 1; i >= 0; i--)
                    {
                        NWCreature cr = (NWCreature)members.GetItem(i);
                        cr.ResetStamina();
                    }

                    int rest;
                    do
                    {
                        rest = 0;
                        for (int i = members.Count - 1; i >= 0; i--)
                        {
                            NWCreature cr = (NWCreature)members.GetItem(i);
                            if (cr.State != CreatureState.Dead)
                            {
                                Effect ef1 = cr.Effects.FindEffectByID(EffectID.eid_Sail);
                                if (ef1 == null)
                                {
                                    throw new Exception("gluk!");
                                }

                                cr.DoTurn();
                                if (cr.Stamina >= Speed)
                                {
                                    rest++;
                                }
                            }
                        }
                    } while (rest != 0);
                }

                if (!Prowling)
                {
                    ApplyLightEffect();

                    if (!GlobalVars.Debug_Divinity)
                    {
                        if (fSatiety == 200)
                        {
                            GlobalVars.nwrWin.ShowText(this, BaseLocale.GetStr(RS.rs_YouHungry));
                        }
                        else
                        {
                            if (fSatiety <= 150 && (int)fSatiety % 50 == 0)
                            {
                                UseEffect(EffectID.eid_Swoon, null, InvokeMode.im_ItSelf, null);
                            }
                            else
                            {
                                if (fSatiety <= 0)
                                {
                                    Death(BaseLocale.GetStr(RS.rs_Starved), null);
                                    return;
                                }
                            }
                        }

                        /*if (super.LayerID == GlobalVars.Layer_Muspelheim) {
                         *  // TODO: requires additional processing
                         * }*/

                        if (LayerID == GlobalVars.Layer_Niflheim && GetAbility(AbilityID.Resist_Cold) == 0)
                        {
                            int num3 = RandomHelper.GetRandom(2);
                            if (num3 != 0)
                            {
                                if (num3 == 1)
                                {
                                    GlobalVars.nwrWin.ShowText(this, BaseLocale.GetStr(RS.rs_YouNumbedByColdOfNiflheim));
                                    Death(BaseLocale.GetStr(RS.rs_FrozeToDeath), null);
                                }
                            }
                            else
                            {
                                GlobalVars.nwrWin.ShowText(this, BaseLocale.GetStr(RS.rs_NiflheimFrostDeath));
                                Death(BaseLocale.GetStr(RS.rs_TurnedToIce), null);
                            }
                            return;
                        }

                        if (LayerID == GlobalVars.Layer_Midgard && Field.X == 1 && Field.Y == 6 && GetAbility(AbilityID.Resist_Heat) == 0)
                        {
                            int num4 = RandomHelper.GetRandom(2);
                            if (num4 != 0)
                            {
                                if (num4 == 1)
                                {
                                    GlobalVars.nwrWin.ShowText(this, BaseLocale.GetStr(RS.rs_YouBurntByFlamesOfBifrost));
                                }
                            }
                            else
                            {
                                GlobalVars.nwrWin.ShowText(this, BaseLocale.GetStr(RS.rs_BifrostFlameDeath));
                            }
                            Death(BaseLocale.GetStr(RS.rs_ConsumedByFire), null);
                            return;
                        }
                    }

                    if (!GlobalVars.Debug_DevMode && LayerID == GlobalVars.Layer_Vanaheim && map.Creatures.Count == 1)
                    {
                        Morality = 0;
                        TransferTo(GlobalVars.Layer_Midgard, 2, 2, -1, -1, StaticData.MapArea, true, false);
                        GlobalVars.nwrWin.ShowText(this, BaseLocale.GetStr(RS.rs_VanaheimIsEmpty), new LogFeatures(LogFeatures.lfDialog));
                    }

                    if (Morality <= -100 && LayerID != GlobalVars.Layer_Niflheim)
                    {
                        TransferTo(GlobalVars.Layer_Niflheim, 1, 1, -1, -1, StaticData.MapArea, true, false);
                        GlobalVars.nwrWin.ShowText(this, BaseLocale.GetStr(RS.rs_PlayerIsUnworthy), new LogFeatures(LogFeatures.lfDialog));
                    }
                }
            } catch (Exception ex) {
                Logger.Write("Player.doTurn(): " + ex.Message);
            }
        }