Ejemplo n.º 1
0
        public override void Use(Unit user)
        {
            if (user.UnitSide != UnitSides.Good)
                user.CastEffect(ViscousSlime, user);

            base.Use(user);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the MovementGenerator class.
        /// </summary>
        /// <param name="unit">The owner of the generator instance.</param>
        public MovementGenerator(Unit unit)
        {
            this.mover = unit;
            generatorType = MovementGeneratorType.None;

            this.mover.LocationChanged += OnLocationChanged;
            this.mover.Relocated += mover_Relocated;
        }
Ejemplo n.º 3
0
        public override void Use(Unit user)
        {
            if (!user.IsVisible)
                return;
            user.TeleportTo(destinationCell);

            base.Use(user);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the ChasingMovement class.
 /// </summary>
 /// <param name="unit">The owner of the generator instance.</param>
 public ChasingMovement(Unit unit)
     : base(unit)
 {
     this.pathFindingTimer = PATHFINDING_TIME;
     this.state = MotionStates.None;
     this.victim = World.PlayForm.Player;
     this.pathFinder = new PathFinder(Map.Instance.GetCell(this.mover.Position.Location),
         Map.Instance.GetCell(this.victim.Position.Location));
 }
Ejemplo n.º 5
0
        public override void Use(Unit user)
        {
            if (!IsActive || user.ObjectType != ObjectTypes.Slug || !user.IsVisible || !user.IsAlive)
                return;

            ((Slug)user).CollectDrop(this);

            base.Use(user);
        }
Ejemplo n.º 6
0
Archivo: Unit.cs Proyecto: scerdam/Maze
        public void CastEffect(ushort effectID, Unit target)
        {
            EffectEntry effectEntry = DBStores.EffectStore[effectID];

            Effect effect = new Effect(effectEntry, target, this);
            effect.Cast();
        }
Ejemplo n.º 7
0
Archivo: Unit.cs Proyecto: scerdam/Maze
 /// <summary>
 /// Initializes a new instance of the EffectCollection class.
 /// </summary>
 /// <param name="owner">The <see cref="Unit"/> instance whom all these effect will belong to.</param>
 public EffectCollection(Unit owner)
 {
     this.owner = owner;
     effectList = new List<EffectHolder>();
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Ovverrides <see cref="GridObject.Use"/>.
        /// </summary>
        public override void Use(Unit user)
        {
            if (!user.IsVisible || !user.IsAlive)
                return;

            if (!bonusEffect.IsOpen)
            {

                if (user.UnitType == UnitTypes.Slug)
                    ((Slug)user).CollectHiddenBonus(bonusEffect.EffectID);
                else
                    return;
            }
            else
            {
                user.CastEffect(bonusEffect.EffectID, user);
            }

            base.Use(user);
        }
Ejemplo n.º 9
0
        public Effect(EffectEntry effectEntry, Unit target, Unit caster)
        {
            this.effectInfo = effectEntry;
            this.target = target;
            this.caster = caster;

            targetsList = new List<Unit>();
        }
Ejemplo n.º 10
0
 public CustomMovement(Unit unit)
     : base(unit)
 {
 }
Ejemplo n.º 11
0
Archivo: Unit.cs Proyecto: scerdam/Maze
 /// <summary>
 /// Called when the unit goes away from the collision with another unit.
 /// </summary>
 /// <param name="unit">The source of the collision.</param>
 protected virtual void UnitCollisionEnds(Unit unit)
 {
 }
Ejemplo n.º 12
0
Archivo: Slug.cs Proyecto: scerdam/Maze
 protected override void UnitCollision(Unit unit)
 {
     // Do not kill with shield effect
     if (!this.HasEffectType(EffectTypes.Shield))
         unit.KillUnit(this);
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Initializes a new instance of the RandomMovementGenerator class.
 /// </summary>
 /// <param name="unit">The owner of the generator</param>
 public RandomMovementGenerator(Unit unit)
     : base(unit)
 {
     this.generatorType = MovementGeneratorType.Random;
 }
Ejemplo n.º 14
0
        public static Image GetUnitImage(Unit unit)
        {
            // Separate method for Slug
            if (unit.ObjectType == ObjectTypes.Slug)
                return GetSlugImage((Slug)unit);

            // Do not draw Invisible and Dead units
            if (!unit.IsVisible || !unit.IsAlive)
                return null;

            switch (unit.UnitType)
            {
                case UnitTypes.Deimos:
                    return DeimosImage;
                case UnitTypes.Phobos:
                    return PhobosImage;
                case UnitTypes.SlugClone:
                    return SlugImage;
            }

            // Else nothing to draw
            return null;
        }
Ejemplo n.º 15
0
 protected override void UnitCollision(Unit unit)
 {
     unit.KillUnit(this);
 }
Ejemplo n.º 16
0
Archivo: Unit.cs Proyecto: scerdam/Maze
        /// <summary>
        /// The unit changes the death state of another unit by force, getting a reward for it.
        /// </summary>
        /// <param name="victim">The target unit</param>
        /// <returns><c>true</c>, if a victim bacame dead; otherwise, <c>false</c>.</returns>
        public bool KillUnit(Unit victim)
        {
            if (victim.HasUnitFlags(UnitFlags.CanNotBeKilled))
                return false;

            victim.SetDeathState(DeathStates.Dead);

            // TODO:
            // Kind of reward for the killer

            return true;
        }
Ejemplo n.º 17
0
Archivo: Unit.cs Proyecto: scerdam/Maze
 /// <summary>
 /// Called when the unit first time came in contact with another unit.
 /// </summary>
 /// <param name="unit">The source of the collision.</param>
 protected virtual void UnitCollisionBegins(Unit unit)
 {
 }
Ejemplo n.º 18
0
Archivo: Slug.cs Proyecto: scerdam/Maze
 protected override void UnitCollisionEnds(Unit unit)
 {
     if (this.HasEffectType(EffectTypes.Shield))
     {
         EffectHolder holder = this.effectList.GetHolder(11);
         if (holder != null)
             RemoveEffect(holder);
     }
 }
Ejemplo n.º 19
0
 private bool AddTarget(Unit target)
 {
     if (targetsList.Contains(target))
     {
         return false;
     }
     else
     {
         targetsList.Add(target);
         return true;
     }
 }
Ejemplo n.º 20
0
 public virtual void Use(Unit user)
 {
     // Deactivate if needed
     if (!HasFlags(GridObjectFlags.AlwaysActive))
     {
         GridObjectState = GridObjectStates.Inactive;
         this.recentlyUsed = true;
         activationTimer = activationTime;
     }
 }