Package com.starpoints.game.item
Class ItemSecretLevel
- java.lang.Object
-
- com.starpoints.game.Thing
-
- com.starpoints.game.Item
-
- com.starpoints.game.item.ItemSecretLevel
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable
public class ItemSecretLevel extends Item
Item, that brings the player to a secret level. The item is randomly active for ACTIVITY_DURATION rounds. If it is picked inactive, it teleports away to a free point on the field.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static intACTIVITY_DURATIONNumber of rounds the item is active.-
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 ItemSecretLevel()Creates a new ItemNextLevel;
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactivate(int rounds)Activates this ItemSecretLevel for the given number of rounds.protected voidaddStateProperties(ThingState state, AnimationInfo animation)Adds properties necessary for secretlevel painting.protected voiddoSpecialUpdate(AnimationInfo animation)Performs the update in each round.java.lang.StringgetImageName(AnimationInfo animation)Returns image name.intgetItemRating()Returns an item value for ComputerFigures rating in the items category.java.lang.StringgetPainterClassname()Gets the fully qualified classname of the Painter to use for this item (in 2D game).java.lang.StringgetPickupText()Gets the text, if the item is picked up.booleanonBePickedUp(Figure picker, AnimationInfo animation)If the item is active, it switches to the next (secret) level, otherwise teleports to a free point.protected voidperformFieldEffect(AnimationInfo animation)If the state is active, the countdown is performed, otherwise the item is set randomly active.voidremoveEnergy(int min, Thing source, DieReason reason, AnimationInfo animation)Does nothing - item never gets destroyed.voidsetActivationProbability(int prob)Sets the activation probability in percent.-
Methods inherited from class com.starpoints.game.Item
affectsBlue, bePickedUp, beUsed, bombPlaced, createState, die, entersColor, explodes, gainsEnergy, gainsPermanentItem, gainsSlots, getCategory, getDieReason, getDrawText, getItemRating, getMoveAnimationLength, getName, getPickUpClip, getPointBonus, getRamPower, getUseClip, getUser, heatChanges, is3DItem, isAffectedByColor, isAvailableInEditor, isBomb, isRammed, isRocketTarget, isStunned, isWeapon, killedEnemy, losesEnergy, losesItem, losesPermanentItem, lostPermanentItem, onBeforeDie, onBeHitByItem, onBeUsed, onDrop, onEnemyKilled, onHitItem, onLevelFinished, 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, 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, retrieveState, setEnergy, setEnergyMaxCount, setGame, setMaxEnergy, setPoint, setStatus, staysOnColor, stepText, updateEnergy
-
-
-
-
Field Detail
-
ACTIVITY_DURATION
public static final int ACTIVITY_DURATION
Number of rounds the item is active.- See Also:
- Constant Field Values
-
-
Method Detail
-
addStateProperties
protected void addStateProperties(ThingState state, AnimationInfo animation)
Adds properties necessary for secretlevel painting.- Overrides:
addStatePropertiesin classThing- Parameters:
state- The state to add properties to.animation- The current AnimationInfo.
-
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.PainterItemSecretLevel"
-
getImageName
public java.lang.String getImageName(AnimationInfo animation)
Returns image name.- Overrides:
getImageNamein classThing- Parameters:
animation- The AnimationInfo.- Returns:
- "".
-
getPickupText
public java.lang.String getPickupText()
Gets the text, if the item is picked up.- Overrides:
getPickupTextin classItem- Returns:
- Value of pickupText.
-
getItemRating
public int getItemRating()
Returns an item value for ComputerFigures rating in the items category.- Overrides:
getItemRatingin classItem- Returns:
- -10000000.
-
setActivationProbability
public void setActivationProbability(int prob)
Sets the activation probability in percent. If inactive, each round an activation check is made against this probabiliry. After setting the prob. explicitel, the item does not change its activation prob. depending on the energy.- Parameters:
prob- The probability in percent. Set to 0 or negative to prevent from reactivating.
-
performFieldEffect
protected void performFieldEffect(AnimationInfo animation)
If the state is active, the countdown is performed, otherwise the item is set randomly active.- Overrides:
performFieldEffectin classItem- Parameters:
animation- The AnimationInfo.
-
doSpecialUpdate
protected void doSpecialUpdate(AnimationInfo animation)
Performs the update in each round. Sets the activation probability to energy / 10 (if not set explicitely before).- Overrides:
doSpecialUpdatein classItem- Parameters:
animation- The AnimationInfo
-
activate
public void activate(int rounds)
Activates this ItemSecretLevel for the given number of rounds.
-
removeEnergy
public void removeEnergy(int min, Thing source, DieReason reason, AnimationInfo animation)Does nothing - item never gets destroyed.- Overrides:
removeEnergyin classThing- Parameters:
min- The energy loss.source- The source of energy loss.reason- The reason.animation- The AnimationInfo.
-
onBePickedUp
public boolean onBePickedUp(Figure picker, AnimationInfo animation)
If the item is active, it switches to the next (secret) level, otherwise teleports to a free point.- Overrides:
onBePickedUpin classItem- Parameters:
picker- The pickeranimation- The AnimationInfo.- Returns:
- false
-
-