Class BaseSoul
java.lang.Object
gameelement.soul.BaseSoul
- Direct Known Subclasses:
DreamMistSoul, EnergySplashSoul, NovaSparkSoul, PassionPopSoul, SoothingLoveSoul, StarloveCharmSoul
Base model for all souls that appear on the conveyor belt.
-
Constructor Summary
ConstructorsConstructorDescriptionBaseSoul(int soulHP, PotionType weaknessType, String imagePath) Creates a soul with HP, weakness type, and image resource path. -
Method Summary
Modifier and TypeMethodDescriptionbooleancanbeHitByPotion(BasePotion potion) Checks whether the potion matches this soul weakness.Gets the image resource path for this soul.intGets the current soul HP.Gets the potion type that can damage this soul.voidsetImagePath(String imagePath) Sets the image resource path for this soul.voidsetSoulHP(int soulHP) Sets soul HP and clamps negative values to zero.voidsetWeaknessType(PotionType weaknessType) Sets the potion type that can damage this soul.voidtakeDamageFromPotion(BasePotion potion) Applies potion damage when the potion matches this soul weakness.
-
Constructor Details
-
BaseSoul
Creates a soul with HP, weakness type, and image resource path.- Parameters:
soulHP- starting hit pointsweaknessType- potion type that can damage this soulimagePath- resource file used for the soul image
-
-
Method Details
-
getSoulHP
public int getSoulHP()Gets the current soul HP.- Returns:
- current hit points
-
setSoulHP
public void setSoulHP(int soulHP) Sets soul HP and clamps negative values to zero.- Parameters:
soulHP- hit points to set
-
getWeaknessType
Gets the potion type that can damage this soul.- Returns:
- weakness potion type
-
setWeaknessType
Sets the potion type that can damage this soul.- Parameters:
weaknessType- weakness potion type
-
getImagePath
-
setImagePath
Sets the image resource path for this soul.- Parameters:
imagePath- image file path
-
canbeHitByPotion
Checks whether the potion matches this soul weakness.- Parameters:
potion- potion used for the attack- Returns:
- true when the potion type matches the weakness
-
takeDamageFromPotion
Applies potion damage when the potion matches this soul weakness.- Parameters:
potion- potion used for the attack
-