Treasure.java (955B)
1 package Monster; 2 3 4 /** 5 * stores the kind of Treasure 6 */ 7 enum TreasureType { 8 GEM, 9 COIN, 10 POTION 11 } 12 13 public class Treasure { 14 private TreasureType treasureType; 15 private String treasureColor; 16 private int specialPowerPoints; 17 18 public Treasure(TreasureType treasureType, String treasureColor, int specialPowerPoints) { 19 this.treasureType = treasureType; 20 this.treasureColor = treasureColor; 21 this.specialPowerPoints = specialPowerPoints; 22 } 23 24 public TreasureType getTreasureType() { 25 return this.treasureType; 26 } 27 28 public void setTreasureColor(String treasureColor) { 29 this.treasureColor = treasureColor; 30 } 31 32 public String getTreasureColor() { 33 return this.treasureColor; 34 } 35 36 public void setPowerPoints(int specialPowerPoints) { 37 this.specialPowerPoints = specialPowerPoints; 38 } 39 40 public int getPowerPoints() { 41 return this.specialPowerPoints; 42 } 43 44 public String toString() { 45 return "A " + this.treasureColor + " " + this.treasureType; 46 } 47 };