-
Notifications
You must be signed in to change notification settings - Fork 0
/
Ranged.java
141 lines (115 loc) · 3.32 KB
/
Ranged.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/**
* A class to make an in-game firearm object
*
* @author Matt
* @version 12/4/2020
*/
public class Ranged extends WeaponClass /*implements Infuse*/
{
//field declarations
private int rounds;
private String rateOfFire;
private int magazine;
/**
* Constructor
*/
public Ranged(String weaponName, String weaponType, double damageAmt, String rarity, WeaponSlot weaponSlot, int rounds, String rateOfFire, int magazine){
super(weaponName, weaponType, damageAmt, rarity, weaponSlot);
this.rounds = rounds;
this.rateOfFire = rateOfFire;
this.magazine = magazine;
}
/**
* Overload constructor to be used by main method
*/
public Ranged(){
super();
rounds = 0;
rateOfFire = null;
magazine = 0;
}
/**
* Main method
*/
public static void main(String[] args){
Ranged ranged = new Ranged();
String weaponName = args[0];
ranged.setWeaponName(weaponName);
String weaponType = args[1];
ranged.setWeaponType(weaponType);
Double damageAmt = Double.parseDouble(args[2]);
ranged.setDamageAmt(damageAmt);
String rarity = args[3];
ranged.setRarity(rarity);
WeaponSlot weaponSlot = WeaponSlot.valueOf(args[4]);
ranged.setWeaponSlot(weaponSlot);
int rounds = Integer.parseInt(args[5]);
ranged.setRounds(rounds);
String rateOfFire = args[6];
ranged.setRateOfFire(rateOfFire);
int magazine = Integer.parseInt(args[7]);
ranged.setMagSize(magazine);
}
/**
* Method to assign the number of rounds for the firearm
*/
public void setRounds(int rounds){
this.rounds = rounds;
}
/**
* Method to assign the rate of fire for the fireArm
*/
public void setRateOfFire(String rateOfFire){
this.rateOfFire = rateOfFire;
}
/**
* Method to assign the magazine size of the firearm
*/
public void setMagSize(int magazine){
this.magazine = magazine;
}
/**
* Method to print info about the weapon
*/
public void printRangedInfo(){
System.out.println(this);
System.out.println();
}
/*------------------------Accessor Methods-----------------------------*/
/**
* Method to get the number of rounds
*/
public int getRounds(){
return rounds;
}
/**
* Method to get the rate of fire of the weapon
*/
public String getRateFire(){
return rateOfFire;
}
/**
* Method to return the magazine size of the weapon
*/
public int getMagazine(){
return magazine;
}
/**
* Method to override toString()
*/
@Override
public String toString(){
String rangedString = super.toString() + "\nRounds: " + rounds +
"\nRate of Fire: " + rateOfFire + "\nMagazine Size: " + magazine;
return rangedString;
}
/**
* Method for user to infuse
*/
//public void userInfuser(Ranged useItem, Ranged infuseItem){
//}
/**
* Method to compute infusing
*/
//public void infuse()
}