Ejemplo n.º 1
0
        public EFMakeFireBall(Unit unit, IPair offset) : base(9, true)
        {
            DrawId = 3;

            unit_   = unit;
            offset_ = offset.Clone();
        }
Ejemplo n.º 2
0
        public const int STRENGTH = 50;  //  as 50 damage spell
        public MIHealBall(Unit caster, IPair destination) : base(80, caster)
        {
            radius_ = RADIUS;
            damage_ = -10;
            speed_  = 350;

            hurt_self_             = true;
            explode_enemy_         = false;
            explode_enemy_missile_ = false;

            Unit target = null;
            bool used = false;
            long min_distance = 0, temp_distance;

            foreach (Unit unit in Game.Unit_List)
            {
                if (unit == caster)
                {
                    continue;
                }
                if (used == false)
                {
                    used         = true;
                    target       = unit;
                    min_distance = (unit.Pos - Pos).LengthSquare();
                }
                else
                {
                    temp_distance = (unit.Pos - Pos).LengthSquare();
                    if (temp_distance < min_distance)
                    {
                        target       = unit;
                        min_distance = temp_distance;
                    }
                }
            }
            if (target != null)
            {
                destination.Clone(target.Pos);
            }

            IPair delta = destination - caster.Pos;

            move_vector_ = delta.Clone();
            move_vector_.ChangeLength(speed_);
            delta.ChangeLength(GameDef.UNIT_RADIUS * GameDef.PIXEL_SCALE);
            Pos.Clone(caster.Pos);
            Pos.Add(delta);
        }
Ejemplo n.º 3
0
 //  constructor
 public Unit(Player owner, IPair pos)
 {
     order_   = new Order();
     cd_list_ = new int[GameDef.SPELL_COUNT];
     for (int i = 0; i < GameDef.SPELL_COUNT; ++i)
     {
         cd_list_[i] = 0;
     }
     speed_       = 350;
     hp_          = GameDef.UNIT_MAX_HP * GameDef.PIXEL_SCALE;
     mp_          = 0;
     pos_         = pos.Clone();
     repusle_     = new IPair();
     last_damage_ = owner;
     Owner        = owner;
     Radius       = GameDef.UNIT_RADIUS;
 }