public override void Use(Unit user) { if (user.UnitSide != UnitSides.Good) user.CastEffect(ViscousSlime, user); base.Use(user); }
/// <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; }
public override void Use(Unit user) { if (!user.IsVisible) return; user.TeleportTo(destinationCell); base.Use(user); }
/// <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)); }
public override void Use(Unit user) { if (!IsActive || user.ObjectType != ObjectTypes.Slug || !user.IsVisible || !user.IsAlive) return; ((Slug)user).CollectDrop(this); base.Use(user); }
public void CastEffect(ushort effectID, Unit target) { EffectEntry effectEntry = DBStores.EffectStore[effectID]; Effect effect = new Effect(effectEntry, target, this); effect.Cast(); }
/// <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>(); }
/// <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); }
public Effect(EffectEntry effectEntry, Unit target, Unit caster) { this.effectInfo = effectEntry; this.target = target; this.caster = caster; targetsList = new List<Unit>(); }
public CustomMovement(Unit unit) : base(unit) { }
/// <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) { }
protected override void UnitCollision(Unit unit) { // Do not kill with shield effect if (!this.HasEffectType(EffectTypes.Shield)) unit.KillUnit(this); }
/// <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; }
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; }
protected override void UnitCollision(Unit unit) { unit.KillUnit(this); }
/// <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; }
/// <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) { }
protected override void UnitCollisionEnds(Unit unit) { if (this.HasEffectType(EffectTypes.Shield)) { EffectHolder holder = this.effectList.GetHolder(11); if (holder != null) RemoveEffect(holder); } }
private bool AddTarget(Unit target) { if (targetsList.Contains(target)) { return false; } else { targetsList.Add(target); return true; } }
public virtual void Use(Unit user) { // Deactivate if needed if (!HasFlags(GridObjectFlags.AlwaysActive)) { GridObjectState = GridObjectStates.Inactive; this.recentlyUsed = true; activationTimer = activationTime; } }