Beispiel #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);
                }
            }
        }
Beispiel #2
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;
            }
        }