Package com.starpoints.game.item
Class ItemSatellite
- java.lang.Object
-
- com.starpoints.game.Thing
-
- com.starpoints.game.Item
-
- com.starpoints.game.item.ItemSatellite
-
- All Implemented Interfaces:
FigureMoveListener,java.io.Serializable,java.lang.Cloneable
public class ItemSatellite extends Item implements FigureMoveListener
Item, that can be used to move around instead of the user. Picked items are transferred to the user. Hitting a figure does small rocket damage. Immune to holes.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected booleandropFlagNeeded for correct listener removal by self-inflicted drop.protected DirectionlastMoveDirection after figure moved.protected com.starpoints.game.item.ItemSatellite.SatelliteModemodeThe current satellite mode.-
Fields inherited from class com.starpoints.game.Item
affectsBlue, category, 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 ItemSatellite()Creates a new ItemSatellite.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddStateProperties(ThingState state, AnimationInfo animation)Adds properties necessary for satellite painting.booleanbeforeMove(Figure f, Point p, Point newP, AnimationInfo animation)Called, if the satellite is active.protected voiddoSpecialUpdate(AnimationInfo animation)Performs the update in each round in overridden classes.java.lang.StringgetImageName()Returns the image name..intgetItemRating()Returns an item value for ComputerFigures rating in the items category.intgetMoveAnimationLength()Method that can be overwritten by moving item subclasses, in case move animation should not last for default of 4 update cycles.java.lang.StringgetPainterClassname()Gets the fully qualified classname of the Painter to use for this item (in 2D game).booleanisTransferring()Checks, if satellite just transferred an item to its user.protected voidonBeforeDie(Thing source, DieReason reason, AnimationInfo animation)Called, before the item dies.booleanonBePickedUp(Figure picker, AnimationInfo animation)If the satellite is active, it gives rocket damage to picker (as long as it is not the user).booleanonBeUsed(Figure user, AnimationInfo animation)Adds the satellite as move listener.voidonDrop(Figure oldOwner, AnimationInfo animation)Called if the item is lost.booleanonHitItem(Item rammedItem, AnimationInfo animation)Method called if this item moves and hits another item.protected voidonLevelFinished()Called after a level was finished.-
Methods inherited from class com.starpoints.game.Item
affectsBlue, bePickedUp, beUsed, bombPlaced, createState, die, entersColor, explodes, gainsEnergy, gainsPermanentItem, gainsSlots, getCategory, getDieReason, getDrawText, getItemRating, getName, getPickUpClip, getPickupText, getPointBonus, getRamPower, getUseClip, getUser, heatChanges, is3DItem, isAffectedByColor, isAvailableInEditor, isBomb, isRammed, isRocketTarget, isStunned, isWeapon, killedEnemy, losesEnergy, losesItem, losesPermanentItem, lostPermanentItem, onBeHitByItem, onEnemyKilled, 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, 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.FigureMoveListener
removeAfterLevel
-
-
-
-
Field Detail
-
mode
protected com.starpoints.game.item.ItemSatellite.SatelliteMode mode
The current satellite mode.
-
dropFlag
protected boolean dropFlag
Needed for correct listener removal by self-inflicted drop.
-
lastMove
protected Direction lastMove
Direction after figure moved.
-
-
Method Detail
-
getPainterClassname
public java.lang.String getPainterClassname()
Gets the fully qualified classname of the Painter to use for this item (in 2D game).- Overrides:
getPainterClassnamein classItem- Returns:
- "com.starpoints.painter.arena2D.PainterItemSatellite"
-
getItemRating
public int getItemRating()
Returns an item value for ComputerFigures rating in the items category.- Overrides:
getItemRatingin classItem- Returns:
- -1000000.
-
addStateProperties
protected void addStateProperties(ThingState state, AnimationInfo animation)
Adds properties necessary for satellite painting.- Overrides:
addStatePropertiesin classThing- Parameters:
state- The state to add properties to.animation- The current AnimationInfo.
-
getImageName
public java.lang.String getImageName()
Returns the image name..- Returns:
- item_satellite as default. Modified, if figure moved.
-
onBePickedUp
public boolean onBePickedUp(Figure picker, AnimationInfo animation)
If the satellite is active, it gives rocket damage to picker (as long as it is not the user).- Overrides:
onBePickedUpin classItem- Parameters:
picker- The pickeranimation- The AnimationInfo.- Returns:
- true, if picker is old user, otherwise
-
onBeforeDie
protected void onBeforeDie(Thing source, DieReason reason, AnimationInfo animation)
Called, before the item dies. Removes move listener.- Overrides:
onBeforeDiein classItem- Parameters:
source- The death source. Might be null if dying e.g. because of energy losses by gray points.reason- The death reason.animation- The AnimationInfo.
-
onBeUsed
public boolean onBeUsed(Figure user, AnimationInfo animation)
Adds the satellite as move listener.
-
beforeMove
public boolean beforeMove(Figure f, Point p, Point newP, AnimationInfo animation)
Called, if the satellite is active. Lets the satellite move instead of the figure- Specified by:
beforeMovein interfaceFigureMoveListener- Parameters:
f- The figure.p- The figures current point.newP- The point the figures wants to move to.animation- The AnimationInfo- Returns:
- true, if figure can move.
-
onLevelFinished
protected void onLevelFinished()
Called after a level was finished. Removes as FigureMoveListener.- Overrides:
onLevelFinishedin classItem
-
onHitItem
public boolean onHitItem(Item rammedItem, AnimationInfo animation)
Method called if this item moves and hits another item. Makes the user take the item.
-
onDrop
public void onDrop(Figure oldOwner, AnimationInfo animation)
Called if the item is lost.
-
doSpecialUpdate
protected void doSpecialUpdate(AnimationInfo animation)
Performs the update in each round in overridden classes. Does nothing per default.- Overrides:
doSpecialUpdatein classItem- Parameters:
animation- The AnimationInfo.
-
isTransferring
public boolean isTransferring()
Checks, if satellite just transferred an item to its user.- Returns:
- true, if satellite just transferred an item to its user.
-
getMoveAnimationLength
public int getMoveAnimationLength()
Method that can be overwritten by moving item subclasses, in case move animation should not last for default of 4 update cycles.- Overrides:
getMoveAnimationLengthin classItem- Returns:
- 4 by default.
-
-