public Training(Unit pu, Zone pz)
 {
     u = pu;
     z = pz;
     int s = (int)u.GetType().GetField("time").GetRawConstantValue();
     t = new TimeSpan(0, 0, s);
 }
Beispiel #2
0
        public void sendAtack(Zone zs,Zone zd, Ulist ul)
        {
            if (zs.owner != this)
                throw new Exception("Cannot send troops from this zone(not owned by this player) !");
            if (ul == null)
                throw new Exception("No army detected(null) !");

            zs.sendAtack(zd, ul);
        }
Beispiel #3
0
        public Report(DateTime pdt, int pdmg, Zone pzd, Ulist pdbef, Ulist pdaf, Zone pza, Ulist pabef, Ulist paaf)
        {
            if (pdt > DateTime.Now)
                throw new Exception("Invalid record date !");

            dt = pdt;
            dmg = pdmg;
            zd = pzd;
            daf = pdaf;
            dbef = pdbef;
            za = pza;
            abef = pabef;
            aaf = paaf;
        }
Beispiel #4
0
        public void trainUnit(Zone z, Unit u)
        {
            if (u == null)
                throw new Exception("Cannot train that unit(null) !");

            z.startTraining(u);
        }
Beispiel #5
0
 private void sendReturn(Zone pd, Ulist pu)
 {
     if (pu.calcNrtotal() == 0)
         return;
     map.movements.Add(new Movement(this, pd, pu, false));
 }
Beispiel #6
0
        public void sendSupport(Zone pd, Ulist pu)
        {
            if (pu.bnr < 0 || pu.cnr < 0 || pu.wnr < 0 || pu.pnr < 0 || pu.dnr < 0 || pu.snr < 0)
                throw new Exception("Cannot send less than 0 units !");
            if (pu.calcNrtotal() == 0)
                throw new Exception("Must send at least 1 unit !");
            if (pu.bnr > u.bnr || pu.cnr > u.cnr || pu.wnr > u.wnr || pu.dnr > u.dnr || pu.pnr > u.pnr || pu.snr > u.snr)
                throw new Exception("Cannot send more units than you have !");

            u = new Ulist(u.pnr - pu.pnr, u.wnr - pu.wnr, u.dnr - pu.dnr, u.bnr - pu.bnr, u.cnr - pu.cnr, u.pnr - pu.pnr);
            map.movements.Add(new Movement(this, pd, pu, false));
        }