Package com.starpoints.game.item
Class ItemBigMine
- java.lang.Object
-
- com.starpoints.game.Thing
-
- com.starpoints.game.Item
-
- com.starpoints.game.item.ItemBigMine
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
- Direct Known Subclasses:
ItemChainExplosion
,ItemHeatMine
,ItemVeryBigMine
,ItemVeryVeryBigMine
public class ItemBigMine extends Item
Bomb which can be placed on the field and detonates after a countdown of 10 rounds with an explosion radius of 3 points.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
clipStr
A clip name after being dropped.protected int
countDown
Countdown counter.protected static boolean
DEBUG
Debug flag.protected Point
dropPoint
The point to be dropped on.protected Thing
explosionSource
The source of the detonation.protected int
maxcountDown
Initial countdown value.protected BombState
state
Current state.-
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 ItemBigMine()
Creates a new ItemBigMine.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addStateProperties(ThingState state, AnimationInfo animation)
Adds properties necessary for bigmine painting.protected void
detonate(AnimationInfo animation)
Makes the BigMine detonate, if count down ends.void
die(Thing source, DieReason reason, AnimationInfo animation)
Sets the status of the thing to exploding (if it is not invulnerabe).protected void
doDetonate()
Performs the detonation.protected void
doSpecialUpdate(AnimationInfo animation)
If the state is TOBEDROPPED, the bomb is placed on the droppoint, and the audio clip set in the clipStr variable is played.ItemCategory
getCategory()
Returns the items category.int
getCountDown()
Gets the time till detonationint
getDetonationPower()
Gets the detonation power.int
getItemRating()
Returns an item value for ComputerFigures rating in the items category.java.lang.String
getPainterClassname()
Gets the fully qualified classname of the Painter to use for this item (in 2D game).java.lang.String
getPickupText()
Gets the text, if the item is picked up.BombState
getState()
Gets the bomb state.boolean
isActive()
Checks, if the rocket is active.boolean
isBomb()
Checks, if the item is a bomb.boolean
onBeHitByItem(Thing rammer, AnimationInfo animation)
Method called if another item moves to this items point (e.g. rockets).boolean
onBePickedUp(Figure picker, AnimationInfo animation)
If in inactive state, superclass implementation is called.boolean
onBeUsed(Figure user, AnimationInfo animation)
Uses the big mine, by setting state to TOBEDROPPED, which drops the mine as soon as the user moves.void
onEnemyKilled(Figure enemy, int round, DieReason reason, AnimationInfo animation)
Called, if the thing killed an enemy.protected int
onExplode(int min, Thing source, AnimationInfo animation)
Sets the status to exploding (if it is not invulnerabe).protected void
performFieldEffect(AnimationInfo animation)
If the state is active, the countdown is performed, if 0 is reached, the bomb detonates.-
Methods inherited from class com.starpoints.game.Item
affectsBlue, bePickedUp, beUsed, bombPlaced, createState, entersColor, explodes, gainsEnergy, gainsPermanentItem, gainsSlots, getDieReason, getDrawText, getItemRating, getMoveAnimationLength, getName, getPickUpClip, getPointBonus, getRamPower, getUseClip, getUser, heatChanges, is3DItem, isAffectedByColor, isAvailableInEditor, isRammed, isRocketTarget, isStunned, isWeapon, killedEnemy, losesEnergy, losesItem, losesPermanentItem, lostPermanentItem, onBeforeDie, onDrop, 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, 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, removeEnergy, retrieveState, setEnergy, setEnergyMaxCount, setGame, setMaxEnergy, setPoint, setStatus, staysOnColor, stepText, updateEnergy
-
-
-
-
Field Detail
-
DEBUG
protected static boolean DEBUG
Debug flag.
-
state
protected BombState state
Current state. INACTIVE as initial value.
-
clipStr
protected java.lang.String clipStr
A clip name after being dropped. "item_bigmine"
-
countDown
protected int countDown
Countdown counter.
-
maxcountDown
protected int maxcountDown
Initial countdown value.
-
dropPoint
protected Point dropPoint
The point to be dropped on.
-
explosionSource
protected Thing explosionSource
The source of the detonation.
-
-
Method Detail
-
addStateProperties
protected void addStateProperties(ThingState state, AnimationInfo animation)
Adds properties necessary for bigmine painting.- Overrides:
addStateProperties
in 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:
getPainterClassname
in classItem
- Returns:
- "com.starpoints.painter.arena2D.PainterItemBigMine"
-
getItemRating
public int getItemRating()
Returns an item value for ComputerFigures rating in the items category.- Overrides:
getItemRating
in classItem
- Returns:
- energy * 50.
-
getCategory
public ItemCategory getCategory()
Returns the items category.- Overrides:
getCategory
in classItem
- Returns:
- the category
-
isActive
public boolean isActive()
Checks, if the rocket is active.- Returns:
- state == ACTIVE
-
onEnemyKilled
public void onEnemyKilled(Figure enemy, int round, DieReason reason, AnimationInfo animation)
Called, if the thing killed an enemy.- Overrides:
onEnemyKilled
in classItem
- Parameters:
enemy
- The killed enemyround
- The round count.reason
- The die reason.animation
- The AnimationInfo.
-
onBePickedUp
public boolean onBePickedUp(Figure picker, AnimationInfo animation)
If in inactive state, superclass implementation is called. If active, and the picker can pick bombs, he can himself use the bomb, otherwise he explodes.- Overrides:
onBePickedUp
in classItem
- Parameters:
picker
- The pickeranimation
- The AnimationInfo.- Returns:
- true, if bomb can be picked up.
-
isBomb
public boolean isBomb()
Checks, if the item is a bomb.
-
getPickupText
public java.lang.String getPickupText()
Gets the text, if the item is picked up.- Overrides:
getPickupText
in classItem
- Returns:
- Value of pickupText if inactive.
-
onBeHitByItem
public boolean onBeHitByItem(Thing rammer, AnimationInfo animation)
Method called if another item moves to this items point (e.g. rockets). Returns true by default.- Overrides:
onBeHitByItem
in classItem
- Parameters:
rammer
- The ramming itemanimation
- The AnimationInfo.- Returns:
- true, if this item should die and be replaced by the other item. false, if this item should stay and the rammer die.
-
onExplode
protected int onExplode(int min, Thing source, AnimationInfo animation)
Sets the status to exploding (if it is not invulnerabe). Detonates, if active.
-
onBeUsed
public boolean onBeUsed(Figure user, AnimationInfo animation)
Uses the big mine, by setting state to TOBEDROPPED, which drops the mine as soon as the user moves.
-
doSpecialUpdate
protected void doSpecialUpdate(AnimationInfo animation)
If the state is TOBEDROPPED, the bomb is placed on the droppoint, and the audio clip set in the clipStr variable is played. If active, the countdown is performed, if 0 is reached, the bomb detonates.- Overrides:
doSpecialUpdate
in classItem
- Parameters:
animation
- The AnimationInfo.
-
performFieldEffect
protected void performFieldEffect(AnimationInfo animation)
If the state is active, the countdown is performed, if 0 is reached, the bomb detonates.- Overrides:
performFieldEffect
in classItem
- Parameters:
animation
- The AnimationInfo.
-
die
public void die(Thing source, DieReason reason, AnimationInfo animation)
Sets the status of the thing to exploding (if it is not invulnerabe). Plays an explosion sound with strength 2.
-
detonate
protected void detonate(AnimationInfo animation)
Makes the BigMine detonate, if count down ends.- Parameters:
animation
- The AnimationInfo.
-
doDetonate
protected void doDetonate()
Performs the detonation. Override to Detonates with a 3 point radius.
-
getDetonationPower
public int getDetonationPower()
Gets the detonation power.- Returns:
- 80 + energy*0.2
-
getCountDown
public int getCountDown()
Gets the time till detonation- Returns:
- The time till detonation in rounds.
-
getState
public BombState getState()
Gets the bomb state.- Returns:
- The bomb state.
-
-