Package com.starpoints.game.item
Class ItemRatPoison
- java.lang.Object
-
- com.starpoints.game.Thing
-
- com.starpoints.game.Item
-
- com.starpoints.game.ItemPermanent
-
- com.starpoints.game.item.ItemAbstractChrystal
-
- com.starpoints.game.item.ItemRatPoison
-
- All Implemented Interfaces:
FigureItemListener
,FigureRamListener
,java.io.Serializable
,java.lang.Cloneable
public class ItemRatPoison extends ItemAbstractChrystal
Item, that makes the user lose energy depending on this items energy every round. Used by TheRat.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected int
energyLoss
The energy loss per round for the owner.-
Fields inherited from class com.starpoints.game.item.ItemAbstractChrystal
exitX, 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 ItemRatPoison()
Creates a new ItemRatPoison.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.int
getEnergyLoss()
Gets this items energy loss.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
onAddedAsPermanentItem(Figure user, AnimationInfo animation)
Adds this item as permanent.protected void
onReinitForNewLevel(Figure user)
Called after a level, if this item is stored in a permanent slot of the figure.void
performPermanentEffect(Figure owner, AnimationInfo animation)
Adds 2 energy to the owner's.void
setSource(TheRat theRat)
Sets the source of the energy loss.-
Methods inherited from class com.starpoints.game.item.ItemAbstractChrystal
beforePickup, calculateDuration, freeSlot, lostPermanentItem
-
Methods inherited from class com.starpoints.game.ItemPermanent
createState, die, displayInSlot, doSpecialUpdate, getDuration, getFigureOverlayImageName, getSlotImageName, getUseText, isAddingEnergy, isDrawingDuration, isPermanentlyActive, isUnique, isUsingUp, onBeLost, onBePickedUp, onBeUsed, onDropPermanent, 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
-
getItemRating
public int getItemRating()
Returns an item value for ComputerFigures rating in the items category.- Overrides:
getItemRating
in classItemAbstractChrystal
- Returns:
- energy * -100.
-
isAvailableInEditor
public boolean isAvailableInEditor()
Checks, if this item is available in level editor.- Overrides:
isAvailableInEditor
in classItemAbstractChrystal
- Returns:
- false.
-
onAddedAsPermanentItem
public void onAddedAsPermanentItem(Figure user, AnimationInfo animation)
Adds this item as permanent. Duration is this items energy * 20, energy gain is energy/10 (max. 10)- Overrides:
onAddedAsPermanentItem
in classItemPermanent
- Parameters:
user
- The figure using the item.animation
- AnimationInfo.
-
performPermanentEffect
public void performPermanentEffect(Figure owner, AnimationInfo animation)
Adds 2 energy to the owner's. Duration is decreased by 2 (if the owner still gains energy).- Overrides:
performPermanentEffect
in classItemPermanent
- Parameters:
owner
- The owner.animation
- The AnimationInfo.
-
getEnergyLoss
public int getEnergyLoss()
Gets this items energy loss.- Returns:
- The calculated energy loss.
-
setSource
public void setSource(TheRat theRat)
Sets the source of the energy loss.- Parameters:
theRat
- The source of this poison.
-
onReinitForNewLevel
protected void onReinitForNewLevel(Figure user)
Called after a level, if this item is stored in a permanent slot of the figure. Does nothing by default.- Overrides:
onReinitForNewLevel
in classItemPermanent
- Parameters:
user
- The user
-
checkPickup
protected boolean checkPickup(Figure picker)
Checks, if the chrystal will really be picked up - false, if same chrystal is already owned.- Overrides:
checkPickup
in classItemAbstractChrystal
- Parameters:
picker
-- Returns:
-
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 classItemAbstractChrystal
- 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.- Overrides:
createExit
in classItemAbstractChrystal
- Parameters:
x
-y
-animation
-
-
-