adding incendiary checks
parent
b5edf54e1f
commit
35f9279886
|
@ -106,6 +106,8 @@ public class Mortar {
|
||||||
public int getFailureType(Shell shell){
|
public int getFailureType(Shell shell){
|
||||||
if(isFailure(shell)){
|
if(isFailure(shell)){
|
||||||
Random random = new Random(block.getWorld().getSeed() + System.currentTimeMillis());
|
Random random = new Random(block.getWorld().getSeed() + System.currentTimeMillis());
|
||||||
|
double maxDouble;
|
||||||
|
|
||||||
double randDouble = random.nextDouble();
|
double randDouble = random.nextDouble();
|
||||||
//TODO: compare random double and create an algo to determine type of failure.
|
//TODO: compare random double and create an algo to determine type of failure.
|
||||||
}
|
}
|
||||||
|
@ -119,7 +121,17 @@ public class Mortar {
|
||||||
*/
|
*/
|
||||||
private boolean isFailure(Shell shell){
|
private boolean isFailure(Shell shell){
|
||||||
Random random = new Random(block.getWorld().getSeed() + System.currentTimeMillis());
|
Random random = new Random(block.getWorld().getSeed() + System.currentTimeMillis());
|
||||||
return random.nextDouble() < failMultiplier*shell.failChance;
|
if(shell.incendiaryType && !incendiaryCapable) return random.nextDouble() < 3*failMultiplier*shell.failChance;
|
||||||
|
else return random.nextDouble() < failMultiplier*shell.failChance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param shell Shell to test.
|
||||||
|
* @return True if the shell and mortar are compatible.
|
||||||
|
*/
|
||||||
|
public boolean incendiaryCompatible(Shell shell){ //TODO: check if this is right
|
||||||
|
return incendiaryCapable || !shell.incendiaryType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isMortar(Block block){
|
public static boolean isMortar(Block block){
|
||||||
|
|
Loading…
Reference in New Issue