Skip to content

Commit

Permalink
0.7.9
Browse files Browse the repository at this point in the history
- Updated burst weapon functionality
- Added capability to simulate refire canceling on burst weapons
  • Loading branch information
GottFaust committed Jul 19, 2015
1 parent 648977c commit 82078b8
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 67 deletions.
2 changes: 1 addition & 1 deletion src/etc/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public class Constants {

/** Frame Title **/
public static final String APP_TITLE = "Warframe Weapon DPS Calculator";
public static final String APP_VERSION = "v0.7.8";
public static final String APP_VERSION = "v0.7.9";

/** ToolTips **/
public static final String NAME_TOOL_TIP = "The weapon's name.";
Expand Down
42 changes: 22 additions & 20 deletions src/main/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ public class Main {
public static String weaponMode = "";
protected static String damageType = "";
protected static double chargeTime = 0.0;
protected static double burstFireRate = 0.0;
protected static double fireRate = 0.0;
protected static double reloadTime = 0.0;
protected static double critChance = 0.0;
Expand All @@ -172,7 +171,6 @@ public class Main {
public static double finalCritChance = 0.0;
public static double finalCritMult = 0.0;
public static double finalFireRate = 0.0;
protected static double finalBurstFireRate = 0.0;
public static double finalReloadTime = 0.0;
public static double finalProjectileCount = 0.0;
protected static double finalFirstShotDamageMult = 1.0;
Expand Down Expand Up @@ -459,7 +457,6 @@ protected static void clearValues(){
weaponMode = "";
damageType = "";
chargeTime = 0.0;
burstFireRate = 0.0;
raw.clear();
impact.clear();
puncture.clear();
Expand Down Expand Up @@ -511,7 +508,6 @@ protected static void clearValues(){
finalCritChance = 0.0;
finalCritMult = 0.0;
finalFireRate = 0.0;
finalBurstFireRate = 0.0;
finalReloadTime = 0.0;
finalProjectileCount = 0.0;
finalFirstShotDamageMult = 1.0;
Expand Down Expand Up @@ -542,7 +538,6 @@ protected static void getBaseValues(){
weaponMode = selectedWeapon.getWeaponMode();
damageType = selectedWeapon.getDamageType();
chargeTime = selectedWeapon.getChargeTime();
burstFireRate = selectedWeapon.getBurstFireRate();
fireRate = selectedWeapon.getFireRate();
reloadTime = selectedWeapon.getReloadTime();
critChance = selectedWeapon.getCritChance();
Expand Down Expand Up @@ -1350,15 +1345,6 @@ protected static void calculateFinals(){
finalDamageMult += damageMult*fireRateMods.get(i);
continuousDrainRate += localContinuousDrainRate*fireRateMods.get(i);
}
}else if(weaponMode.equals(Constants.BURST)){
finalFireRate = fireRate;
finalBurstFireRate = burstFireRate;
for(int i = 0; i < fireRateMods.size(); i++){
finalBurstFireRate += burstFireRate*fireRateMods.get(i);
}
for(int i = 0; i < fireRateMods.size(); i++){
finalFireRate += fireRate*fireRateMods.get(i);
}
}else{
finalFireRate = fireRate;
for(int i = 0; i < fireRateMods.size(); i++){
Expand All @@ -1367,7 +1353,7 @@ protected static void calculateFinals(){
}

//This is completely retarded, but also the current case
if(weaponMode.equals(Constants.SEMI_AUTO) || weaponMode.equals(Constants.BURST)){
if(weaponMode.equals(Constants.SEMI_AUTO)){
if(finalFireRate > 10.0){
finalFireRate = 10.0;
}
Expand Down Expand Up @@ -1538,10 +1524,19 @@ protected static void calculateFinals(){
finalCritShots = (finalCritShots / continuousDrainRate) * CONTINUOUS_MULT;
finalIterationTime = (finalMag / continuousDrainRate) + finalReloadTime;
}else if(weaponMode.equals(Constants.BURST)){
double numBursts = finalMag / burstCount;
double rawFireTime = numBursts / finalFireRate;
double rawBurstTime = burstCount / finalBurstFireRate;
finalIterationTime = (rawBurstTime * numBursts) + rawFireTime + finalReloadTime;
if(selectedWeapon.isRefireCanceled()){
finalFireRate += fireRate;
}
double burstDelay = 0.05;
double burstMS = (60.0/finalFireRate)/60.0;
double burstIterationMS = (burstMS*burstCount)+burstDelay;
finalFireRate = (60.0/burstIterationMS)/60.0;
if(finalFireRate > 10.0){
finalFireRate = 10.0;
}
double numBursts = finalMag/burstCount;
double rawFireTime = numBursts/finalFireRate;
finalIterationTime = rawFireTime+finalReloadTime;
}else if(weaponMode.equals(Constants.FULL_AUTO_RAMP_UP) || weaponMode.equals(Constants.FULL_AUTO_RAMP_UP)){
double baseFireDelay = 60.0 / finalFireRate / 60.0;
double firstFireDelay = baseFireDelay * 5;
Expand Down Expand Up @@ -2146,7 +2141,14 @@ protected static void updateOutput(){
output.append("\nTotal Ammo :: "+(finalMag+finalAmmo));
output.append("\nCrit Chance :: "+f.format(finalCritChance*100.0)+"%");
output.append("\nCrit Damage Multiplier :: "+f.format(finalCritMult*100.0)+"%");
output.append("\nFire Rate :: "+f.format(finalFireRate)+" rounds per second");
String delimiter = "rounds";
String mode = selectedWeapon.getWeaponMode();
if(mode.equals(Constants.BURST)){
delimiter = "bursts";
}else if(mode.equals(Constants.CONTINUOUS)){
delimiter = "ammo drain";
}
output.append("\nFire Rate :: "+f.format(finalFireRate)+" "+delimiter+" per second");
output.append("\nReload Time :: "+f.format(finalReloadTime)+" seconds");
output.append("\nStatus Chance :: "+f.format(finalStatusChance*100.0)+"%");
output.append("\nProjectiles Per Shot :: "+f.format(finalProjectileCount));
Expand Down
15 changes: 0 additions & 15 deletions src/weapons/WeaponAttributesPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public class WeaponAttributesPanel extends JPanel {
protected JPanel damageTypePanel = new JPanel();
protected JPanel chargeTimePanel = new JPanel();
protected JPanel burstCountPanel = new JPanel();
protected JPanel burstFireRatePanel = new JPanel();
protected JPanel projectilePanel = new JPanel();
protected JPanel statusPanel = new JPanel();

Expand All @@ -51,7 +50,6 @@ public class WeaponAttributesPanel extends JPanel {
protected JLabel damageTypeLabel = new JLabel("Base Damage Type - ");
protected JLabel chargeTimeLabel = new JLabel("Charge Time - ");
protected JLabel burstCountLabel = new JLabel("Burst Count - ");
protected JLabel burstFireRateLabel = new JLabel("Burst Fire Rate - ");
protected JLabel damageLabel = new JLabel("Base Damage - ");
protected JLabel impactLabel = new JLabel("Impact Damage - ");
protected JLabel punctureLabel = new JLabel("Puncture Damage - ");
Expand All @@ -68,7 +66,6 @@ public class WeaponAttributesPanel extends JPanel {
/** JTextFields **/
protected JTextField chargeTimeField = new JTextField(10);
protected JTextField burstCountField = new JTextField(10);
protected JTextField burstFireRateField = new JTextField(10);
protected JTextField nameField = new JTextField(10);
protected JTextField damageField = new JTextField(10);
protected JTextField impactField = new JTextField(10);
Expand Down Expand Up @@ -119,7 +116,6 @@ public void buildUI(){
UIBuilder.labelInit(damageTypeLabel);
UIBuilder.labelInit(chargeTimeLabel);
UIBuilder.labelInit(burstCountLabel);
UIBuilder.labelInit(burstFireRateLabel);
UIBuilder.labelInit(projectileLabel);
UIBuilder.labelInit(statusLabel);

Expand All @@ -137,7 +133,6 @@ public void buildUI(){
UIBuilder.numberFieldInit(multiplierField);
UIBuilder.numberFieldInit(chargeTimeField);
UIBuilder.numberFieldInit(burstCountField);
UIBuilder.numberFieldInit(burstFireRateField);
UIBuilder.numberFieldInit(projectileField);
UIBuilder.numberFieldInit(statusField);

Expand All @@ -156,7 +151,6 @@ public void buildUI(){
UIBuilder.createSepparationBorder(damageTypePanel);
UIBuilder.createSepparationBorder(chargeTimePanel);
UIBuilder.createSepparationBorder(burstCountPanel);
UIBuilder.createSepparationBorder(burstFireRatePanel);
UIBuilder.createSepparationBorder(projectilePanel);
UIBuilder.createSepparationBorder(statusPanel);

Expand All @@ -176,7 +170,6 @@ public void buildUI(){
UIBuilder.panelInit(damageTypePanel);
UIBuilder.panelInit(chargeTimePanel);
UIBuilder.panelInit(burstCountPanel);
UIBuilder.panelInit(burstFireRatePanel);
UIBuilder.panelInit(projectilePanel);
UIBuilder.panelInit(statusPanel);

Expand All @@ -195,7 +188,6 @@ public void buildUI(){
damageTypeLabel.setToolTipText(Constants.DAMAGE_TYPE_TOOL_TIP);
chargeTimeLabel.setToolTipText(Constants.CHARGE_TIME_TOOL_TIP);
burstCountLabel.setToolTipText(Constants.BURST_COUNT_TOOL_TIP);
burstFireRateLabel.setToolTipText(Constants.BURST_FIRE_RATE_TOOL_TIP);
projectileLabel.setToolTipText(Constants.POJECTILE_TOOL_TIP);
statusLabel.setToolTipText(Constants.STATUS_TOOL_TIP);

Expand All @@ -214,7 +206,6 @@ public void buildUI(){
damageTypeBox.setToolTipText(Constants.DAMAGE_TYPE_TOOL_TIP);
chargeTimeField.setToolTipText(Constants.CHARGE_TIME_TOOL_TIP);
burstCountField.setToolTipText(Constants.BURST_COUNT_TOOL_TIP);
burstFireRateField.setToolTipText(Constants.BURST_FIRE_RATE_TOOL_TIP);
projectileField.setToolTipText(Constants.POJECTILE_TOOL_TIP);
statusField.setToolTipText(Constants.STATUS_TOOL_TIP);

Expand Down Expand Up @@ -256,7 +247,6 @@ public void buildUI(){
statusPanel.setLayout(new GridLayout(1,2,0,0));
chargeTimePanel.setLayout(new GridLayout(1,2,0,0));
burstCountPanel.setLayout(new GridLayout(1,2,0,0));
burstFireRatePanel.setLayout(new GridLayout(1,2,0,0));

namePanel.add(nameLabel);
namePanel.add(nameField);
Expand Down Expand Up @@ -288,8 +278,6 @@ public void buildUI(){
chargeTimePanel.add(chargeTimeField);
burstCountPanel.add(burstCountLabel);
burstCountPanel.add(burstCountField);
burstFireRatePanel.add(burstFireRateLabel);
burstFireRatePanel.add(burstFireRateField);
projectilePanel.add(projectileLabel);
projectilePanel.add(projectileField);
statusPanel.add(statusLabel);
Expand All @@ -306,7 +294,6 @@ public void buildUI(){
this.add(slashPanel);
this.add(chargeTimePanel);
this.add(burstCountPanel);
this.add(burstFireRatePanel);
this.add(projectilePanel);
this.add(statusPanel);
this.add(fireRatePanel);
Expand All @@ -329,7 +316,6 @@ public void clear(){
nameField.setText("");
chargeTimeField.setText("");
burstCountField.setText("");
burstFireRateField.setText("");
nameField.setText("");
damageField.setText("");
impactField.setText("");
Expand All @@ -354,7 +340,6 @@ public void setCustom(){
nameField.setText("");
chargeTimeField.setText("");
burstCountField.setText("");
burstFireRateField.setText("");
nameField.setText("");
damageField.setText("");
impactField.setText("");
Expand Down
8 changes: 1 addition & 7 deletions src/weapons/WeaponManagerPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ public void updateSelectedValues(){
attributesPanel.nameField.setText(selectedWeapon.name);
attributesPanel.chargeTimeField.setText(selectedWeapon.chargeTime);
attributesPanel.burstCountField.setText(selectedWeapon.burstCount);
attributesPanel.burstFireRateField.setText(selectedWeapon.burstFireRate);
attributesPanel.damageField.setText(selectedWeapon.damage);
attributesPanel.impactField.setText(selectedWeapon.impact);
attributesPanel.punctureField.setText(selectedWeapon.puncture);
Expand Down Expand Up @@ -234,7 +233,7 @@ public String getCurrentWeaponString(){
String name = attributesPanel.nameField.getText();
String chargeTime = attributesPanel.chargeTimeField.getText();
String burstCount = attributesPanel.burstCountField.getText();
String burstFireRate = attributesPanel.burstFireRateField.getText();
String burstFireRate = "DEPRECIATED";
String damage = attributesPanel.damageField.getText();
String impact = attributesPanel.impactField.getText();
String puncture = attributesPanel.punctureField.getText();
Expand All @@ -256,11 +255,6 @@ public String getCurrentWeaponString(){
}catch(Exception ex){
chargeTime = "0.0";
}
try{
double testDouble = Double.parseDouble(burstFireRate);
}catch(Exception ex){
burstFireRate = "0.0";
}
try{
double testDouble = Double.parseDouble(damage);
}catch(Exception ex){
Expand Down
Loading

0 comments on commit 82078b8

Please sign in to comment.