us.asciiroth.client.core
Interface Piece
- All Known Subinterfaces:
- Agent, Effect, Item, Terrain
- All Known Implementing Classes:
- AbstractAgent, AbstractAnimatedAgent, AbstractEffect, AbstractItem, AbstractPiece, AbstractTerrain, AgentDestroyer, AgentGate, AgentProxy, Agentray, Alder, Altar, AmmoBow, AmmoGun, AmmoParalyzer, AmmoSling, Apple, Archer, Arrow, Asciiroth, BeachGrass, BeeHive, BlueRing, Boards, Bomb, Bone, Bookshelf, Boulder, Bow, Bread, Bridge, BubblingLava, Bullet, BunchGrass, Bushes, Cactus, Campfire, CaveEntrance, Cephalid, Chalice, Chalk, ChalkedFloor, Chest, Cliff, Cloud, ColorRelay, Commoner, CopperPill, Corvid, Crate, Crevasse, Crowbar, Crystal, Cypress, Dagger, Decorator, Dirt, Door, DualTerrain, Elm, EmptyChest, EmptyHanded, EnergyCloud, EnergyTrapContainer, Equipper, EuclideanEngine, EuclideanShard, EuclideanTransporter, Exchanger, Fade, Farthapod, FarthapodNest, Fence, Field, Fir, Fire, Fireball, Fish, FishingPole, FishPool, Flagger, Floor, Flowers, ForceField, Forest, Fountain, Gate, GlassEye, GoldCoin, GoldenHarp, Grass, GreatOldOne, Grenade, Gun, Hammer, Haystack, Head, Healer, HelmOfTheAsciiroth, Hemlock, HighRocks, Hit, Hooloovoo, ImmobileAgent, ImpassableCliffs, InFlightItem, KelpSmoothie, Key, KeySwitch, KillerBee, Kiwi, Lava, LavaWorm, LightningLizard, LowRocks, MallocArcher, MallocCommoner, MallocNoble, MallocRifleman, MallocWizard, Maple, Messenger, Mimic, MirrorShield, Mud, Mushroom, Noble, NPC, Oak, Ocean, Open, OpeningMarker, Optilisk, Parabullet, Paralyzed, Paralyzer, PeachElixir, PieceCreator, Pier, Pillar, Pit, PitTrap, Player, PlayerGate, PoisonCloud, PoisonDart, PoisonTrapContainer, PressurePlate, ProteinBar, PurpleMushroom, Pusher, Pylon, PyramidWall, Raft, RedRing, Reflector, ResistancesCloud, ResistancesTrapContainer, Rhindle, Rifleman, Rock, RollingBoulder, Rubble, RustyGate, Sand, Scroll, Scrub, SecretPassage, ShallowSwamp, ShallowWater, Shooter, Sign, SilverAnkh, Sky, Sleestak, Slider, Sling, SlingRock, Smash, Spruce, StairsDown, StairsUp, Statue, Stoneray, Stump, Surf, Swamp, SwampGrass, Switch, Sword, TallGrass, Teleporter, TerminusEst, Tetrite, Thermadon, Throne, Timer, TrapContainerBase, TrashPile, Tree, Triffid, Trigger, TriggerIf, TriggerIfNot, TriggerOnce, TriggerOnceIf, TriggerOnceIfNot, TriggerOnceOnDrop, TriggerOnceOnPickup, Tumbleweed, Turnstile, Unequipper, Unflagger, Urn, VendingMachine, Wall, Water, Waterfall, Weakray, Weeds, Willow, WinGame, WishingWell, Wizard, WoodPiling
public interface Piece
An element of the game board. There are four kinds of pieces in the game: Terrain,
Items, Agents, and effects. The first three are immutable and declared in the
JSON-based map files. The fourth time, effects, are an extension of the implementation
of animation in the game and they implement certain game features like thrown or
shot items. Unlike the other three pieces, effects have state, they are created by
the game engine (not placed using the map editor), and they are not saved. Some, like
thrown items, will even delay a board save until they are played out.
All pieces are immutable. Their state is passed in via their constructor, their member
fields are final, and they transform the board by replacing themselves with other
pieces with different state. So all floor instances are the same instance, for example.
This allows pieces to be efficiently cached by the Registry, and retrieved by a key
that describes the entire state of the piece.
All pieces should have a public member field named SERIALIZER that implements a Serializer
for the piece (a class that can convert it back and forth from a string that is
embedded in the board JSON). The Serializer should be added to the Registry, see the
code in that class.
All pieces have color, even if the color is None. Color is a key attribute that can be
used to tie pieces together via a color event.
There is a parallel set of abstract classes that implement the piece type hierarchy.
Method Summary |
Color |
getColor()
What is the color of this piece? While many piece types are permanently
of color "None", many more can be parameterized with a color in order
to tie them together through color-based events. |
java.lang.String |
getName()
The visible name of the piece. |
Symbol |
getSymbol()
The symbol to display for this piece. |
boolean |
is(int flag)
Does this piece have the indicated bit flag? |
boolean |
not(int flag)
Does this piece not have the indicated flag? |
getColor
Color getColor()
- What is the color of this piece? While many piece types are permanently
of color "None", many more can be parameterized with a color in order
to tie them together through color-based events.
- Returns:
- the Color of this piece
getName
java.lang.String getName()
- The visible name of the piece.
- Returns:
- the name of the piece as displayed to the user.
getSymbol
Symbol getSymbol()
- The symbol to display for this piece.
- Returns:
- the symbol for this piece
is
boolean is(int flag)
- Does this piece have the indicated bit flag?
- Parameters:
flag
-
- Returns:
- true if piece has the flag
- See Also:
Flags
not
boolean not(int flag)
- Does this piece not have the indicated flag?
- Parameters:
flag
-
- Returns:
- true if piece does not have the flag
- See Also:
Flags
© 2009 Alx Dark