org.globalse.arena.sword.algorithm
Class DummyMission

java.lang.Object
  |
  +--org.globalse.arena.sword.algorithm.DummyMission

public class DummyMission
extends java.lang.Object
implements MissionListener, WorldStatus, UserActionListener

The class Mission is responsible for realizing the Mission description. There is only one instance of the class during program execution. It takes as an input the mission description file and creates the game world and all objects and artificial players. During gameplay, it watches all player actions, to check wether any subtasks of the mission are fulfilled. If so, it can generate actions in the game world and change its state.

A simple example:

The mission description states, that if the player uses a special magic wand with a stone, the stone vanishes, revealing a secret entrance. In this case, the Mission object must take the necessary actions to remove the stone, if the player uses the wand with it. For this it has to know all user actions.

Therefore it has one method for every kind of action that a player can do. Seen from a different perspective, Mission is a view for player actions and a controller for the game world / frag.


Constructor Summary
DummyMission(GameManager gameManager, java.lang.String gamename)
          Constructs a new Mission object.
 
Method Summary
 void actionEvent(ObjectActionEvent event)
           
 void changeAdvHitpoints(java.lang.String adventurerName, double hitPoints)
           
 boolean checkAdvHitpointsGE(java.lang.String adventurerName, double hitPoints)
           
 boolean checkHasItem(java.lang.String adventurerName, java.lang.String itemName)
           
 boolean checkItemExists(java.lang.String itemName)
           
 void createConsumableItem(java.lang.String objectName, double weight, java.lang.String type, double healthBonus, double healthMaxBonus, double manaBonus, double manaMaxBonus, double magicPowerBonus, double magicInventoryMaxBonus, double strenghtBonus, double x, double y)
           
 void createItem(java.lang.String objectName, double weight, java.lang.String type, double x, double y)
          Used to construct a new Item (the Item class has no deafult UseWith behaviour).
 void createItems()
           
 void createLandscape(long seed, java.lang.String type, double water, double roughness)
           
 void createSpell(double weight, java.lang.String name, double healthBonus, double healthMaxBonus, double manaBonus, double manaMaxBonus, double magicPowerBonus, double inventoryMaxBonus, double strengthBonus, double manaNeeded, double magicPowerNeeded, double x, double y)
           
 void createSpell(java.lang.String objectName, double weight, java.lang.String type, double healthBonus, double healthMaxBonus, double manaBonus, double manaMaxBonus, double magicPowerBonus, double inventoryMaxBonus, double strengthBonus, double manaNeeded, double magicPowerNeeded, double x, double y)
           
 void createWeapon(java.lang.String objectName, double weight, java.lang.String type, double damage, double range, double x, double y)
           
 void drop(java.lang.String itemName, java.lang.String adventurerName)
           
 Landscape getLandscape()
           
 World getWorld()
          Returns the world of the mission.
 void lookAt(java.lang.String itemName, java.lang.String adventurerName)
           
 void pickUp(java.lang.String itemName, java.lang.String adventurerName)
           
 void useWith(java.lang.String item1Name, java.lang.String item2Name, java.lang.String adventurerName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DummyMission

public DummyMission(GameManager gameManager,
                    java.lang.String gamename)
             throws java.lang.Exception
Constructs a new Mission object.
Parameters:
missionFilename - A stream that has stored the mission description (probably a file stream to the mission description file)
Throws:
java.lang.Exception - is thrown, if the mission description has errors or if world creation fails
Preconditions:
missionDescription is a valid mission description.
Postconditions:
A world has been created, according to the mission description and all objects etc. have been created in frag.
Method Detail

getWorld

public World getWorld()
Returns the world of the mission.
Returns:
the mission world

getLandscape

public Landscape getLandscape()

pickUp

public void pickUp(java.lang.String itemName,
                   java.lang.String adventurerName)
Specified by:
pickUp in interface UserActionListener

lookAt

public void lookAt(java.lang.String itemName,
                   java.lang.String adventurerName)
Specified by:
lookAt in interface UserActionListener

drop

public void drop(java.lang.String itemName,
                 java.lang.String adventurerName)
Specified by:
drop in interface UserActionListener

useWith

public void useWith(java.lang.String item1Name,
                    java.lang.String item2Name,
                    java.lang.String adventurerName)
Specified by:
useWith in interface UserActionListener

checkItemExists

public boolean checkItemExists(java.lang.String itemName)
Specified by:
checkItemExists in interface WorldStatus

checkHasItem

public boolean checkHasItem(java.lang.String adventurerName,
                            java.lang.String itemName)
Specified by:
checkHasItem in interface WorldStatus

checkAdvHitpointsGE

public boolean checkAdvHitpointsGE(java.lang.String adventurerName,
                                   double hitPoints)
Specified by:
checkAdvHitpointsGE in interface WorldStatus

changeAdvHitpoints

public void changeAdvHitpoints(java.lang.String adventurerName,
                               double hitPoints)
Specified by:
changeAdvHitpoints in interface WorldStatus

createLandscape

public void createLandscape(long seed,
                            java.lang.String type,
                            double water,
                            double roughness)
Specified by:
createLandscape in interface MissionListener

createSpell

public void createSpell(double weight,
                        java.lang.String name,
                        double healthBonus,
                        double healthMaxBonus,
                        double manaBonus,
                        double manaMaxBonus,
                        double magicPowerBonus,
                        double inventoryMaxBonus,
                        double strengthBonus,
                        double manaNeeded,
                        double magicPowerNeeded,
                        double x,
                        double y)

createConsumableItem

public void createConsumableItem(java.lang.String objectName,
                                 double weight,
                                 java.lang.String type,
                                 double healthBonus,
                                 double healthMaxBonus,
                                 double manaBonus,
                                 double manaMaxBonus,
                                 double magicPowerBonus,
                                 double magicInventoryMaxBonus,
                                 double strenghtBonus,
                                 double x,
                                 double y)
Specified by:
createConsumableItem in interface MissionListener

createItem

public void createItem(java.lang.String objectName,
                       double weight,
                       java.lang.String type,
                       double x,
                       double y)
Used to construct a new Item (the Item class has no deafult UseWith behaviour). Use this method to construct new items in the world that can do not fall into the other three categories.

createItems

public void createItems()

actionEvent

public void actionEvent(ObjectActionEvent event)

createSpell

public void createSpell(java.lang.String objectName,
                        double weight,
                        java.lang.String type,
                        double healthBonus,
                        double healthMaxBonus,
                        double manaBonus,
                        double manaMaxBonus,
                        double magicPowerBonus,
                        double inventoryMaxBonus,
                        double strengthBonus,
                        double manaNeeded,
                        double magicPowerNeeded,
                        double x,
                        double y)
Specified by:
createSpell in interface MissionListener
See Also:
MissionListener.createSpell(java.lang.String, double, java.lang.String, double, double, double, double, double, double, double, double, double, double, double)

createWeapon

public void createWeapon(java.lang.String objectName,
                         double weight,
                         java.lang.String type,
                         double damage,
                         double range,
                         double x,
                         double y)
Specified by:
createWeapon in interface MissionListener
See Also:
MissionListener.createWeapon(java.lang.String, double, java.lang.String, double, double, double, double)



This page is hosted by the Chair for Applied Software Engineering of the Technische Universität München.
Imprint (Impressum)