コード例 #1
0
        public void RecruitMercenary(NWCreature collocutor, NWCreature mercenary, bool byMoney)
        {
            bool res = true;

            if (byMoney)
            {
                int hPrice = (int)mercenary.HirePrice;
                if (Money < hPrice)
                {
                    res = false;
                    GlobalVars.nwrWin.ShowText(GlobalVars.nwrWin, BaseLocale.GetStr(RS.rs_NoMoney));
                }
                else
                {
                    SubMoney(hPrice);
                    collocutor.AddMoney(hPrice);
                }
            }

            if (res)
            {
                mercenary.IsMercenary = true;

                int      dist = MathHelper.Distance(Location, mercenary.Location);
                ExtPoint pt   = GetNearestPlace(3, true);
                if ((dist > (int)Survey) && (!pt.IsEmpty))
                {
                    mercenary.CheckTile(false);
                    mercenary.SetPos(pt.X, pt.Y);
                    mercenary.CheckTile(true);
                }
            }
        }
コード例 #2
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;
            }
        }
コード例 #3
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;
            }
        }