@@ -13,4 +13,9 @@ public ShadowBlast(int manaCost) {
this();
this.setManaCost(manaCost);
}

@Override
protected String getType() {
return "shadowBlast";
}
}
@@ -20,4 +20,9 @@ public void perform(Avatar avatar){
super.perform(avatar);
}

@Override
protected String getType() {
return "flightBoon";
}

}
@@ -14,4 +14,9 @@ public HealBoon(int manaCost) {
this.setManaCost(manaCost);
}

@Override
protected String getType() {
return "healBoon";
}

}
@@ -14,4 +14,9 @@ public MovementBoon(int manaCost) {
this.setManaCost(manaCost);
}

@Override
protected String getType() {
return "movementBoon";
}

}
@@ -15,4 +15,9 @@ public StrengthBoon(int manaCost) {
this.setManaCost(manaCost);
}

@Override
protected String getType() {
return "strengthBoon";
}

}
@@ -14,4 +14,9 @@ public Cripple(int manaCost) {
this.setManaCost(manaCost);
}

@Override
protected String getType() {
return "cripple";
}

}
@@ -13,4 +13,9 @@ public Intimidate(int manaCost) {
this();
this.setManaCost(manaCost);
}

@Override
protected String getType() {
return "intimidate";
}
}
@@ -15,4 +15,9 @@ public Silence(int manaCost) {
this.setManaCost(manaCost);
}

@Override
protected String getType() {
return "silence";
}

}
@@ -1,12 +1,13 @@
package model.entity;

import factories.AbilityFactory;
import factories.SkillManagerFactory;
import gameactions.GameAction;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

import controller.listener.Listener;
import controller.listener.PollingListener;
import model.KeyPreferences;
import model.ability.Ability;
import model.area.RadialArea;
@@ -15,7 +16,10 @@
import model.light.MovingLightSource;
import model.light.Visibility;
import model.skillmanager.SkillManager;
import utilities.structuredmap.StructuredMap;
import view.EntityView;
import controller.listener.Listener;
import controller.listener.PollingListener;

