Exemplo n.º 1
0
        private static SearchResult SearchMapLocation(int aX, int aY)
        {
            aX -= 8;
            aY -= 8;

            int num = GlobalVars.nwrGame.LayersCount;

            for (int idx = 0; idx < num; idx++)
            {
                NWLayer    layer      = GlobalVars.nwrGame.GetLayer(idx);
                LayerEntry layerEntry = layer.Entry;

                ExtRect rt = ExtRect.Create(layerEntry.MSX, layerEntry.MSY, layerEntry.MSX + (layerEntry.W << 5), layerEntry.MSY + layerEntry.H * 30);

                if (rt.Contains(aX, aY))
                {
                    int xx = (aX - layerEntry.MSX) / 32;
                    int yy = (aY - layerEntry.MSY) / 30;

                    NWField fld = layer.GetField(xx, yy);
                    if (fld != null)
                    {
                        SearchResult result = new SearchResult();
                        result.LID    = layerEntry.GUID;
                        result.FieldX = xx;
                        result.FieldY = yy;
                        return(result);
                    }
                }
            }

            return(null);
        }
Exemplo n.º 2
0
        protected override void DoMouseMoveEvent(MouseMoveEventArgs eventArgs)
        {
            base.DoMouseMoveEvent(eventArgs);

            fMapHint = "";
            SearchResult res = SearchMapLocation(eventArgs.X, eventArgs.Y);

            if (res != null)
            {
                LayerEntry eLayer = (LayerEntry)GlobalVars.nwrDB.GetEntry(res.LID);
                NWField    fld    = GlobalVars.nwrGame.GetField(res.LID, res.FieldX, res.FieldY);
                fMapHint = eLayer.Name;
                if (fld.Visited)
                {
                    string Land = fld.LandName;
                    if (fMapHint.CompareTo(Land) != 0 && Land.CompareTo("") != 0)
                    {
                        fMapHint = fMapHint + " - " + Land;
                    }
                }
                else
                {
                    fMapHint = "";
                }
            }
        }
Exemplo n.º 3
0
        public override void TileProc(int aX, int aY, ref bool aContinue)
        {
            NWField fld  = Field;
            NWTile  tile = (NWTile)fld.GetTile(aX, aY);

            Step(aX, aY);

            if (fld.IsBarrier(aX, aY))
            {
                if (tile.ForeBase == PlaceID.pid_Tree)
                {
                    tile.Foreground = PlaceID.pid_Undefined;
                    fld.AddCreature(aX, aY, GlobalVars.nwrDB.FindEntryBySign("Faleryn").GUID);
                }
                aContinue = false;
            }
            else
            {
                NWCreature c = (NWCreature)fld.FindCreature(aX, aY);
                if (c != null)
                {
                    EffectsFactory.e_Transformation(EffectID.eid_Transformation, c, null, ItemState.is_Normal, InvokeMode.im_ItSelf, null);
                }
            }
        }
Exemplo n.º 4
0
        private void UpdateView()
        {
            fMercenariesList.Items.BeginUpdate();
            fMercenariesList.Items.Clear();
            if (fCollocutor.CLSID == GlobalVars.cid_Jarl)
            {
                NWField fld = fCollocutor.CurrentField;

                int num = fld.Creatures.Count;
                for (int i = 0; i < num; i++)
                {
                    NWCreature j = fld.Creatures.GetItem(i);
                    if (j.CLSID == GlobalVars.cid_Guardsman && !j.Mercenary)
                    {
                        AddCandidate(j);
                    }
                }
            }
            else
            {
                if (fCollocutor.CLSID == GlobalVars.cid_Merchant)
                {
                    AddCandidate(fCollocutor);
                }
            }
            fMercenariesList.Items.EndUpdate();
            fRecruitBtn.Enabled = (fMercenariesList.Items.Count > 0);
        }
