From 35f92798861155f66a0f4812c1612c81755814ae Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 19 May 2021 15:51:51 -0400 Subject: [PATCH] adding incendiary checks --- src/xyz/soper/arty/item/Mortar.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/xyz/soper/arty/item/Mortar.java b/src/xyz/soper/arty/item/Mortar.java index db6e496..277f597 100644 --- a/src/xyz/soper/arty/item/Mortar.java +++ b/src/xyz/soper/arty/item/Mortar.java @@ -106,6 +106,8 @@ public class Mortar { public int getFailureType(Shell shell){ if(isFailure(shell)){ Random random = new Random(block.getWorld().getSeed() + System.currentTimeMillis()); + double maxDouble; + double randDouble = random.nextDouble(); //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){ 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){