add min hp to fighting

This commit is contained in:
RedSparr0w
2019-10-23 14:04:49 +13:00
parent 91da9746c4
commit 10b9377b94
4 changed files with 41 additions and 7 deletions
+8 -2
View File
@@ -1,8 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="3ab8e8a0-ccfd-4b0b-9547-98173085dc38" name="Default Changelist" comment="">
<list default="true" id="14d0b690-21f2-4a9c-b8cf-803e9cc87ab5" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/ParaScript/data/Variables.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/ParaScript/data/Variables.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/ParaScript/data/variables/Ores.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/ParaScript/data/variables/Ores.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/ParaScript/strategies/Fighting.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/ParaScript/strategies/Fighting.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/ParaScript/strategies/MakeArrowShafts.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/ParaScript/strategies/MakeArrowShafts.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/ParaScript/strategies/Mine.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/ParaScript/strategies/Mine.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/ParaScript/ui/UI.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/ParaScript/ui/UI.java" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
@@ -90,7 +96,7 @@
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="3ab8e8a0-ccfd-4b0b-9547-98173085dc38" name="Default Changelist" comment="" />
<changelist id="14d0b690-21f2-4a9c-b8cf-803e9cc87ab5" name="Default Changelist" comment="" />
<created>1570572301532</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
+2 -1
View File
@@ -29,13 +29,14 @@ public class Variables {
public static String woodcutting_method = "Fletch";
// Mining
public static Ores mining_ore_selected = Ores.COPPER_TIN;
public static Ores mining_ore_selected = Ores.ESSENCE;
public static String mining_method = "Bank";
// Fighting
public static FightingNpcs fighting_npc_selected = FightingNpcs.CHICKEN;
public static boolean fighting_bury_bones = true;
public static int[] fighting_item_ids = new int[]{};
public static int fighting_minimum_hitpoints = 0;
// Thieving
public static ThievingNpcs thieving_npc_selected = ThievingNpcs.MAN_WOMAN;
@@ -7,6 +7,7 @@ import org.rev317.min.api.methods.Inventory;
import org.rev317.min.api.methods.Npcs;
import org.rev317.min.api.methods.Players;
import org.rev317.min.api.wrappers.Npc;
import org.rev317.min.api.wrappers.Player;
public class Fighting implements Strategy {
private Npc victim;
@@ -14,11 +15,13 @@ public class Fighting implements Strategy {
@Override
public boolean activate() {
victim = victim(); // set the local Variable
Player myPlayer = Players.getMyPlayer();
if (Variables.running
&& victim != null
&& !Players.getMyPlayer().isInCombat()
&& Players.getMyPlayer().getAnimation() == -1
&& !Inventory.isFull()) {
&& !myPlayer.isInCombat()
&& myPlayer.getAnimation() == -1
&& !Inventory.isFull()
&& myPlayer.getHealth() > Variables.fighting_minimum_hitpoints) {
Variables.setStatus("fighting");
return true;
}
+25 -1
View File
@@ -39,8 +39,8 @@ public class UI extends JFrame {
private JLabel lblFightingNpcCustomID = new JLabel("Custom NPC IDs");
private JTextField fightingNpcCustomID = new JTextField();
private JCheckBox fightingBuryBones = new JCheckBox();
private JLabel lblFightingItemCustomID = new JLabel("Pickup Item IDs");
private JTextField fightingItemCustomID = new JTextField();
private JTextField fightingMinimumHitpoints = new JTextField();
// Thieving
private JComboBox thievingNpcSelect = new JComboBox();
@@ -350,6 +350,7 @@ public class UI extends JFrame {
fightingPanel.add(fightingBuryBones);
// Custom items to pickup
JLabel lblFightingItemCustomID = new JLabel("Pickup Item IDs");
lblFightingItemCustomID.setForeground(Color_WhiteSmoke);
lblFightingItemCustomID.setBounds(20, 120, 150, 20);
fightingPanel.add(lblFightingItemCustomID);
@@ -376,6 +377,29 @@ public class UI extends JFrame {
});
fightingPanel.add(fightingItemCustomID);
// Minimum hitpoints to start fighting
JLabel lblFightingMinimumHitpoints = new JLabel("Minimum hitpoints");
lblFightingMinimumHitpoints.setForeground(Color_WhiteSmoke);
lblFightingMinimumHitpoints.setBounds(200, 120, 150, 20);
fightingPanel.add(lblFightingMinimumHitpoints);
fightingMinimumHitpoints.setBounds(200, 140, 150, 20);
fightingMinimumHitpoints.addFocusListener(new FocusListener() {
@Override
public void focusGained(FocusEvent e) {
// we don't need to do anything here
}
@Override
public void focusLost(FocusEvent e) {
try {
Variables.fighting_minimum_hitpoints = Integer.parseInt(fightingMinimumHitpoints.getText());
} catch (Exception ಠ_ಠ) {
Variables.fighting_minimum_hitpoints = 0;
}
}
});
fightingPanel.add(fightingMinimumHitpoints);
/*
* Thieving Panel
*/