示例#1
0
 public Actor(int x, int y, int ch, string name, TCODColor col)
 {
     this.x = x;
     this.y = y;
     this.ch = ch;
     this.col = col;
     this.name = name;
     this.blocks = true;
     this.attacker = null;
     this.destruct = null;
     this.ai = null;
     this.pick = null;
     this.contain = null;
     this.portal = null;
     if (name == "player")
     {
         this.gun = new Gun(10, 10);
     }
     else
     {
         this.gun = null;
     }
 }
示例#2
0
        public bool use(Gun owner, Actor wearer, Engine engine)
        {
            int x = 0, y = 0;

            engine.gui.message(TCODColor.lightBlue, "Picking a target...a dangerous game.");
            if (!engine.pickTile(ref x, ref y))
            {
                return false;
            }

            foreach (Actor mon in engine.actors)
            {
                if (mon.destruct != null && !mon.destruct.isDead() && mon.x == x && mon.y == y)
                {
                    engine.gui.message(TCODColor.lightBlue, "A gun shot strikes {0} for {1} pt of dmg", mon.name, dmg.ToString());
                    dmgdMon = mon;
                }
            }
            if (dmgdMon != null)
            {
                dmgdMon.destruct.takeDamage(dmgdMon, dmg);
            }
            else
            {
                engine.gui.message(TCODColor.lightBlue, "A miss. No good.");
            }
            return true;
        }