From e0c5552d8fb12d520437ae39fabccee4e4c6858e Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 25 Jan 2020 23:30:48 +0100 Subject: [PATCH] Add elemental ailment and posion, blind & bleeding map mods. --- .../lunaris/listeners/MapInfoListener.java | 8 ++++++++ .../lunaris/settings/game/MapModsGUI.java | 14 +++++++++++++- src/main/resources/settings/game/map_mods.fxml | 17 +++++++++++------ 3 files changed, 32 insertions(+), 7 deletions(-) diff --git a/src/main/java/dev/tricht/lunaris/listeners/MapInfoListener.java b/src/main/java/dev/tricht/lunaris/listeners/MapInfoListener.java index 9d567ed..fe76fb8 100644 --- a/src/main/java/dev/tricht/lunaris/listeners/MapInfoListener.java +++ b/src/main/java/dev/tricht/lunaris/listeners/MapInfoListener.java @@ -29,6 +29,8 @@ public class MapInfoListener implements GameListener { private Pattern elementalAffix = Pattern.compile("(?i:Monsters reflect .*% of Elemental Damage)"); private Pattern physicalAffix = Pattern.compile("(?i:Monsters reflect .*% of Physical Damage)"); private Pattern recoveryAffix = Pattern.compile("(?i:Players have .*% less Recovery Rate of Life and Energy Shield)"); + private Pattern ailmentAffix = Pattern.compile("(?i:Monsters have .*% chance to Avoid Elemental Ailments)"); + private Pattern poisonAffix = Pattern.compile("(?i:Monsters have .*% chance to avoid Poison, Blind, and Bleeding)"); public MapInfoListener() { this.mapInfoResolver = new MapInfoResolver(); @@ -108,6 +110,12 @@ private List getMapModWarnings(Item item) { if (recoveryAffix.matcher(affix).matches() && isModWarningEnabled("low_recovery")) { warnings.add("Less recovery of Life and ES"); } + if (ailmentAffix.matcher(affix).matches() && isModWarningEnabled("avoidElementalAilments")) { + warnings.add("Avoid elemental ailments"); + } + if (poisonAffix.matcher(affix).matches() && isModWarningEnabled("avoidPoisonBlindAndBleeding")) { + warnings.add("Avoid poison, blind and bleeding"); + } } if (damageMods >= 2 && isModWarningEnabled("multi_dmg")) { warnings.add(String.format("Multi (%d) extra damage", damageMods)); diff --git a/src/main/java/dev/tricht/lunaris/settings/game/MapModsGUI.java b/src/main/java/dev/tricht/lunaris/settings/game/MapModsGUI.java index 1f4243e..22fafe4 100644 --- a/src/main/java/dev/tricht/lunaris/settings/game/MapModsGUI.java +++ b/src/main/java/dev/tricht/lunaris/settings/game/MapModsGUI.java @@ -26,6 +26,10 @@ public class MapModsGUI implements Initializable { private CheckBox multiDmgModWarning; @FXML private CheckBox tempChainsModWarning; + @FXML + private CheckBox avoidElementalAilments; + @FXML + private CheckBox avoidPoisonBlindAndBleeding; private HashMap propertyMap; @@ -58,6 +62,12 @@ public void initialize(URL url, ResourceBundle resourceBundle) { if (!PropertiesManager.containsKey("map_mod_warnings.low_recovery")) { PropertiesManager.writeProperty("map_mod_warnings.low_recovery", "1"); } + if (!PropertiesManager.containsKey("map_mod_warnings.avoid_elemental_ailments")) { + PropertiesManager.writeProperty("map_mod_warnings.avoid_elemental_ailments", "0"); + } + if (!PropertiesManager.containsKey("map_mod_warnings.avoid_poison_blind_and_bleed")) { + PropertiesManager.writeProperty("map_mod_warnings.avoid_poison_blind_and_bleed", "0"); + } propertyMap.put(eleReflModWarning, "map_mod_warnings.ele_refl"); propertyMap.put(physReflModWarning, "map_mod_warnings.phys_refl"); @@ -66,6 +76,8 @@ public void initialize(URL url, ResourceBundle resourceBundle) { propertyMap.put(multiDmgModWarning, "map_mod_warnings.multi_dmg"); propertyMap.put(tempChainsModWarning, "map_mod_warnings.tmp_chains"); propertyMap.put(lowRecoveryModWarning, "map_mod_warnings.low_recovery"); + propertyMap.put(avoidElementalAilments, "map_mod_warnings.avoid_elemental_ailments"); + propertyMap.put(avoidPoisonBlindAndBleeding, "map_mod_warnings.avoid_poison_blind_and_bleed"); for (Map.Entry entry :propertyMap.entrySet()) { @@ -76,7 +88,7 @@ public void initialize(URL url, ResourceBundle resourceBundle) { public void toggleCheckbox(ActionEvent actionEvent) { CheckBox source = (CheckBox) actionEvent.getSource(); - if(!propertyMap.containsKey(source)) { + if (!propertyMap.containsKey(source)) { return; } PropertiesManager.writeProperty(propertyMap.get(source), source.isSelected() ? "1" : "0"); diff --git a/src/main/resources/settings/game/map_mods.fxml b/src/main/resources/settings/game/map_mods.fxml index f6ddb62..777fbd4 100644 --- a/src/main/resources/settings/game/map_mods.fxml +++ b/src/main/resources/settings/game/map_mods.fxml @@ -21,12 +21,15 @@ - - - - - - + + + + + + + + + @@ -36,6 +39,8 @@ + +