-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArmorUpgrade.java
More file actions
34 lines (30 loc) · 841 Bytes
/
ArmorUpgrade.java
File metadata and controls
34 lines (30 loc) · 841 Bytes
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
package decoratordesignpattern;
/**
* Decoration of the player that upgrades the players armor.
* @author Matt Duggan
*/
public class ArmorUpgrade extends PlayerDecorator{
private Player player;
/**
* Constructs the decorator by calling all the cahracteristics of the player being upgraded.
* @param player The player that is getting an armor upgrade.
*/
public ArmorUpgrade(Player player) {
super();
this.player = player;
}
/**
* Displays the armor is being upgraded.
* @return A string that says armor upgraded.
*/
public String toString() {
return player.toString() + "\nUpgraded armor";
}
/**
* Upgrades the power of the player by 3 points.
* @return The points of power of the player.
*/
public double getPower() {
return player.getPower() + 3;
}
}