mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-06-27 11:44:42 +02:00
Merge branch 'master' of https://github.com/inf112-v20/Fiasko
This commit is contained in:
@ -452,7 +452,8 @@ public class Board {
|
||||
* @param laser the wall laser that is being fired
|
||||
*/
|
||||
private void fireOneWallLaser(BoardElementContainer<Wall> laser){
|
||||
Position hitPosition = lineForTheLaser(Direction.getReverseDirection(laser.getElement().getDirection()),laser.getPosition());
|
||||
Position hitPosition = lineForTheLaser(Direction.getReverseDirection(laser.getElement().getDirection()),
|
||||
laser.getPosition());
|
||||
if(getRobotOnPosition(hitPosition)!=null){
|
||||
laserDamage(laser.getElement().getWallType(),robots.get(getRobotOnPosition(hitPosition)));
|
||||
}
|
||||
@ -492,7 +493,8 @@ public class Board {
|
||||
*/
|
||||
private Position lineForTheLaser(Direction direction, Position startPosition){
|
||||
Position newPosition = getNewPosition(startPosition,direction);
|
||||
if(!isValidPosition(newPosition) || moveIsStoppedByWall(startPosition,newPosition,direction)){
|
||||
if(!isValidPosition(newPosition) || moveIsStoppedByWall(startPosition,newPosition,direction) ||
|
||||
getRobotOnPosition(startPosition)!= null){
|
||||
return startPosition;
|
||||
}
|
||||
else if(getRobotOnPosition(newPosition)!=null){
|
||||
|
Reference in New Issue
Block a user