Exemple #1
0
        public void receiveSupport(Movement pm)
        {
            if (pm.zoneD != this)
                throw new Exception("Wrong destination !");

            u = new Ulist(u.pnr + pm.units.pnr, u.wnr + pm.units.wnr, u.dnr + pm.units.dnr, u.bnr + pm.units.bnr, u.cnr + pm.units.cnr, u.pnr + pm.units.pnr);
            map.movements.Remove(pm);
        }
Exemple #2
0
        private void doBattle(Movement pm, int dProc, int aProc, int pdmax)
        {
            Ulist dtemp = u;
            Ulist atemp = pm.units;
            int htemp = hp;

            u.calcDeaths(dProc / 100);
            pm.units.calcDeaths(aProc / 100);
            damage(pm.units.calcAtk(), pdmax);

            sendReturn(pm.zoneS, pm.units);
            map.movements.Remove(pm);
            map.reports.Add(new Report(DateTime.Now, hp - htemp, this, dtemp, u, pm.zoneS, atemp, pm.units));
        }
Exemple #3
0
        public void receiveAtack(Movement pm)
        {
            if (pm.zoneD != this)
                throw new Exception("Wrong destination !");

            if (hp > 0)
            {
                int ud = units.calcDef(), ua = pm.zoneS.units.calcAtk();
                if (ud == 0)
                {
                    int htemp = hp;
                    damage(ua, 48);
                    map.reports.Add(new Report(DateTime.Now, htemp - hp, this, u, u, pm.zoneS, pm.units, pm.units));
                }
                else
                {
                    float rap = (float)(ua / ud);
                    if (rap < 0.1)
                        doBattle(pm, 100, 0, 0);
                    else if (rap < 0.25)
                        doBattle(pm, 90, 0, 0);
                    else if (rap < 0.5)
                        doBattle(pm, 75, 33, 0);
                    else if (rap < 0.75)
                        doBattle(pm, 67, 51, 5);
                    else if (rap < 1)
                        doBattle(pm, 60, 60, 10);
                    else if (rap < 1.1)
                        doBattle(pm, 51, 60, 11);
                    else if (rap < 1.25)
                        doBattle(pm, 45, 65, 12);
                    else if (rap < 1.5)
                        doBattle(pm, 35, 70, 15);
                    else if (rap < 1.75)
                        doBattle(pm, 25, 75, 20);
                    else if (rap < 2)
                        doBattle(pm, 15, 90, 25);
                    else if (rap < 2.5)
                        doBattle(pm, 10, 95, 30);
                    else if (rap > 2.5)
                        doBattle(pm, 0, 100, 33);
                }
            }
        }