Package com.starpoints.game.figure
Class BigBossDuck
- java.lang.Object
-
- com.starpoints.game.Thing
-
- com.starpoints.game.Figure
-
- com.starpoints.game.ComputerFigure
-
- com.starpoints.game.figure.BigBossDuck
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable
public class BigBossDuck extends ComputerFigure
The Last Enemy of the Chaos Duck realm, consisting of 4 figures of this class, placed in a 2x2-square. Only works well in Inner Sanctum! Inactive, until all LaserTowers are destroyed. When active, duck moves randomly up or down, firing a flame thrower in rotating directions, if enemy is nearer than ENEMY_FIREDISTANCE. If destroyed, the BigBossDuck spawns two ItemNextLevel and a GoldenShield- and a DoubleShields-Item.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static intBOTTOMLEFTDirection constant for fire animation.static intBOTTOMRIGHTDirection constant for fire animation.static intNONEConstant for fire animation.static intTOPLEFTDirection constant for fire animation.static intTOPRIGHTDirection constant for fire animation.static int[]XDIFSX modifiers for firestatic int[]YDIFSY modifiers for fire-
Fields inherited from class com.starpoints.game.ComputerFigure
pointList, speedCount, wantsToEnterBlue
-
Fields inherited from class com.starpoints.game.Figure
ABSMAXENERGY, affectsBlue, alreadyKilled, colorlistener, DEFAULT_FIGURE_PAINTERCLASS, dieListener, dieReason, DOWN, energylistener, heatLevel, heatlistener, hoverCount, hoverHeight, hoverlistener, imageName, initialEnergy, INITIALRAMPOWER, isRocketTarget, item, itemlistener, killer, LEFT, lives, MAXHOVERHEIGHT, maxRadius, MAXSLOTS, money, moved, movelistener, name, number, oldItem, oldRocketXP, oldRocketYP, PANIC, penalty, permItems, pointBonus, pointlistener, points, ramlistener, ramPower, RIGHT, side, sinker, slots, STEPLEFT, STEPRIGHT, stunCount, stunlistener, sumPoints, UP, USE_ITEM, viewDir, visibilitylistener, visibleCount, wantsToUseItem, winCounter
-
Fields inherited from class com.starpoints.game.Thing
energy, energyFx, energyMaxSoundPlayed, energyModifications, explosionCounter, game, innerColor, invulnCount, isAffectedByBlack, isAffectedByGray, level, MAX_TEXTPAINT, maxEnergy, nextID, outerColor, p, shieldCount, status, text
-
-
Constructor Summary
Constructors Constructor Description BigBossDuck(Game game, FigureInfo f)Creates a BigBossDuck.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddStateProperties(ThingState state, AnimationInfo animation)Adds properties necessary for BigBossDuck painting.booleananyLaserTowerAlive()Checks, if any of the LaserTowers in the level is still alive.protected booleancheckEnemy(Figure f)Checks, if a figure is relevant for the closest enemy determination.protected PointdoCalculateNextPoint()This method is called each round, to get the next point for this figure when playing.protected voiddoSpecialUpdate(AnimationInfo animation)Updates after each round.intgetEnergySum()Returns the accumulated energy of all ducks.java.lang.StringgetImageName(AnimationInfo animation)Gets the image name for this figure.java.lang.StringgetPainterClassname()Gets the fully qualified classname of the Painter to use for this item (in 2D game).intgetPosition()Calculates this BigBossDucks position.booleanisAvailableInEditor()Checks, if this figure is available in level editor.booleanisDummy()Checks, if figure is a dummy (for level display).booleanisZombie()Checks, if Duck is already a zombie.protected intonAddHeat(int heat, boolean internal, Thing source)Returns 0.protected voidonAfterDeath(Point p, AnimationInfo animation)Called, directly after a figure dies and its point is unoccupied.protected booleanonBeforeDie(Thing source, DieReason reason, AnimationInfo animation)Called before the figure dies (after event handling in FigureKillListeners).protected intonBeforeRemoveEnergy(int min, Thing source, DieReason reason, AnimationInfo animation)Called before energy is removed from figure.protected intonExplode(int power, Thing source, AnimationInfo animation)Performed, when a thing stands in an explosion.protected voidreInit(Field field)Reinitializes the figure after each level.protected voidshoot(int xdif, int ydif)Performs the flame thrower effect.booleanwantsToMove()Checks, if the Duck wants to move .booleanwantsToUseItem()This method is called each round, if the figure has an item, to check, if the item should be used.-
Methods inherited from class com.starpoints.game.ComputerFigure
calculateItemRating, calculateNextPoint, calculatePointRating, entersExplosion, findClosestEnemy, getDistance, getDistance, getIq, isApplyingLevelInfoIQ, isForbiddenItem, isRamTarget, isUnwantedItem, isVisible, modifyByColor
-
Methods inherited from class com.starpoints.game.Figure
addEnergy, addFigureColorListener, addFigureEnergyListener, addFigureHeatListener, addFigureHoverListener, addFigureItemListener, addFigureKillListener, addFigureMoveListener, addFigurePointListener, addFigureRamListener, addFigureStunListener, addFigureVisibilityListener, addHeat, addInitialEnergy, addLife, addMaxEnergy, addMoney, addPenalty, addPermanentItem, addPoints, addSlots, affectsBlue, beforeMove, beRammed, createState, determineIQ, determineIQ, die, drawState, entersColor, fireColorEnterEvent, fireColorStayEvent, fireDieEvent, fireEnergyChangeEvent, fireEnergyLossEvent, fireGainPermanentItemEvent, fireHeatChangeEvent, fireHoverEvent, fireKillsEnemy, fireLoseItemEvent, fireLosePermanentItemEvent, fireLostPermanentItemEvent, fireMoveEvent, firePickesUpBombEvent, firePickesUpExplosiveEvent, firePickesUpItemEvent, firePointsChangeEvent, firePointSumChangeEvent, fireRamEvent, fireRamPowerEvent, fireSlotsChangeEvent, fireStunEvent, fireUseItemEvent, fireVisibilityChangesEvent, getDieReason, getDyingClip, getExplosionClip, getFreeSlots, getHeatLevel, getHoverHeight, getHoverRounds, getInitialEnergy, getInvisibilityRounds, getItem, getKillBonus, getLifes, getMaxSlots, getMoney, getName, getNumber, getPermanentItems, getPoints, getPointSum, getRamPower, getSlots, getSpeed, getStunCount, getWinCount, hasMoved, hasPermanentItem, hasPermanentItem, hover, increasePointSum, invulnerable, isAffectedByBlack, isAffectedByGray, isApplyingLevelInfoSpeed, isDrawingNumber, isHovering, isRocketTarget, isSinking, isStunned, isVisible, loseItem, losePermanentItem, losePermanentItem, losePermanentItemInternal, onEnemyKilled, onRoundBegin, playDyingSound, removeEnergy, removeFigureColorListener, removeFigureEnergyListener, removeFigureHeatListener, removeFigureHoverListener, removeFigureItemListener, removeFigureKillListener, removeFigureMoveListener, removeFigurePointListener, removeFigureRamListener, removeFigureStunListener, removeFigureVisibilityListener, removeMoney, removePoints, retrieveNextPoint, sellPermanentItem, setHoverCount, setHoverHeight, setInitialEnergy, setInvisible, setIq, setIsRocketTarget, setItem, setMaxEnergy, setMoney, setName, setNumber, setPoint, setSlots, setSpeed, setVisible, sink, staysOnColor, stopHover, stopSink, stun, takeItem, toString, updateExplodingStatus, updatePoints, updateThing, useItem, win
-
Methods inherited from class com.starpoints.game.Thing
addShielding, clearTexts, displayText, displayText, 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, isDestroyed, isExploding, isInvulnerable, isOK, isShowingEnergyFx, retrieveState, setEnergy, setEnergyMaxCount, setGame, setStatus, stepText, updateEnergy
-
-
-
-
Field Detail
-
NONE
public static final int NONE
Constant for fire animation.- See Also:
- Constant Field Values
-
TOPLEFT
public static final int TOPLEFT
Direction constant for fire animation.- See Also:
- Constant Field Values
-
TOPRIGHT
public static final int TOPRIGHT
Direction constant for fire animation.- See Also:
- Constant Field Values
-
BOTTOMLEFT
public static final int BOTTOMLEFT
Direction constant for fire animation.- See Also:
- Constant Field Values
-
BOTTOMRIGHT
public static final int BOTTOMRIGHT
Direction constant for fire animation.- See Also:
- Constant Field Values
-
XDIFS
public static final int[] XDIFS
X modifiers for fire
-
YDIFS
public static final int[] YDIFS
Y modifiers for fire
-
-
Constructor Detail
-
BigBossDuck
public BigBossDuck(Game game, FigureInfo f)
Creates a BigBossDuck.- Parameters:
game- The game.f- The figure info.
-
-
Method Detail
-
addStateProperties
protected void addStateProperties(ThingState state, AnimationInfo animation)
Adds properties necessary for BigBossDuck 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 classFigure- Returns:
- "com.starpoints.painter.arena2D.PainterBigBossDuck"
-
isAvailableInEditor
public boolean isAvailableInEditor()
Checks, if this figure is available in level editor.- Overrides:
isAvailableInEditorin classFigure- Returns:
- false.
-
isZombie
public boolean isZombie()
Checks, if Duck is already a zombie.- Returns:
- true, if Duck is already a zombie.
-
isDummy
public boolean isDummy()
Checks, if figure is a dummy (for level display).- Overrides:
isDummyin classComputerFigure- Returns:
- true for all but topleft BigBossDuck.
-
getImageName
public java.lang.String getImageName(AnimationInfo animation)
Gets the image name for this figure.- Overrides:
getImageNamein classFigure- Parameters:
animation- AnimationInfo.- Returns:
- "bb_"+getDirString()
-
getPosition
public int getPosition()
Calculates this BigBossDucks position.- Returns:
- The position.
-
doCalculateNextPoint
protected Point doCalculateNextPoint()
This method is called each round, to get the next point for this figure when playing. If any drone explodes, the BigBoss does not move. Otherwise superclasses method is called. Stores the next point for acccess by drones.- Overrides:
doCalculateNextPointin classComputerFigure- Returns:
- This figures next point
-
onAddHeat
protected int onAddHeat(int heat, boolean internal, Thing source)Returns 0. Big Boss is immune to heat.
-
onExplode
protected int onExplode(int power, Thing source, AnimationInfo animation)Performed, when a thing stands in an explosion. Ignores self-sourced explosions.
-
onBeforeRemoveEnergy
protected int onBeforeRemoveEnergy(int min, Thing source, DieReason reason, AnimationInfo animation)Called before energy is removed from figure. Override in subclasses to modify energy losses. Returns the original energy loss by default.- Overrides:
onBeforeRemoveEnergyin classFigure- Parameters:
min- The energy loss.source- the source.reason- The energy removal reason.animation- The AnimationInfo- Returns:
- The modified energy loss.
-
onBeforeDie
protected boolean onBeforeDie(Thing source, DieReason reason, AnimationInfo animation)
Called before the figure dies (after event handling in FigureKillListeners). Checks if all other ducks are zombies already, if yes, all others are notifies to die (finally). Otherwise this duck becomes a zombie, and false is returned to keep this duck alive, until all others are dead as well.- Overrides:
onBeforeDiein classFigure- Parameters:
source- The death source.reason- The death reason.animation- The AnimationInfo- Returns:
- true, if figure really dies, false to prevent that. true by default.
-
getEnergySum
public int getEnergySum()
Returns the accumulated energy of all ducks.- Returns:
- The accumulated energy of all ducks.
-
wantsToUseItem
public boolean wantsToUseItem()
This method is called each round, if the figure has an item, to check, if the item should be used.- Overrides:
wantsToUseItemin classFigure- Returns:
- true, if this figure wants to use it's item.
-
wantsToMove
public boolean wantsToMove()
Checks, if the Duck wants to move .- Overrides:
wantsToMovein classComputerFigure- Returns:
- true, if this figure wants to move.
-
anyLaserTowerAlive
public boolean anyLaserTowerAlive()
Checks, if any of the LaserTowers in the level is still alive.- Returns:
- true, if any of the LaserTowers in the level is still alive.
-
doSpecialUpdate
protected void doSpecialUpdate(AnimationInfo animation)
Updates after each round. Drops any item that might have been picked up. Checks for the FlameThrower effect and loads a rocket, if all drones are dead.- Overrides:
doSpecialUpdatein classComputerFigure- Parameters:
animation- The AnimationInfo.
-
onAfterDeath
protected void onAfterDeath(Point p, AnimationInfo animation)
Called, directly after a figure dies and its point is unoccupied. Places an ItemSecretLevel, that is activated for 8 rounds.- Overrides:
onAfterDeathin classFigure- Parameters:
p- The pointanimation- T-he AnimationInfo
-
shoot
protected void shoot(int xdif, int ydif)Performs the flame thrower effect.- Parameters:
xdif- X addition depending on shoot direction.ydif- y addition depending on shoot direction.
-
checkEnemy
protected boolean checkEnemy(Figure f)
Checks, if a figure is relevant for the closest enemy determination.- Overrides:
checkEnemyin classComputerFigure- Parameters:
f- The figure.- Returns:
- true, if figure is not this figure, is visible and ok.
-
-