Package com.starpoints.game
Class BonusManager
- java.lang.Object
-
- com.starpoints.game.BonusManager
-
- All Implemented Interfaces:
FigureItemListener,FigureKillListener,java.io.Serializable
public class BonusManager extends java.lang.Object implements java.io.Serializable, FigureKillListener, FigureItemListener
Class for managing player boni.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<PlayerFigure>blackRainsprotected static int[]DESTRUCTION_BONUSprotected static int[]EXPLOSION_BONUSprotected static int[]EXPLOSION_BONUSLIMITprotected Gamegameprotected static int[]HOVER_BONUSprotected static int[]HOVER_BONUSLIMITprotected java.util.List<com.starpoints.game.BonusManager.PlayerBonusInfo>playerInfosprotected java.util.List<PlayerFigure>soundsprotected static int[]STUN_BONUSprotected static int[]STUN_BONUSLIMIT
-
Constructor Summary
Constructors Constructor Description BonusManager(Game game)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BonusDescriptorcalculateBonus(PlayerFigure f)booleanexplodes(Figure f, Thing source, DieReason reason, AnimationInfo animation)Called, if the figure is destroyed.booleangainsPermanentItem(Figure figure, Item it, AnimationInfo animation)Called, if the figure adds a permananent item to its inventory.intgainsSlots(Figure f, int slots, AnimationInfo animation)Called, if the figure gains slots.com.starpoints.game.BonusManager.PlayerBonusInfogetBonusInfo(PlayerFigure player)voidkilledEnemy(Figure f, Figure enemy, DieReason reason, AnimationInfo animation)Called, if the figure kills an enemybooleanlosesItem(Figure f, Item i, AnimationInfo animation)Called, if the figure loses an item.booleanlosesPermanentItem(Figure f, Item i, AnimationInfo animation)Called, if the figure uses a permanent item by some external effect (dark red point or rocket).voidlostPermanentItem(Figure f, Item i, AnimationInfo animation)Called, if the figure finally lost a permanent item by some external effect (dark red point or rocket).booleanpickesUpBomb(Figure f, Item explosive, AnimationInfo animation)Called, if the figure pickes up a bomb or active bigmine.booleanpickesUpExplosive(Figure f, Item i, AnimationInfo animation)Called, if the figure picks up an exploding item.booleanpickesUpItem(Figure f, Item i, AnimationInfo animation)Called, if the figure picks up an item.voidreInit()Reinitializes the BonusManager for a new level.voidupdate()Updates explosion counters.booleanusesItem(Figure f, Item i, AnimationInfo animation)Called, if the figure uses an item.
-
-
-
Field Detail
-
game
protected Game game
-
playerInfos
protected java.util.List<com.starpoints.game.BonusManager.PlayerBonusInfo> playerInfos
-
blackRains
protected java.util.List<PlayerFigure> blackRains
-
sounds
protected java.util.List<PlayerFigure> sounds
-
DESTRUCTION_BONUS
protected static final int[] DESTRUCTION_BONUS
-
EXPLOSION_BONUSLIMIT
protected static final int[] EXPLOSION_BONUSLIMIT
-
EXPLOSION_BONUS
protected static final int[] EXPLOSION_BONUS
-
HOVER_BONUSLIMIT
protected static final int[] HOVER_BONUSLIMIT
-
HOVER_BONUS
protected static final int[] HOVER_BONUS
-
STUN_BONUSLIMIT
protected static final int[] STUN_BONUSLIMIT
-
STUN_BONUS
protected static final int[] STUN_BONUS
-
-
Constructor Detail
-
BonusManager
public BonusManager(Game game)
-
-
Method Detail
-
update
public void update()
Updates explosion counters.
-
calculateBonus
public BonusDescriptor calculateBonus(PlayerFigure f)
-
reInit
public void reInit()
Reinitializes the BonusManager for a new level.
-
getBonusInfo
public com.starpoints.game.BonusManager.PlayerBonusInfo getBonusInfo(PlayerFigure player)
-
killedEnemy
public void killedEnemy(Figure f, Figure enemy, DieReason reason, AnimationInfo animation)
Description copied from interface:FigureKillListenerCalled, if the figure kills an enemy- Specified by:
killedEnemyin interfaceFigureKillListener- Parameters:
f- The killer.enemy- The enemy that was killed.reason- The death reason.animation- The AnimationInfo
-
explodes
public boolean explodes(Figure f, Thing source, DieReason reason, AnimationInfo animation)
Description copied from interface:FigureKillListenerCalled, if the figure is destroyed.- Specified by:
explodesin interfaceFigureKillListener- Parameters:
f- The figure that was killed.source- The source that killed the figure.reason- The death reason.animation- The AnimationInfo- Returns:
- true, if destruction is ok, false, if figure survives the explosion.
-
gainsSlots
public int gainsSlots(Figure f, int slots, AnimationInfo animation)
Description copied from interface:FigureItemListenerCalled, if the figure gains slots. The figures slot count has not changed, when this method is called. If a value different to slots is returned, this value is added instead. If more listeners change the slot gain for the figure, the effect is cumulative.- Specified by:
gainsSlotsin interfaceFigureItemListener- Parameters:
f- The figure.slots- Number of slots.animation- The AnimationInfo.- Returns:
- Modified number of slots.
-
pickesUpBomb
public boolean pickesUpBomb(Figure f, Item explosive, AnimationInfo animation)
Description copied from interface:FigureItemListenerCalled, if the figure pickes up a bomb or active bigmine.- Specified by:
pickesUpBombin interfaceFigureItemListener- Parameters:
f- The figure.explosive- The explosive item.animation- The AnimationInfo.- Returns:
- Return true, to indicate that the figure can pick up the explosive item.
-
losesItem
public boolean losesItem(Figure f, Item i, AnimationInfo animation)
Description copied from interface:FigureItemListenerCalled, if the figure loses an item. Listeners might prevent that.- Specified by:
losesItemin interfaceFigureItemListener- Parameters:
f- The figure.i- The item that is lost.animation- The AnimationInfo.- Returns:
- Return true, to indicate that the figure loses the item, false to prevent that.
-
losesPermanentItem
public boolean losesPermanentItem(Figure f, Item i, AnimationInfo animation)
Description copied from interface:FigureItemListenerCalled, if the figure uses a permanent item by some external effect (dark red point or rocket). The method is not called, if a permanent item is used up.- Specified by:
losesPermanentItemin interfaceFigureItemListener- Parameters:
f- The figure.i- The item.animation- The AnimationInfo.- Returns:
- true, if item is really lost.
-
lostPermanentItem
public void lostPermanentItem(Figure f, Item i, AnimationInfo animation)
Description copied from interface:FigureItemListenerCalled, if the figure finally lost a permanent item by some external effect (dark red point or rocket).- Specified by:
lostPermanentItemin interfaceFigureItemListener- Parameters:
f- The figure.i- The item.animation- The AnimationInfo.
-
pickesUpItem
public boolean pickesUpItem(Figure f, Item i, AnimationInfo animation)
Description copied from interface:FigureItemListenerCalled, if the figure picks up an item. Listeners might prevent that.- Specified by:
pickesUpItemin interfaceFigureItemListener- Parameters:
f- The figure.i- The item that is picked up.animation- The AnimationInfo.- Returns:
- Return true, to indicate that the figure picks up the item, false to prevent that.
-
usesItem
public boolean usesItem(Figure f, Item i, AnimationInfo animation)
Description copied from interface:FigureItemListenerCalled, if the figure uses an item. Listeners might prevent that.- Specified by:
usesItemin interfaceFigureItemListener- Parameters:
f- The figure.i- The item that is used.animation- The AnimationInfo.- Returns:
- Return true, to indicate that the figure can use the item, false to prevent that.
-
pickesUpExplosive
public boolean pickesUpExplosive(Figure f, Item i, AnimationInfo animation)
Description copied from interface:FigureItemListenerCalled, if the figure picks up an exploding item. Listeners might prevent the immense energy loss resulting from that.- Specified by:
pickesUpExplosivein interfaceFigureItemListener- Parameters:
f- The figure.i- The item that is picked up.animation- The AnimationInfo.- Returns:
- Return false, to indicate that the figure can pick the item without damage.
-
gainsPermanentItem
public boolean gainsPermanentItem(Figure figure, Item it, AnimationInfo animation)
Description copied from interface:FigureItemListenerCalled, if the figure adds a permananent item to its inventory. Listeners might prevent that.- Specified by:
gainsPermanentItemin interfaceFigureItemListener- Parameters:
figure- The figure.it- The item that is used.animation- The AnimationInfo.- Returns:
- Return true, to indicate that the figure can add the permananent item, false to prevent that.
-
-