public override Wait NormalTurn(Turn turn) { HashSet <Creature> targets = new HashSet <Creature>(); List <Tile> summonArea = new List <Tile>(); Turns++; foreach (var part in Parts) { targets.AddRange(part.Tile.Creatures); if ((part.GetHashCode() + Turns) % 14 == 0) { summonArea.Add(part.Tile); } } SkillUtil.TrySpawnCryptDust(this, summonArea, Random); Drift(0, 1, Parts.Count / 4); Drift(0, -1, Parts.Count / 4); Drift(1, 0, Parts.Count / 4); Drift(-1, 0, Parts.Count / 4); return(base.NormalTurn(turn)); }
public Forcefield SetElement(Element element) { WeakElement = element; this.ClearEffects(); Effect.Apply(new EffectStatPercent(this, WeakElement.DamageRate, 1.0)); foreach (var otherElement in Element.MagicalElements.Where(e => SkillUtil.IsElement(WeakElement, element))) { Effect.Apply(new EffectStatPercent(this, otherElement.DamageRate, -1.0)); } return(this); }
public static IEnumerable <Wait> Spark(Creature user, Random random, AttackDelegate attack) { var lightning = SpriteLoader.Instance.AddSprite("content/lightning"); IEnumerable <Tile> targetTiles = GetFrontierTiles(user); HashSet <Creature> targets = new HashSet <Creature>(); yield return(user.WaitSome(10)); foreach (Tile tile in targetTiles) { targets.AddRange(tile.Creatures.Where(creature => creature != user)); } List <Wait> waitForDamage = new List <Wait>(); foreach (var target in targets) { new LightningSpark(user.World, lightning, user.VisualPosition() + user.Mask.GetRandomPixel(random), target.VisualPosition() + target.Mask.GetRandomPixel(random), 5); var wait = user.Attack(target, SkillUtil.SafeNormalize(target.VisualTarget - user.VisualTarget), attack); waitForDamage.Add(wait); } yield return(new WaitAll(waitForDamage)); }
public static IEnumerable <Creature> GetNearbyCircular(Creature creature, CascadeHelper cascade, int radius, int count) { var creatures = SkillUtil.GetCircularArea(creature, radius).SelectMany(x => x.Creatures).Distinct().Where(x => cascade.CanHit(x)); return(creatures.Shuffle(Random).Take(count)); }