org.globalse.arena.sword.algorithm
Class Mission

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

public class Mission
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
Mission()
           
 
Method Summary
 void actionEvent(ObjectActionEvent event)
           
 void changeAdvHitpoints(java.lang.String adventurerName, double hitPoints)
           
 boolean checkAdvHitpointsGE(java.lang.String adventurerName, double hitPoints)
           
 MathVector checkCollision(java.lang.String other, MathVector oldPos, MathVector delta)
           
 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 createItems()
          Creates all Items listed in the mission description.
 void createLandscape(long seed, java.lang.String type, double water, double roughness)
           
 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)
           
 World getWorld()
          Returns the world of the mission.
 void init(GameManager gameManager)
          Constructs a new Mission object.
 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

Mission

public Mission()
Method Detail

init

public void init(GameManager gameManager)
          throws java.lang.Exception
Constructs a new Mission object.
Parameters:
GameManager - The FRAG Gamemanager
Throws:
java.lang.Exception - is thrown, if the mission description does not exist or if world creation fails
Preconditions:
the FRAG status already contains the MissionXML FRAGObject
Postconditions:
A world has been created, according to the mission description in MissionXML and all objects etc. have been created in frag.

getWorld

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

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(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

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

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

createItems

public void createItems()
Creates all Items listed in the mission description.
Preconditions:
the world has already been created
Postconditions:
all items are created and placed on the world

checkCollision

public MathVector checkCollision(java.lang.String other,
                                 MathVector oldPos,
                                 MathVector delta)

actionEvent

public void actionEvent(ObjectActionEvent event)



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