Ninja GuildNinja GuildRyan WilsonRyan Wilson
Alex KlinkhamerAlex KlinkhamerJason VivianJason Vivian
CS 3141 – Spring 2009CS 3141 – Spring 2009Michigan Tech UniversityMichigan Tech University
Entity
positionX < size, positionX >=0, positionY < size, positionY >=0
An entity is always inside a room, so its position should always be within the bounds of the size of the room.
Fighter CharacterInvariant: HP <= maxHP,
A fighter character can never have a current health value over his starting or initial one.
move -pre: requestedPosition.isValid == true, AP > 0post: positionX < size, positionX >=0, positionY < size, positionY >=0; AP = AP-1
In order to move, the position that you want to move to has to be a valid one inside the grid. After this method completes, you should still have a valid position (a new one) and your AP should be -1 what it used to be.
attack -pre: x == positionX +| - 1, y == positionY +| - 1, position(x,y) instanceOf fighterCharacterpost: positions (old) == positions (new)
To attack, the square you want to attack has to be adjacent to you. This method should not change the positions of any entities.
die -pre: HP <=0 && isAlive == truepost: isAlive == false
“Death” comes to a player or enemy when their HP reaches zero.
DungeonInvariant: target (old) == target (new); roomList (old) == roomList (new)
The dungeon’s invariant simply makes sure that the game constants don’t change. The target, or goal of the game, should never change throughout the game. Also, the rooms inside the dungeon should not change at all (even though they are randomized at the start).
playersWin -pre: target.hp == 0post: winScreen.visible == true
The players win when the successfully assassinate the target. This means that they bring its health, or HP, to 0. After this method is called, a win screen should be displayed and the game should be over.
PlayerInvariant: Ninja != null
The player always should have a Ninja to play the game with.
sendMove -pre: isConnected == truepost: isConnected == true
In order to send the game a move, the player must be connected to the system.
endTurn -pre: myTurn==true, isConnected == truepost: myTurn == false
For the player to end his turn, he must be connected to the system, and it must be his turn. After this method ends, it should no longer be that player’s turn.
takeAction -pre: isConnected == true, AP > 0post: AP (new) < AP (old)
To take an action, the player must be connected to the system as well as have more AP (action points) to use.
Item
Invariant: numUses >=0
An item cannot have negative uses. This would most likely cause a bug where an item could be used an infinite amount of times.
doEffect -pre: numUses > 0post: numUses (new) == numUses (old) – 1
To do an item effect, the item has to have uses left. Afterwords, the use count should be one less than it was before.
Dungeon Creation
For each room
Randomize 2-4 doors
check door adjacency
Randomize 1-5 enemies
Randomize 1-5 pillars
Randomize 1 light
setShadows
loop
setShadows
For each pillar
For X position, mark opposite squares
For Y position, mark opposite squares
loop
for each square
if square has been marked twice
mark as shadowed
loop
Questions?Questions?