Class TomeItem
java.lang.Object
model.item.Item
model.item.TomeItem
- All Implemented Interfaces:
Applicable
Reward granted after defeating a Goblin; randomly boosts one of 3 stats for the winner.
The boost is permanent (base values are also adjusted) and is not reset after battle.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intAttack bonus applied when ATTACK is rolled.private static final intDefense bonus applied when DEFENSE is rolled.private static final intHP bonus applied when MAX_HP is rolled.private final StatTypeStat that was randomly selected when this object was created.private static final RandomShared random instance used to select which stat to boost. -
Constructor Summary
ConstructorsConstructorDescriptionTomeItem()Creates a TomeItem and immediately randomly selects the stat to boost. -
Method Summary
Modifier and TypeMethodDescriptionvoidApplies the randomly chosen stat boost to the entity and updates base values as well, making the boost permanent and not subject to battle resets.Returns the stat type that was randomly selected.Returns a description of the stat boost for display in the UI.
-
Field Details
-
RANDOM
Shared random instance used to select which stat to boost. -
BONUS_AMOUNT_HP
private static final int BONUS_AMOUNT_HPHP bonus applied when MAX_HP is rolled.- See Also:
-
BONUS_AMOUNT_ATK
private static final int BONUS_AMOUNT_ATKAttack bonus applied when ATTACK is rolled.- See Also:
-
BONUS_AMOUNT_DEF
private static final int BONUS_AMOUNT_DEFDefense bonus applied when DEFENSE is rolled.- See Also:
-
boostedStat
Stat that was randomly selected when this object was created.
-
-
Constructor Details
-
TomeItem
public TomeItem()Creates a TomeItem and immediately randomly selects the stat to boost.
-
-
Method Details
-
apply
Applies the randomly chosen stat boost to the entity and updates base values as well, making the boost permanent and not subject to battle resets.- Specified by:
applyin interfaceApplicable- Specified by:
applyin classItem- Parameters:
target- Entity to receive the stat boost
-
getEffectDescription
Returns a description of the stat boost for display in the UI.- Specified by:
getEffectDescriptionin interfaceApplicable- Specified by:
getEffectDescriptionin classItem- Returns:
- Description of the boosted stat
-
getBoostedStat
Returns the stat type that was randomly selected.- Returns:
- The StatType to be boosted
-