public abstract class Avatar extends Entity {
private Collection<Ability> abilities = new ArrayList<Ability>();
@@ -25,6 +29,29 @@ public Avatar() {
//LightManager.getLightManager().getLightMap().trackMovement(this);
//setLocation(getLocation());//So lightMap registers current position
}

public Avatar(StructuredMap map) {
this.abilities = new ArrayList<Ability>();
StructuredMap[] abilityMap = map.getStructuredMapArray("abilities");
for(StructuredMap ability : abilityMap) {
this.abilities.add(AbilityFactory.createAbility(ability));
}
this.skillManager = SkillManagerFactory.createSkillManager(map.getStructuredMap("skills"));
}

@Override
public StructuredMap getStructuredMap() {
StructuredMap map = super.getStructuredMap();
StructuredMap[] abilityMap = new StructuredMap[this.abilities.size()];
int i = 0;
Iterator<Ability> it = abilities.iterator();
while(it.hasNext()) {
abilityMap[i++] = it.next().getStructuredMap();
}
map.put("abilities", abilityMap);
map.put("skills", skillManager.getStructuredMap());
return map;
}

public Avatar(String name, EntityView view, TileCoordinate loc){
super(name, view, loc);
@@ -60,6 +87,8 @@ public void perform() {

}



//Ovverrides stats and name? Says in UML, but that's weird
//Also overrides move, according to uml? Meh, if we need it, we'll do it, not before IMO

@@ -43,10 +43,13 @@ public Entity() {

public Entity(StructuredMap map) {
super(new TileCoordinate(map.getIntArray("location")[0], map.getIntArray("location")[1]));
name = map.getString("name");

this.name = map.getString("name");
int[] locationArray = map.getIntArray("location");
this.location = new TileCoordinate(locationArray[0], locationArray[1]);
this.stats = new EntityStatistics(map.getStructuredMap("stats"));
this.direction = Angle.values()[map.getInteger("direction")];
this.itemManager = new ItemManager(map.getStructuredMap("itemManager"));
this.isFlying = map.getBoolean("flying");
}

private void setNecessities() {
@@ -68,11 +71,14 @@ public StructuredMap getStructuredMap() {
map.put("location", locationArray);
map.put("stats", stats.getStructuredMap());
map.put("direction", direction.ordinal());
map.put("items", itemManager.getStructuredMap());
map.put("itemManager", itemManager.getStructuredMap());
map.put("type", getType());
map.put("flying", isFlying);

// TODO more createItemManager
return map;
}

public abstract String getType();

public abstract void load(StructuredMap map);

@@ -1,5 +1,21 @@
package model.entity;

import utilities.structuredmap.StructuredMap;

public class Mount extends NPC {

public Mount(StructuredMap map) {
super(map);
// TODO Auto-generated constructor stub
}

@Override
public StructuredMap getStructuredMap() {
return super.getStructuredMap();
}

@Override
public String getType() {
return "mount";
}
}
@@ -5,35 +5,43 @@

public class NPC extends Entity {

//Needs behavior shit!
//Behavior shit will be overridden by subclasses
// Needs behavior shit!
// Behavior shit will be overridden by subclasses

public NPC(StructuredMap map) {
super(map);
}

protected ItemManager createItemManager() {
return new ItemManager(this);
}

@Override
public void attack() {
// TODO Auto-generated method stub

}

@Override
public StructuredMap getStructuredMap() {
// TODO Auto-generated method stub
return null;
return super.getStructuredMap();
}

@Override
public void load(StructuredMap map) {
// TODO Auto-generated method stub

}

@Override
public void update() {
// TODO Auto-generated method stub


}

@Override
public String getType() {
return "npc";
}

}
@@ -1,7 +1,22 @@
package model.entity;

import utilities.structuredmap.StructuredMap;


public class Pet extends NPC {

public Pet(StructuredMap map) {
super(map);
}

@Override
public String getType() {
return "pet";
}

@Override
public StructuredMap getStructuredMap() {
return super.getStructuredMap();
}

}
@@ -9,6 +9,10 @@
public class Smasher extends Avatar {

public Smasher(){}

public Smasher(StructuredMap map) {
super(map);
}

public Smasher(String name, EntityView view, TileCoordinate loc) {
super(name, view,loc);
@@ -28,18 +32,22 @@ public void attack() {

@Override
public StructuredMap getStructuredMap() {
// TODO Auto-generated method stub
return null;
return super.getStructuredMap();
}

@Override
public void load(StructuredMap map) {
public void update() {
// TODO Auto-generated method stub

}

@Override
public void update() {
public String getType() {
return "smasher";
}

@Override
public void load(StructuredMap map) {
// TODO Auto-generated method stub

}
@@ -24,6 +24,10 @@ public Sneak(String name, EntityView view, TileCoordinate loc) {
this.getAbilities().add(new Ranged());
this.getAbilities().add(new RemoveTrap());
}

public Sneak(StructuredMap map) {
super(map);
}

protected ItemManager createItemManager() {
return new ItemManager(this);
@@ -37,8 +41,7 @@ public void attack() {

@Override
public StructuredMap getStructuredMap() {
// TODO Auto-generated method stub
return null;
return super.getStructuredMap();
}

@Override
@@ -54,4 +57,9 @@ public void update() {
}
//Wasn't sneak going to have creap, and pickpocket? Not in uml anymore, we should discuss

@Override
public String getType() {
return "sneak";
}

}
@@ -20,7 +20,9 @@ public class Summoner extends Avatar {




public Summoner(StructuredMap map) {
super(map);
}


public Summoner(String name, EntityView view, TileCoordinate loc) {
@@ -73,4 +75,12 @@ public void update() {
}




@Override
public String getType() {
return "summoner";
}


}
@@ -1,8 +1,10 @@
package model.event;

import model.entity.Entity;
import utilities.structuredmap.Saveable;
import utilities.structuredmap.StructuredMap;

public abstract class Event implements Cloneable{
public abstract class Event implements Cloneable, Saveable{

private final double CREATION_TIME = System.currentTimeMillis() / 1000.0;

@@ -62,4 +64,8 @@ protected boolean hasTarget() {
}

public abstract Event clone();

public StructuredMap getStructuredMap() {
return null;
}
}
@@ -1,15 +1,17 @@
package model.projectile;

import model.area.TileCoordinate;
import model.area.RadialArea;
import model.area.TileCoordinate;
import model.event.StatisticModifierEvent;
import model.statistics.EntityStatistics;
import model.trigger.SingleUseTrigger;
import model.trigger.Trigger;
import model.trigger.TriggerManager;
import utilities.Angle;
import utilities.structuredmap.Saveable;
import utilities.structuredmap.StructuredMap;

public class Projectile implements Cloneable {
public class Projectile implements Cloneable, Saveable {
private Angle direction;
private TileCoordinate location;
private double speed;
@@ -107,4 +109,8 @@ public Trigger getTrigger() {
public void setTrigger(Trigger trigger) {
this.trigger = trigger;
}

public StructuredMap getStructuredMap() {
return null;
}
}
@@ -6,8 +6,10 @@
import model.entity.Entity;
import model.event.Event;
import model.event.EventManager;
import utilities.structuredmap.Saveable;
import utilities.structuredmap.StructuredMap;

public abstract class Trigger implements Cloneable {
public abstract class Trigger implements Cloneable, Saveable {
private Area area;
private Event event;

@@ -20,6 +22,10 @@ public Trigger(Area area, Event event) {
this.area = area;
this.event = event;
}

public Trigger(StructuredMap map) {

}

public Area getArea() {
return area;
@@ -60,4 +66,8 @@ public void moveLocation(TileCoordinate location) {
public abstract boolean hasExpired();

public abstract Trigger clone();

public StructuredMap getStructuredMap() {
return null;
}
}