/**
* Attack the enemy from a distance
*/
@Override
@UIEventHandle(value = "Key_P", turn = "Player")
public void attack(Entity target)
{
if (target == null) { return; }
if (!(target instanceof Damageable)) { return; }
if (!target.isActive()) { return; }
if (getLevel().isThroughWall(getLocation(), target.getLocation())) { return; }
final int d = getLocation().dist(target.getLocation());
if (d > 15) { return; }
if (shots_taken + 1 > total_shots || move + 2 > speed)
{
getLevel().getUIInterface().selectTile(null);
return;
}
move += 2;
shots_taken += 1;
try
{
SoundStuff cam = new SoundStuff();
cam.AWP();
}
catch (IOException | LineUnavailableException | UnsupportedAudioFileException e)
{
e.printStackTrace();
}
((Damageable) target).takeDamage(40);
getLevel().getUIInterface().startAnimation(new CompoundAnimation.Sequential(new Laser(getLocation(), target.getLocation()), new TileDamage(target.getLocation())));
if (move >= speed && shots_taken >= total_shots)
getLevel().getUIInterface().selectTile(null);
}
PlayerSniper.java 文件源码
java
阅读 18
收藏 0
点赞 0
评论 0
项目:What-Happened-to-Station-7
作者:
评论列表
文章目录