Skip to content

Commit

Permalink
Merge branch 'minionTypes' into SolomonsBranch
Browse files Browse the repository at this point in the history
Conflicts:
	src/MockGui.java - (resolved - import conflict)
  • Loading branch information
dwm10005 committed Apr 13, 2015
2 parents fd72ee9 + dc7be07 commit b82d02c
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 81 deletions.
10 changes: 10 additions & 0 deletions src/MinionFactory.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import java.util.Random;

public class MinionFactory {
private int X, Y;
private MapTowerDefense map;
private MinionMock[] minions;
private int Max;
private int id;
private Random rand;
private MinionTypes[] types;

public MinionFactory(int x, int y, MapTowerDefense _map) {
X = x;
Expand All @@ -13,6 +16,8 @@ public MinionFactory(int x, int y, MapTowerDefense _map) {
Max = 100;
id = 0;
minions = new MinionMock[Max];
rand = new Random();
types = MinionTypes.values();
}

public void createMinion(MinionTypes type) {
Expand All @@ -22,6 +27,11 @@ public void createMinion(MinionTypes type) {
id++;
}
}
public void createRandominion()
{
this.createMinion(types[rand.nextInt(types.length)]);
}

public MinionMock[] getMinions() {
return minions;
}
Expand Down
85 changes: 5 additions & 80 deletions src/MinionTypes.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@

public enum MinionTypes {

BASIC (255, 1, 1);
//NAME (Health, Attack, Speed)
WEAKLING(100, 1, 1),
BASIC (255, 1, 1),
SPEEDO (100, 1, 4),
SUPERSPEEDO (255, 1, 4);

private int health, attackDamage, movementSpeed;

Expand All @@ -22,82 +25,4 @@ public int getAttackDamage() {
public int getMovementSpeed() {
return movementSpeed;
}

/*
public int getType() {
return type;
}
*/

/*
public int findDirection() {
if (visits == map.getNum()) {
// CALL TO MAKE NEXUS LOSE HEALTH
return -1;
} else {
int xGoal = map.getNodes()[visits][0];
int yGoal = map.getNodes()[visits][1];
int[] Goals = map.getGui().hash(xGoal, yGoal);
xGoal = Goals[0];
yGoal = Goals[1];
if (x == xGoal) {
if (y == yGoal) {
visits++;
return findDirection();
}
if (yGoal > y) {
// MOVE DOWN
return 2;
} else {
return 0;
}
} else {
if (x > xGoal) {
return 3;
} else {
return 1;
}
}
}
}
public boolean go() {
int direction = findDirection();
if (direction == -1) {
alive = false;
return map.getTF().getTowerArray()[0].takeDamage();
}
if (direction == 0) {
y-=movespeed;
}
if (direction == 1) {
x+=movespeed;
}
if (direction == 2) {
y+=movespeed;
}
if (direction == 3) {
x-=movespeed;
}
return false;
}
public boolean isAlive() {
return alive;
}
public int getHealth() {
return health;
}
public void minionTakeDamage() {
int dam = map.getTF().assignTotalDamage(x, y);
health-=dam;
if (health <= 0) {
alive = false;
}
}
*/
}
3 changes: 2 additions & 1 deletion src/MockGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
import java.util.Random;



Expand Down Expand Up @@ -60,7 +61,7 @@ public void step() {
map.getMF().assignAllDamage();

if (i > 63) {
map.createMinion(MinionTypes.BASIC);
map.getMF().createRandominion();
i = 0;
}
//
Expand Down
10 changes: 10 additions & 0 deletions src/TowerFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,17 @@ public void createNexus(){
}

public void createBasicTower(int x, int y){
//Checks if there's already a tower here
//TODO make this better
if (quantity < _max) {
int i = 0;
while (i < quantity) {
if ((towerarray[i].getTowerXlocation() == x) && (towerarray[i].getTowerYlocation() == y)) {
System.out.println("CONSEQUENCES WILL NEVER BE THE SAME"); //informal logging
return;
}
i++;
}
towerarray[quantity] = new TowerMock(quantity, x, y, true);
quantity++;
}
Expand Down

0 comments on commit b82d02c

Please sign in to comment.