public Movement(Zone pzs, Zone pzd, Ulist pu, bool piatk) { if (pzs == null) { throw new Exception("Starting zone inconsistent(null) !"); } if (pzd == null) { throw new Exception("Destination zone inconsistent(null) !"); } if (pzd == pzs) { throw new Exception("Cannot travel there(=) !"); } if (pu == null) { throw new Exception("No units found in the atack(null) !"); } if (pu.calcNrtotal() == 0) { throw new Exception("No units found in the atack !"); } zs = pzs; zd = pzd; u = pu; int t = Math.Abs(zs.X - zd.X) + Math.Abs(zs.Y - zd.Y); tm = new TimeSpan(0, 0, t * 5); iatk = piatk; }
private void sendReturn(Zone pd, Ulist pu) { if (pu.calcNrtotal() == 0) { return; } map.movements.Add(new Movement(this, pd, pu, false)); }
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)); }
private void sendReturn(Zone pd, Ulist pu) { if (pu.calcNrtotal() == 0) return; map.movements.Add(new Movement(this, pd, pu, false)); }
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)); }