예제 #1
0
        public override void SetPos(int posX, int posY)
        {
            try {
                base.SetPos(posX, posY);

                if (!Prowling)
                {
                    ((LeaderBrain)fBrain).Dir = LastDir;
                }

                AbstractMap fld = CurrentField;
                FOV.FOV_Prepare(fld, false);
                if (Effects.FindEffectByID(EffectID.eid_Blindness) == null && !InFog)
                {
                    int dir;
                    if (GlobalVars.nwrWin.CircularFOV)
                    {
                        dir = Directions.DtNone;
                    }
                    else
                    {
                        dir = LastDir;
                    }
                    FOV.FOV_Start(PosX, PosY, (int)base.Survey, dir);
                }

                // this is need for work of the brain goals, also isAvailable and etc
                Effect ef = Effects.FindEffectByID(EffectID.eid_Sail);
                if (ef != null)
                {
                    Item       ship    = FindItem("Skidbladnir");
                    EntityList members = ship.Contents;

                    int fx = Field.X;
                    int fy = Field.Y;

                    for (int i = members.Count - 1; i >= 0; i--)
                    {
                        NWCreature cr = (NWCreature)members.GetItem(i);
                        cr.SetGlobalPos(LayerID, fx, fy, true);
                        cr.SetPos(posX, posY);
                    }
                }
            } catch (Exception ex) {
                Logger.Write("Player.setPos(): " + ex.Message);
                throw ex;
            }
        }