collision
This commit is contained in:
@@ -593,8 +593,12 @@ public class Worm {
|
||||
subtractActionPoints(cost);
|
||||
}
|
||||
|
||||
public void collision() {
|
||||
|
||||
public void collision(Worm smallestWorm, Worm largestWorm) {
|
||||
long total = 1 + (new Random().nextLong() * (10 - 1));
|
||||
long loseSmallest = total/(largestWorm.getOrientation()/(smallestWorm.getOrientation()+largestWorm.getOrientation()));
|
||||
long loseLargest = total - loseSmallest;
|
||||
smallestWorm.decreaseHitPoints(loseSmallest);
|
||||
largestWorm.decreaseHitPoints(loseLargest);
|
||||
}
|
||||
|
||||
//===================================================================================
|
||||
@@ -769,7 +773,7 @@ public class Worm {
|
||||
//===================================================================================
|
||||
|
||||
@Basic @Raw
|
||||
public long gethitPoints() {
|
||||
public long getHitPoints() {
|
||||
return this.hitPoints;
|
||||
}
|
||||
|
||||
@@ -782,6 +786,10 @@ public class Worm {
|
||||
|
||||
private long hitPoints;
|
||||
|
||||
public void decreaseHitPoints(long value) {
|
||||
setHitPoints(getHitPoints() - value);
|
||||
}
|
||||
|
||||
//===================================================================================
|
||||
// endregion
|
||||
}
|
||||
|
Reference in New Issue
Block a user