Exemplo n.º 5
0
        public override void TileProc(int aX, int aY, ref bool refContinue)
        {
            NWField f = Field;

            Step(aX, aY);

            if (f.IsBarrier(aX, aY))
            {
                refContinue = false;
            }
            else
            {
                NWCreature c = (NWCreature)f.FindCreature(aX, aY);
                if (c != null && c.HasAffect(EffectID.eid_Death))
                {
                    RaceID race = c.Entry.Race;
                    if (race == RaceID.crDefault || race == RaceID.crHuman)
                    {
                        if (c.IsPlayer)
                        {
                            c.Death(BaseLocale.GetStr(RS.rs_KilledByDeathRay), null);
                        }
                        else
                        {
                            c.Death(BaseLocale.Format(RS.rs_TheXIsDestroyed, new object[] { c.Name }), null);
                        }
                    }
                }
            }
        }
        public override void TileProc(int aX, int aY, ref bool refContinue)
        {
            NWField f = Field;

            Step(aX, aY);

            if (f.IsBarrier(aX, aY))
            {
                refContinue = false;
            }
            else
            {
                BaseTile   tile = f.GetTile(aX, aY);
                NWCreature c    = (NWCreature)f.FindCreature(aX, aY);
                if (c != null)
                {
                    string cSign = c.Entry.Sign;

                    if (cSign.Equals("Mudman") || cSign.Equals("MudFlow"))
                    {
                        EffectsFactory.Deanimate(f, c, tile, PlaceID.pid_Mud);
                    }
                    else
                    {
                        if (cSign.Equals("LavaFlow"))
                        {
                            EffectsFactory.Deanimate(f, c, tile, PlaceID.pid_Lava);
                        }
                        else
                        {
                            if (cSign.Equals("Jagredin") || cSign.Equals("LiveRock"))
                            {
                                EffectsFactory.Deanimate(f, c, tile, PlaceID.pid_Rubble);
                            }
                            else
                            {
                                if (cSign.Equals("SandForm"))
                                {
                                    EffectsFactory.Deanimate(f, c, tile, PlaceID.pid_Quicksand);
                                }
                                else
                                {
                                    if (cSign.Equals("WateryForm"))
                                    {
                                        EffectsFactory.Deanimate(f, c, tile, PlaceID.pid_Water);
                                    }
                                    else
                                    {
                                        if (c.State == CreatureState.Undead)
                                        {
                                            c.Death("", null);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        public override void CheckTile(bool aHere)
        {
            NWField map = (NWField)CurrentMap;

            if (map == null)
            {
                return;
            }

            int num = fSegments.Count;

            for (int i = 0; i < num; i++)
            {
                ArticulateSegment seg  = GetSegment(i);
                NWTile            tile = (NWTile)map.GetTile(seg.X, seg.Y);

                if (tile != null)
                {
                    if (aHere)
                    {
                        tile.CreaturePtr = this;
                    }
                    else
                    {
                        tile.CreaturePtr = null;
                    }
                }
            }
        }
Exemplo n.º 8
0
        public override void TileProc(int aX, int aY, ref bool refContinue)
        {
            NWField f = Field;

            if (f.IsBarrier(aX, aY))
            {
                refContinue = false;
            }
            else
            {
                Step(aX, aY);

                NWCreature c = (NWCreature)f.FindCreature(aX, aY);
                if (c != null)
                {
                    int val = RandomHelper.GetBoundedRnd(25, 40);
                    if (c.HPCur - val < 0)
                    {
                        val = c.HPCur;
                    }
                    c.ApplyDamage(val, DamageKind.dkPhysical, null, "");
                    if (Creature.Items.FindByCLSID(GlobalVars.iid_SoulTrapping_Ring) == null)
                    {
                        Creature.HPCur = Creature.HPCur + val;
                    }
                    // TODO: messages!!!
                }
                refContinue = (c == null);
            }
        }
Exemplo n.º 9
0
        public override void TileProc(int aX, int aY, ref bool refContinue)
        {
            NWField f    = Field;
            NWTile  tile = (NWTile)f.GetTile(aX, aY);

            Step(aX, aY);

            if (f.IsBarrier(aX, aY))
            {
                if (tile.ForeBase == PlaceID.pid_Tree)
                {
                    tile.Foreground = PlaceID.pid_DeadTree;
                    string nm = BaseLocale.GetStr(StaticData.dbPlaces[5].NameRS);
                    GlobalVars.nwrWin.ShowText(Creature, BaseLocale.Format(RS.rs_TheXIsMelted, new object[] { nm }));
                }
                refContinue = false;
            }
            else
            {
                NWCreature c = (NWCreature)f.FindCreature(aX, aY);
                if (c != null && c.HasAffect(EffectID.eid_Flaying))
                {
                    c.ApplyDamage(RandomHelper.GetBoundedRnd(13, 36), DamageKind.dkRadiation, null, BaseLocale.Format(RS.rs_TheXIsMelted, new object[] { c.Name }));
                }
            }
        }
Exemplo n.º 10
0
        public void Generate(NWField field, int pX, int pY)
        {
            ExtRect area = ExtRect.Create(pX - 7, pY - 7, pX + 7, pY + 7);

            field.Gen_RarefySpace(area, ChangeFCTile, 8, 50);

            field.NormalizeFog();
        }
Exemplo n.º 11
0
 public Projectile(NWCreature creature, NWField field, AttackKind attackKind, int range, Item weapon, Item projectile)
 {
     Kind           = attackKind;
     Range          = range;
     Steps          = 0;
     Creature       = creature;
     Map            = field;
     Weapon         = weapon;
     ProjectileItem = projectile;
 }
Exemplo n.º 12
0
        protected override void DoPaintEvent(BaseScreen screen)
        {
            base.DoPaintEvent(screen);

            int ax = 8;
            int ay = 8;

            screen.DrawImage(ax, ay, 0, 0, (int)fImage.Width, (int)fImage.Height, fImage, 255);

            screen.Font = CtlCommon.BgFont;
            screen.DrawText(ax + 40, ay + 25, BaseLocale.GetStr(RS.rs_WorldsTree), 0);
            screen.Font = CtlCommon.SmFont;

            int num = GlobalVars.nwrGame.LayersCount;

            for (int i = 0; i < num; i++)
            {
                NWLayer    layer = GlobalVars.nwrGame.GetLayer(i);
                LayerEntry lre   = layer.Entry;

                for (int y = 0; y < layer.H; y++)
                {
                    for (int x = 0; x < layer.W; x++)
                    {
                        if (layer.GetField(x, y).Visited)
                        {
                            GlobalVars.nwrWin.Resources.DrawImage(screen,
                                                                  ax + lre.MSX + (x << 5), ay + lre.MSY + y * 30,
                                                                  lre.IconsIndex + (y * lre.W + x), 255);
                        }
                    }
                }
            }

            Player     player     = GlobalVars.nwrGame.Player;
            LayerEntry layerEntry = ((LayerEntry)GlobalVars.nwrDB.GetEntry(player.LayerID));

            if (fMapCursor)
            {
                NWField  fld = (NWField)player.CurrentMap;
                ExtPoint f   = fld.Coords;
                GlobalVars.nwrWin.Resources.DrawImage(screen,
                                                      ax + layerEntry.MSX + (f.X << 5), ay + layerEntry.MSY + f.Y * 30,
                                                      StaticData.dbItfElements[(int)ItfElement.id_Cursor].ImageIndex, 255);
            }

            if (fMapHint.CompareTo("") != 0)
            {
                int tw = CtlCommon.SmFont.GetTextWidth(fMapHint);
                CtlCommon.SmFont.Color = Colors.Navy;

                //screen.drawText(ax + 304 + ((288 - tw) / 2), ay + 410, this.fMapHint, 0);
                screen.DrawText(ax + 58 + ((582 - tw) / 2), ay + 445, fMapHint, 0);
            }
        }
Exemplo n.º 13
0
        public override bool CanMove(IMap map, int aX, int aY)
        {
            bool result = base.CanMove(map, aX, aY);

            NWField fld = (NWField)map;
            int     bg  = fld.GetTile(aX, aY).BackBase;

            result = result || (bg == PlaceID.pid_Space) || (GlobalVars.Debug_Divinity);

            return(result);
        }
        private void ShowGoals()
        {
            NWField           fld = GlobalVars.nwrGame.Player.CurrentField;
            LocatedEntityList cl  = (fld).Creatures;

            int num = cl.Count;

            for (int i = 0; i < num; i++)
            {
                NWCreature c = (NWCreature)cl.GetItem(i);
                AddMessage(c.Name + ": " + Convert.ToString(c.Brain.GoalsCount));
            }
        }
Exemplo n.º 15
0
        public override void TileProc(int aX, int aY, ref bool aContinue)
        {
            NWField fld  = Field;
            NWTile  tile = (NWTile)fld.GetTile(aX, aY);

            Step(aX, aY);

            if (tile == null)
            {
                aContinue = false;
            }
            else
            {
                int fgp = tile.ForeBase;

                switch (fgp)
                {
                case PlaceID.pid_Undefined:
                    break;

                case PlaceID.pid_Mountain:
                case PlaceID.pid_Vulcan:
                    aContinue = false;
                    break;

                case PlaceID.pid_Vortex:
                case PlaceID.pid_StairsDown:
                case PlaceID.pid_StairsUp:
                case PlaceID.pid_GStairsDown:
                case PlaceID.pid_GStairsUp:
                case PlaceID.pid_HoleDown:
                case PlaceID.pid_HoleUp:
                    break;

                default:
                    tile.Foreground = PlaceID.pid_Rubble;
                    break;
                }

                NWCreature c = (NWCreature)fld.FindCreature(aX, aY);
                if (c != null)
                {
                    RaceID race = c.Entry.Race;
                    if (race == RaceID.crDefault || race == RaceID.crHuman)
                    {
                        c.Death("", null);
                    }
                }
            }
        }
Exemplo n.º 16
0
        public Player(NWGameSpace space, object owner)
            : base(space, owner)
        {
            CLSID = GlobalVars.cid_Viking;
            Name  = BaseLocale.GetStr(RS.rs_Unknown);
            Sex   = CreatureSex.csMale;

            fMemory = new Memory(null);
            HalMap  = new NWField(null, null, ExtPoint.Empty);
            fFaith  = new Faith(this);
            fCraft  = new Craft(this);

            InitBrain();
        }
Exemplo n.º 17
0
        public void LineProc(int x, int y, ref bool isContinue)
        {
            NWField f = ACreature.CurrentField;

            if (f.IsBarrier(x, y))
            {
                isContinue = false;
            }
            else
            {
                NWCreature cr = (NWCreature)f.FindCreature(x, y);
                isContinue = (cr == null) || (cr.Equals(AEnemy) || cr.Equals(ACreature));
            }
        }
Exemplo n.º 18
0
        public override void TileProc(int aX, int aY, ref bool aContinue)
        {
            NWField f = Field;

            if (f.IsBarrier(aX, aY))
            {
                aContinue = false;
            }
            else
            {
                NWCreature c = (NWCreature)f.FindCreature(aX, aY);
                if (c != null)
                {
                    EffectsFactory.FireHit(EffectID.eid_FireVision, Creature, c, RandomHelper.GetBoundedRnd(2, 40));
                }
                aContinue = (c == null);
            }
        }
Exemplo n.º 19
0
        public override void TileProc(int aX, int aY, ref bool refContinue)
        {
            NWField f = Field;

            Step(aX, aY);
            if (f.IsBarrier(aX, aY))
            {
                refContinue = false;
            }
            else
            {
                NWCreature c = (NWCreature)f.FindCreature(aX, aY);
                if (c != null && c.HasAffect(EffectID.eid_Stoning))
                {
                    c.AddEffect(EffectID.eid_Stoning, ItemState.is_Normal, EffectAction.ea_Persistent, true, "");
                }
            }
        }
Exemplo n.º 20
0
        public override void LeavePlace(NWField field, NWTile tile)
        {
            try {
                base.LeavePlace(field, tile);

                if (field.LandID == GlobalVars.Land_Crossroads)
                {
                    int fg = tile.ForeBase;
                    if (fg == PlaceID.pid_cr_Disk || fg == PlaceID.pid_cr_Disk_Pressed)
                    {
                        tile.Foreground = PlaceID.pid_Undefined;
                        GlobalVars.nwrWin.ShowText(this, BaseLocale.GetStr(RS.rs_DiskFalls));
                    }
                }
            } catch (Exception ex) {
                Logger.Write("Player.leavePlace(): " + ex.Message);
                throw ex;
            }
        }
Exemplo n.º 21
0
        private bool CheckDivinePower(int deityID)
        {
            bool result = true;

            CreatureEntry deity = (CreatureEntry)GlobalVars.nwrDB.GetEntry(deityID);
            NWField       fld   = fPlayer.CurrentField;

            if ((deity.Race == RaceID.crAesir && (fld.LandID == GlobalVars.Land_Muspelheim || fld.LandID == GlobalVars.Land_Niflheim || fld.LandID == GlobalVars.Land_Jotenheim)) || (deity.Race == RaceID.crEvilGod && (fld.LandID == GlobalVars.Land_Valhalla || fld.LandID == GlobalVars.Land_Vigrid || fld.LandID == GlobalVars.Land_Bifrost)))
            {
                LandEntry land = (LandEntry)GlobalVars.nwrDB.GetEntry(fld.LandID);
                ShowText(Locale.Format(RS.rs_WontHelp, new object[] {
                    land.GetNounDeclension(Number.nSingle, Case.cPrepositional),
                    deity.Name
                }));
                result = false;
            }

            return(result);
        }
Exemplo n.º 22
0
        public override void TransferTo(int layerID, int fX, int fY, int pX, int pY, ExtRect area, bool obligatory, bool controlled)
        {
            try {
                NWField field        = Space.GetField(layerID, fX, fY);
                bool    withoutParty = (field.LandID == GlobalVars.Land_Crossroads) || Sail;

                bool globalMove = (LayerID != layerID || Field.X != fX || Field.Y != fY);
                bool partyMove  = (globalMove && controlled && !withoutParty);

                base.TransferTo(layerID, fX, fY, pX, pY, area, obligatory, controlled);

                /*if (globalMove) {
                 *  // ???
                 * }*/

                if (partyMove)
                {
                    try {
                        LeaderBrain party = (LeaderBrain)fBrain;
                        int         num   = party.Members.Count;
                        for (int i = 1; i < num; i++)
                        {
                            NWCreature member = party.Members[i];

                            ExtPoint pt = member.GetNearestPlace(Location, 4, true);
                            if (!pt.IsEmpty)
                            {
                                member.TransferTo(layerID, fX, fY, pt.X, pt.Y, area, obligatory, true);
                            }
                            else
                            {
                                Logger.Write("Player.transferTo().transferParty().getNearestPlace() failed");
                            }
                        }
                    } catch (Exception ex) {
                        Logger.Write("Player.transferTo().transferParty(): " + ex.Message);
                    }
                }
            } catch (Exception ex) {
                Logger.Write("Player.transferTo(): " + ex.Message);
                throw ex;
            }
        }
        public override void TileProc(int aX, int aY, ref bool aContinue)
        {
            NWField fld = Field;

            Step(aX, aY);

            if (fld.IsBarrier(aX, aY))
            {
                aContinue = false;
            }
            else
            {
                NWCreature c = (NWCreature)fld.FindCreature(aX, aY);
                aContinue = true;
                if (c != null)
                {
                    if (c.HasAffect(EffID))
                    {
                        MNXRange dmg = EffectsData.dbEffects[(int)EffID].Damage;
                        c.ApplyDamage(RandomHelper.GetBoundedRnd(dmg.Min, dmg.Max), DmgKind, null, "");
                    }
                    if (EffID == EffectID.eid_Slinn_Gout)
                    {
                        c.Luck--;
                    }
                    else
                    {
                        if (EffID == EffectID.eid_Ellegiant_Throw)
                        {
                            aContinue = false;
                            Item item = new Item(GameSpace.Instance, fld);
                            item.CLSID = GlobalVars.nwrDB.FindEntryBySign("Boulder").GUID;
                            item.Count = 1;
                            item.SetPos(aX, aY);
                            item.Owner = fld;
                            fld.Items.Add(item, false);
                        }
                    }
                }
            }
        }
Exemplo n.º 24
0
        public void LineProc(int aX, int aY, ref bool aContinue)
        {
            NWField f = (NWField)ACreature.CurrentMap;

            if (f.IsBarrier(aX, aY))
            {
                aContinue = false;
            }
            else
            {
                NWCreature cr = (NWCreature)f.FindCreature(aX, aY);
                if (cr == null)
                {
                    aContinue = true;
                }
                else
                {
                    aContinue = (cr.Equals(AEnemy) || cr.Equals(ACreature));
                }
            }
        }
Exemplo n.º 25
0
        private void PrepareHallucinations()
        {
            NWField field = CurrentField;

            HalMap = new NWField(null, field.Layer, field.Coords.Clone());

            for (int y = 0; y < StaticData.FieldHeight; y++)
            {
                for (int x = 0; x < StaticData.FieldWidth; x++)
                {
                    NWTile tile    = (NWTile)field.GetTile(x, y);
                    NWTile halTile = (NWTile)HalMap.GetTile(x, y);
                    halTile.Assign(tile);

                    halTile.Background = Hallucination.GetPlaceID(tile.BackBase);
                    halTile.Foreground = Hallucination.GetPlaceID(tile.ForeBase);
                }
            }

            HalMap.Normalize();
        }
Exemplo n.º 26
0
        public override void TileProc(int aX, int aY, ref bool aContinue)
        {
            NWCreature self = Creature;
            NWField    f    = Field;

            if (f.IsBarrier(aX, aY))
            {
                aContinue = false;
            }
            else
            {
                NWCreature c = (NWCreature)f.FindCreature(aX, aY);
                if (c != null)
                {
                    c.ApplyDamage(RandomHelper.GetBoundedRnd(9, 17), DamageKind.dkPhysical, null, "");
                }
                else
                {
                    self.CheckTile(false);
                    self.SetPos(aX, aY);
                    self.CheckTile(true);

                    Effect ef = self.Effects.FindEffectByID(EffectID.eid_PitTrap);
                    if (ef != null)
                    {
                        self.Effects.Remove(ef);
                    }
                    else
                    {
                        ef = self.Effects.FindEffectByID(EffectID.eid_Quicksand);
                        if (ef != null)
                        {
                            self.Effects.Remove(ef);
                        }
                    }
                    GlobalVars.nwrWin.ShowText(self, BaseLocale.GetStr(RS.rs_YouPullForward));
                }
                aContinue = false;
            }
        }
Exemplo n.º 27
0
        public override void TileProc(int aX, int aY, ref bool refContinue)
        {
            NWField f    = Field;
            NWTile  tile = (NWTile)f.GetTile(aX, aY);

            Step(aX, aY);

            if (f.IsBarrier(aX, aY))
            {
                if (tile.ForeBase == PlaceID.pid_Tree)
                {
                    tile.Foreground = PlaceID.pid_DeadTree;
                    string tmp = BaseLocale.GetStr(StaticData.dbPlaces[5].NameRS);
                    GlobalVars.nwrWin.ShowText(Creature, BaseLocale.Format(RS.rs_TheXIsFrozen, new object[] { tmp }));
                }
                refContinue = false;
            }
            else
            {
                NWCreature c = (NWCreature)f.FindCreature(aX, aY);
                if (c != null && c.HasAffect(EffectID.eid_Ice))
                {
                    c.AddEffect(EffectID.eid_Ice, ItemState.is_Normal, EffectAction.ea_Persistent, false, BaseLocale.GetStr(RS.rs_YouAreFrozen));
                    Effect e = c.Effects.FindEffectByID(EffectID.eid_Ice);
                    if (e != null && e.Magnitude >= 30)
                    {
                        string tmp;
                        if (c.IsPlayer)
                        {
                            tmp = BaseLocale.GetStr(RS.rs_EncasedInIce);
                        }
                        else
                        {
                            tmp = BaseLocale.Format(RS.rs_TheXIsFrozen, new object[] { c.Name });
                        }
                        c.Death(tmp, null);
                    }
                }
            }
        }
Exemplo n.º 28
0
        public static void DrawSymTile(NWGameSpace space, NWField field, int px, int py, BaseScreen screen, ExtRect mapRect, ExtRect viewRect, ImageList symImages)
        {
            NWTile place = (NWTile)field.GetTile(px, py);
            int    sx    = viewRect.Left + 8 * (px + 1);
            int    sy    = viewRect.Top + 10 * (py + 1);

            if (place != null && !place.EmptyStates)
            {
                ushort bg = place.Background;
                ushort fg = place.Foreground;

                fg = PtTransDoor(place);
                short op = space.GetTileBrightness(field, place, true);
                symImages.DrawImage(screen, sx, sy, GetSymImageIndex(bg), op);

                int fog = place.FogID;
                if (fog != PlaceID.pid_Undefined)
                {
                    symImages.DrawImage(screen, sx, sy, GetSymImageIndex((ushort)PlaceID.pid_Fog), op);
                }
                else
                {
                    if (fg != PlaceID.pid_Undefined)
                    {
                        bool trap = field.IsTrap(px, py);
                        if (!trap || (trap && (place.Trap_Discovered || GlobalVars.Debug_Divinity)))
                        {
                            symImages.DrawImage(screen, sx, sy, GetSymImageIndex(fg), op);
                        }
                    }
                }

                if (!field.IsBarrier(px, py) && mapRect.IsBorder(px, py))
                {
                    symImages.DrawImage(screen, sx, sy, StaticData.dbSymbols[(int)GetBorderSymbol(px, py)].ImageIndex, op);
                }
            }
        }
Exemplo n.º 29
0
        private void PrepareFlock()
        {
            try {
                IsLeader = true;
                Kinsfolks.Clear();

                NWCreature self = (NWCreature)fSelf;
                NWField    fld  = self.CurrentField;

                fNearKinsfolk     = null;
                fNearKinsfolkDist = AuxUtils.MaxInt;

                int num = fld.Creatures.Count;
                for (int i = 0; i < num; i++)
                {
                    NWCreature cr   = fld.Creatures.GetItem(i);
                    int        dist = MathHelper.Distance(cr.Location, self.Location);
                    if (!cr.Equals(self) && dist <= self.Survey && cr.CLSID == self.CLSID && fld.LineOfSight(self.PosX, self.PosY, cr.PosX, cr.PosY))
                    {
                        Kinsfolks.Add(cr);
                        if (fNearKinsfolkDist > dist)
                        {
                            fNearKinsfolkDist = dist;
                            fNearKinsfolk     = cr;
                        }
                        IsLeader = (IsLeader && self.Leadership > cr.Leadership);
                    }
                }

                if (FindGoalByKind(GoalKind.gk_Flock) == null)
                {
                    GoalEntity goal = CreateGoal(GoalKind.gk_Flock);
                    goal.Duration = 25;
                }
            } catch (Exception ex) {
                Logger.Write("BeastBrain.prepareFlock(): " + ex.Message);
            }
        }
Exemplo n.º 30
0
        public override void TileProc(int aX, int aY, ref bool aContinue)
        {
            NWField f = Field;

            Step(aX, aY);
            if (f.IsBarrier(aX, aY))
            {
                aContinue = false;
            }
            else
            {
                NWCreature c = (NWCreature)f.FindCreature(aX, aY);
                if (c != null)
                {
                    RaceID race = c.Entry.Race;
                    if (race == RaceID.crDefault || race == RaceID.crHuman)
                    {
                        c.ClearAbilities();
                        c.ClearSkills();
                    }
                }
            }
        }