Ejemplo n.º 1
0
 void movemob(mob m, int tentx, int tenty)
 {
     if (m.isplayer)
     {
         m.posx = tentx; m.posy = tenty;
         moveplayer();
     }
     else
     {
         if (m.posx != tentx || m.posy != tenty)
         {
             //debug move onto bomb?
             if (map.itemgrid[tentx, tenty] != null)
             {
                 item_instance i = map.itemgrid[tentx, tenty];
                 log.Printline("WARNING MOB MOVING ONTO " +
                               Tilestuff.tilestring[(int)i.tile + 2]
                               );
             }
             //end debug
             map.itemgrid[tentx, tenty]   = map.itemgrid[m.posx, m.posy];
             map.itemgrid[m.posx, m.posy] = null;
             m.posx = tentx; m.posy = tenty;
         }
     }
 }
Ejemplo n.º 2
0
 void detonate(int xx, int yy)
 {
     for (int y = -1; y < 2; y++)
     {
         for (int x = -1; x < 2; x++)
         {
             int sqx = xx + x; int sqy = yy + y;
             if (sqx >= 0 && sqy >= 0 && sqx < map.width && sqy < map.height)
             {
                 //Debug.Log("ok");
                 map.gridflashcolour[sqx, sqy] = new Color(1.0f, 0f, 0f, 0.5f);
                 map.gridflashtime[sqx, sqy]   = Time.time + 0.5f;
                 item_instance i = map.itemgrid[sqx, sqy];
                 if (player.posx == sqx && player.posy == sqy)
                 {
                     FloatingDamage(player.mob, player.mob, -5, "explosion", true);
                 }
                 if (i != null)
                 {
                     if (i.ismob)
                     {
                         FloatingDamage(i.mob, i.mob, -5, "explosion", true);
                     }
                 }
             }
         }
     }
     //should maybe chain explosions
 }
Ejemplo n.º 3
0
    bool trytomove(mob m, int deltax, int deltay)//, int rotdir, bool coasting = false)
    {
        bool didsomething = false;

        if (deltax == 1)
        {
            m.reversesprite = false;
        }
        else if (deltax == -1)
        {
            m.reversesprite = true;
        }

        int tentx = m.posx + deltax;
        int tenty = m.posy + deltay;

        //if tentative spot is off map, return
        if (tentx < 0 || tentx >= map.width || tenty < 0 || tenty >= map.height)
        {
            return(false);
        }

        //if tentative spot is goodie hut, let's open it
        if (m == player.mob && map.buildings[tentx, tenty] == Etilesprite.BUILDINGS_GOODIE_HUT && map.itemgrid[tentx, tenty] == null)
        {
            if (!map.havewehadbroomyet && lil.randi(1, 100) <= 20)
            {
                log.Printline("o shit waddup, heer come dat broom!", Color.cyan);
                log.Printline("Bristleboi is on the payroll nao. 10g/turn.", Color.cyan);
                mob mmm = CreateMob(Emobtype.broom, tentx, tenty);
                player.herogoldupkeep += mmm.archetype.upkeepgold;
            }
            else
            {
                log.Printline("You find a bunch of gold", Color.yellow);
                player.gold += 200;
            }
            map.buildings[tentx, tenty] = Etilesprite.EMPTY;
        }


        //if tentative spot is enemy city, attack it
        if (map.buildings[tentx, tenty] == Etilesprite.BUILDINGS_CITY ||
            map.buildings[tentx, tenty] == Etilesprite.BUILDINGS_BARBARIAN_CAMP ||
            map.buildings[tentx, tenty] == Etilesprite.BUILDINGS_BARBARIAN_CITADEL)
        {
            Ccity cc = map.citythathasinfluence[tentx, tenty];
            if (cc != null && (m.hostile_toenemies_currently && !cc.isfrenzleecity ||
                               m.hostile_toplayer_currently && cc.isfrenzleecity))
            {
                MobAttacksCity(m, cc);
                didsomething = true;
                goto okhadfun;
            }
        }


        //if tentative spot has player and we are bad men, attack him!
        if (m.hostile_toplayer_currently && player.posx == tentx && player.posy == tenty)
        {
            MobAttacksMob(m, player.mob);
            didsomething = true;
            goto okhadfun;
        }

        //if spot is empty, move
        if (map.passablecheck(tentx, tenty, m))
        {
            movemob(m, tentx, tenty);
            didsomething = true;
            goto okhadfun;
        }

        //if spot has mob and it's one we hate, attack it
        item_instance i = map.itemgrid[tentx, tenty]; //1.is there a mob there:

        if (i != null && i.ismob &&
            (m.hostile_toenemies_currently && i.mob.hostile_toplayer_currently ||
             m.hostile_toplayer_currently && i.mob.hostile_toenemies_currently))
        {
            MobAttacksMob(m, i.mob);
            didsomething = true;
        }


okhadfun:

        if (m.isplayer)
        {
            TimeEngine = CradleOfTime.player_is_done; return(true);
        }
        return(didsomething);
    }