public static void applay(int amount, Shot shot, World world, Monster monster) { Position p = monster.position; if (p == null || monster.state != Monster.State.alive) { return; } double probability = getProbability(amount); if (MyRandom.NextDouble() > probability) { return; } Monster closest_monster = world.getClosestMonster(monster.position, monster); if (closest_monster != null && closest_monster.position.distanceTo(monster.position) < radius_constant) { //create new shot Shot s = new Shot(); s.start_position = (Position)monster.position.Clone(); s.position = (Position)s.start_position.Clone(); s.curve_position = (Position)shot.start_position.Clone(); s.target = closest_monster; s.aspects = new List <Aspect>(); foreach (Aspect a in shot.aspects) { s.aspects.Add((Aspect)a.Clone()); if (a.aspectType == Type.GetType("AspectType_chain")) { s.aspects[s.aspects.Count - 1].amount /= 10; } } s.damage = shot.damage; s.max_ticks = 10; Game.world.shots.Add(s); } }
public Shot(Monster monster, Gem gem) { target = monster; start_position = new Position(gem.coord); double rotation = MyRandom.NextDouble() * Math.PI * 2; curve_position = new Position(start_position.x + Math.Sin(rotation) * 4, start_position.y + Math.Cos(rotation) * 4); aspects = new List <Aspect>(); foreach (Aspect a in gem.aspects) { aspects.Add((Aspect)a.Clone()); } damage = gem.getDamage(); max_ticks = (int)((double)1 / gem.getAttackSpeed() - 2); position = (Position)start_position.Clone(); updatePosition(); }