Package com.starpoints.game.item
Class ItemAbstractChrystal
- java.lang.Object
-
- com.starpoints.game.Thing
-
- com.starpoints.game.Item
-
- com.starpoints.game.ItemPermanent
-
- com.starpoints.game.item.ItemAbstractChrystal
-
- All Implemented Interfaces:
FigureItemListener
,FigureRamListener
,java.io.Serializable
,java.lang.Cloneable
- Direct Known Subclasses:
ItemBlueChrystal
,ItemGreenChrystal
,ItemRatPoison
,ItemRedChrystal
,ItemYellowChrystal
public abstract class ItemAbstractChrystal extends ItemPermanent implements FigureRamListener, FigureItemListener
Abstract superclass for 4 chrystals in Chrystal zone.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected int
exitX
protected int
exitY
-
Fields inherited from class com.starpoints.game.ItemPermanent
displayInSlot, drawDuration, duration, energyFactor, isPermanentlyActive, unique, usesUp, useText
-
Fields inherited from class com.starpoints.game.Item
affectsBlue, category, DEBUG, DEFAULT_ITEM_PAINTERCLASS, dieReason, isBomb, isWeapon, pickupClip, pickupText, pointBonus, useClip, user
-
Fields inherited from class com.starpoints.game.Thing
energy, energyFx, energyMaxSoundPlayed, energyModifications, explosionCounter, game, imageName, innerColor, invulnCount, isAffectedByBlack, isAffectedByGray, level, MAX_TEXTPAINT, maxEnergy, nextID, outerColor, p, shieldCount, status, text
-
-
Constructor Summary
Constructors Constructor Description ItemAbstractChrystal()
Creates a new ItemEnergyPlus.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
beforePickup(Figure picker, AnimationInfo animation)
Called when picked up.protected int
calculateDuration()
Calculates the duration.protected boolean
checkPickup(Figure picker)
Checks, if the chrystal will really be picked up - false, if same chrystal is already owned.protected void
createExit(int x, int y, AnimationInfo animation)
Creates the exit when collected.protected void
freeSlot(Figure picker, AnimationInfo animation)
Does nothing, if picker has free slots.int
getItemRating()
Returns an item value for ComputerFigures rating in the items category.int
getRamPower(Figure f, Figure rammer, int initialRamPower)
Empty figure listener method.boolean
isAvailableInEditor()
Checks, if this item is available in level editor.void
lostPermanentItem(Figure f, Item i, AnimationInfo animation)
Adds this item as permanent, if the last permanent item was finally removed and removes itself as item listener.-
Methods inherited from class com.starpoints.game.ItemPermanent
createState, die, displayInSlot, doSpecialUpdate, getDuration, getFigureOverlayImageName, getSlotImageName, getUseText, isAddingEnergy, isDrawingDuration, isPermanentlyActive, isUnique, isUsingUp, onAddedAsPermanentItem, onBeLost, onBePickedUp, onBeUsed, onDropPermanent, onReinitForNewLevel, performPermanentEffect, setDrawDuration, setDuration, setIsUsingUp, useUp
-
Methods inherited from class com.starpoints.game.Item
affectsBlue, bePickedUp, beUsed, bombPlaced, entersColor, explodes, gainsEnergy, gainsPermanentItem, gainsSlots, getCategory, getDieReason, getDrawText, getItemRating, getMoveAnimationLength, getName, getPainterClassname, getPickUpClip, getPickupText, getPointBonus, getUseClip, getUser, heatChanges, is3DItem, isAffectedByColor, isBomb, isRammed, isRocketTarget, isStunned, isWeapon, killedEnemy, losesEnergy, losesItem, losesPermanentItem, onBeforeDie, onBeHitByItem, onDrop, onEnemyKilled, onHitItem, onLevelFinished, performFieldEffect, pickesUpBomb, pickesUpExplosive, pickesUpItem, pointsChange, pointSumChanges, removeAfterLevel, retrieveState, rocketStarted, setUser, startsHovering, staysOnColor, toString, updateExplodingStatus, updateThing, usesItem, visibilityChanges
-
Methods inherited from class com.starpoints.game.Thing
addEnergy, addShielding, addStateProperties, clearTexts, displayText, displayText, entersColor, equals, getColor, getEnergy, getEnergyMaxCount, getExplosionCounter, getField, getGame, getID, getImageName, getInnerColor, getInvulnerableRounds, getLevel, getMaxEnergy, getNextID, getOuterColor, getPoint, getShadowColor, getShield, getStateObject, getStatus, getText, getTextColor, getTextPaintCount, getX, getY, hashCode, invulnerable, isAffectedByBlack, isAffectedByGray, isDestroyed, isExploding, isInvulnerable, isOK, isShowingEnergyFx, onExplode, removeEnergy, retrieveState, setEnergy, setEnergyMaxCount, setGame, setMaxEnergy, setPoint, setStatus, staysOnColor, stepText, updateEnergy
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.starpoints.game.listener.FigureItemListener
gainsPermanentItem, gainsSlots, losesItem, losesPermanentItem, pickesUpBomb, pickesUpExplosive, pickesUpItem, usesItem
-
Methods inherited from interface com.starpoints.game.listener.FigureRamListener
isRammed
-
-
-
-
Method Detail
-
calculateDuration
protected int calculateDuration()
Calculates the duration.- Overrides:
calculateDuration
in classItemPermanent
- Returns:
- 2500.
-
isAvailableInEditor
public boolean isAvailableInEditor()
Checks, if this item is available in level editor.- Overrides:
isAvailableInEditor
in classItem
- Returns:
- false.
-
getItemRating
public int getItemRating()
Returns an item value for ComputerFigures rating in the items category.- Overrides:
getItemRating
in classItem
- Returns:
- -10000000.
-
beforePickup
public boolean beforePickup(Figure picker, AnimationInfo animation)
Called when picked up. Frees a permanent item slot and directly adds the chrystal as permanent item.- Overrides:
beforePickup
in classItemPermanent
- Parameters:
picker
- The figure picking the item.animation
- The AnimationInfo.- Returns:
- true, if the item can be picked up (either if item is unique or picker still has free slots).
-
checkPickup
protected boolean checkPickup(Figure picker)
Checks, if the chrystal will really be picked up - false, if same chrystal is already owned.- Parameters:
picker
- The figure to check.- Returns:
- true, if chrystal is not yet owned.
-
freeSlot
protected void freeSlot(Figure picker, AnimationInfo animation)
Does nothing, if picker has free slots. Adds one, if still one to add. Otherwise, searches the last permanent item that is not occupied by a chrystal and removes it.- Parameters:
picker
- The picker.animation
- The AnimationInfo.
-
lostPermanentItem
public void lostPermanentItem(Figure f, Item i, AnimationInfo animation)
Adds this item as permanent, if the last permanent item was finally removed and removes itself as item listener.- Specified by:
lostPermanentItem
in interfaceFigureItemListener
- Overrides:
lostPermanentItem
in classItem
- Parameters:
f
- The figure.i
- The item.animation
- The AnimationInfo.
-
getRamPower
public int getRamPower(Figure f, Figure rammer, int initialRamPower)
Description copied from class:Item
Empty figure listener method.- Specified by:
getRamPower
in interfaceFigureRamListener
- Overrides:
getRamPower
in classItem
- Parameters:
f
- The figure.rammer
- The figure that is rammed.initialRamPower
- The original ramPower.- Returns:
- The original ram power.
-
createExit
protected void createExit(int x, int y, AnimationInfo animation)
Creates the exit when collected.- Parameters:
x
- The x coordinate.y
- The y coordinate.animation
- AnimationInfo.
-
-