COMP2396
|
The Weapon class represents any game weapon with a name and power level. More...
Public Member Functions | |
Weapon (String name, int power) | |
Constructs a new Weapon with the specified name and power level. | |
String | getName () |
Returns the name of the weapon. | |
int | shoot () |
Simulates shooting the weapon and returns the power generated. | |
Private Attributes | |
final int | power |
final String | weaponName |
The Weapon class represents any game weapon with a name and power level.
A weapon can be used to shoot and generate power for attacks.
Definition at line 7 of file Weapon.java.
|
inline |
Constructs a new Weapon with the specified name and power level.
name | the name of the weapon |
power | the power level of the weapon |
Definition at line 17 of file Weapon.java.
References assignment2.Weapon.power.
|
inline |
Returns the name of the weapon.
Definition at line 27 of file Weapon.java.
References assignment2.Weapon.weaponName.
Referenced by assignment2.OfficeCombat1.main(), and assignment2.OfficeCombat2.main().
|
inline |
Simulates shooting the weapon and returns the power generated.
Reimplemented in assignment2.BadGun, and assignment2.SuperGun.
Definition at line 36 of file Weapon.java.
References assignment2.Weapon.power.
Referenced by assignment2.Character.attack().
|
private |
Definition at line 9 of file Weapon.java.
Referenced by assignment2.BadGun.BadGun(), assignment2.SuperGun.SuperGun(), assignment2.Weapon.Weapon(), and assignment2.Weapon.shoot().
|
private |
Definition at line 8 of file Weapon.java.
Referenced by assignment2.Weapon.getName().