COMP2396
|
The SuperGun can produce a boosted shot, such that the shot produces two times power than the original. More...
Public Member Functions | |
SuperGun (String name, int power) | |
Constructs a new SuperGun with the specified name and power level. | |
void | boost () |
Boosts the gun for the next attack. | |
int | shoot () |
Shoots the gun. | |
![]() | |
Weapon (String name, int power) | |
Constructs a new Weapon with the specified name and power level. | |
String | getName () |
Returns the name of the weapon. | |
Private Attributes | |
boolean | isBoosted = false |
The SuperGun can produce a boosted shot, such that the shot produces two times power than the original.
It is a subclass of the Weapon class.
Definition at line 8 of file SuperGun.java.
|
inline |
Constructs a new SuperGun with the specified name and power level.
name | the name of the super gun |
power | the power level of the super gun |
Definition at line 17 of file SuperGun.java.
References assignment2.Weapon.power.
|
inline |
Boosts the gun for the next attack.
Definition at line 24 of file SuperGun.java.
References assignment2.SuperGun.isBoosted.
Referenced by assignment2.SecurityGuard.boostWeapon().
|
inline |
Shoots the gun.
If boosted, the power is doubled for the attack. Resets the boosting effect after the shot.
Reimplemented from assignment2.Weapon.
Definition at line 35 of file SuperGun.java.
References assignment2.SuperGun.isBoosted.
|
private |
Definition at line 9 of file SuperGun.java.
Referenced by assignment2.SuperGun.boost(), and assignment2.SuperGun.shoot().