Skip to content

Commit

Permalink
Merge pull request #214 from UQcsse3200/Team-1--Mobs-Enhancement
Browse files Browse the repository at this point in the history
Team 1 Mobs Enhancement (bug fixes)
  • Loading branch information
MiniSoda17 authored Oct 3, 2023
2 parents 85d6caa + f9f5aa6 commit 8114486
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ private int getInactivePriority() {
* @return true if a target is visible, false otherwise
*/
private boolean isTargetVisible() {
Vector2 newVector = new Vector2(owner.getEntity().getPosition().x - 10f, owner.getEntity().getPosition().y - 2f);
Vector2 newVector = new Vector2(owner.getEntity().getPosition().x - 100f, owner.getEntity().getPosition().y - 2f);
return physics.raycast(owner.getEntity().getPosition(), newVector, TARGET, hit);
}

Expand Down Expand Up @@ -236,7 +236,7 @@ private Weapon meleeOrProjectile() {
}

private void setTarget() {
Vector2 newVector = new Vector2(owner.getEntity().getPosition().x - 10f, owner.getEntity().getPosition().y - 2f);
Vector2 newVector = new Vector2(owner.getEntity().getPosition().x - 100f, owner.getEntity().getPosition().y - 2f);
target = physics.raycastGetHit(owner.getEntity().getPosition(), newVector, TARGET);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ private int getInactivePriority() {
* @return true if a target is visible, false otherwise
*/
private boolean isTargetVisible() {
Vector2 newVector = new Vector2(owner.getEntity().getPosition().x - 10f, owner.getEntity().getPosition().y - 2f);
Vector2 newVector = new Vector2(owner.getEntity().getPosition().x - 100f, owner.getEntity().getPosition().y - 2f);
return physics.raycast(owner.getEntity().getPosition(), newVector, TARGET, hit);
}

Expand Down Expand Up @@ -242,7 +242,7 @@ private Weapon meleeOrProjectile() {
}

private void setTarget() {
Vector2 newVector = new Vector2(owner.getEntity().getPosition().x - 10f, owner.getEntity().getPosition().y - 2f);
Vector2 newVector = new Vector2(owner.getEntity().getPosition().x - 100f, owner.getEntity().getPosition().y - 2f);
target = physics.raycastGetHit(owner.getEntity().getPosition(), newVector, TARGET);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ public void run() {
*/
@Override
public void update() {
// * Don't know if this is actually needed.
if(ServiceLocator.getGameEndService().hasGameEnded()) {
stop();
}
// give game time to load in then start
if (!startFlag) {
return;
Expand Down Expand Up @@ -381,6 +385,11 @@ private void fireBreath() {
Timer.schedule(new Timer.Task() {
@Override
public void run() {
// service locator getting a service could be anything here.
if(ServiceLocator.getTimeSource() == null) {
stop();
return; // prevent current iteration from running.
}
Entity projectile = ProjectileFactory.createEffectProjectile(PhysicsLayer.HUMANS, destination,
new Vector2(2, 2), effect, aoe);
projectile.setPosition(demon.getPosition().x, demon.getPosition().y);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,10 @@ public void update() {
}
if (health <= 0) {
changeState(STATE.DEATH);
iceBaby.setFlagForDelete(true);
animate();
if (animation.isFinished()) {
iceBaby.setFlagForDelete(true);
}
}

switch (iceBabyState) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,10 @@ private void meleeAttack() {
initialPos = patrick.getPosition();
meleeTarget = ServiceLocator.getEntityService().getClosestEntityOfLayer(
patrick, PhysicsLayer.HUMANS);
// check if melee target exists
if (meleeTarget == null) {
return;
}
teleport(meleeTarget.getPosition());
meleeFlag = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ public static LevelWaves createLevel(int maxDiff, int maxWaves, int chosenLevel)
String boss1 = "IceBoss";
// String boss1 = "PatrickBoss";
String boss2 = "PatrickBoss";
String boss3 = "IceBoss";
// String boss3 = "IceBoss";
//TODO change this to a fire boss in sprint 4
// String boss3 = "FireBoss";
String boss3 = "FireBoss";
LevelWaves level = new LevelWaves(5);

ArrayList<String> possibleMobs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class WaveFactoryTest {
private final int LVL3_WAVES = 15;
private final int LVL3_CHOSEN_LVL = 2;
private final ArrayList<String> LVL3_MOBS = new ArrayList<>(Arrays.asList("Xeno", "DodgingDragon", "FireWorm"));
private final String LVL3_BOSS = "IceBoss";
private final String LVL3_BOSS = "FireBoss";
// private final String LVL3_BOSS = "FireBoss";
//TODO: make this a fire boss in sprint 4

Expand Down

0 comments on commit 8114486

Please sign in to comment.