Skip to content

Commit

Permalink
Merge branch 'Team-1--Mobs-Enhancement' of https://github.com/UQcsse3…
Browse files Browse the repository at this point in the history
…200/2023-studio-3 into Team-1--Mobs-Enhancement
  • Loading branch information
MiniSoda17 committed Sep 25, 2023
2 parents 026930e + 9610ace commit 9659544
Show file tree
Hide file tree
Showing 78 changed files with 576 additions and 349 deletions.
2 changes: 1 addition & 1 deletion source/core/assets/configs/Boss.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"MobBoss": {
"mobBoss": {
"health": 100,
"baseAttack": 25,
"spookyFactor": 7
Expand Down
1 change: 0 additions & 1 deletion source/core/src/main/com/csse3200/game/GdxGame.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.csse3200.game.components.CombatStatsComponent;
import com.csse3200.game.files.UserSettings;
import com.csse3200.game.screens.*;
import org.slf4j.Logger;
Expand Down
92 changes: 72 additions & 20 deletions source/core/src/main/com/csse3200/game/areas/ForestGameArea.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import com.csse3200.game.services.ResourceService;
import com.csse3200.game.services.ServiceLocator;
import com.csse3200.game.components.gamearea.GameAreaDisplay;
import com.csse3200.game.components.npc.SplitMoblings;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -35,6 +34,8 @@ public class ForestGameArea extends GameArea {
private static final int NUM_MOBBOSS2=3;
private static final int NUM_MOBBOSS1=1;

private Random random = new Random();

private int wave = 0;
private Timer waveTimer;

Expand Down Expand Up @@ -263,12 +264,26 @@ public void create() {
// spawnSplitFireWorksFireBall(new Vector2(2, 5), PhysicsLayer.NPC, towardsMobs, new Vector2(2f, 2f), 12);
// spawnEffectProjectile(new Vector2(2, 6), PhysicsLayer.NPC, towardsMobs, new Vector2(2f, 2f), ProjectileEffects.SLOW, false);
// spawnXenoGrunts();
spawnWeaponTower();
// spawnWeaponTower();

// spawnDragonKnight();
// spawnFireWorm(19, 5); // * TEMPORARY for testing
// spawnSplittingXenoGrunt(17, 5);
spawnDemonBoss();
spawnFireWorm(19, 5); // * TEMPORARY for testing
spawnFireTowerTowerAt(3, 1);
spawnFireTowerTowerAt(3, 2);
spawnFireTowerTowerAt(3, 3);
spawnFireTowerTowerAt(3, 4);
spawnFireTowerTowerAt(3, 5);
spawnDroidTowerAt(3, 1);
spawnDroidTowerAt(3, 2);
spawnDroidTowerAt(3, 3);
spawnDroidTowerAt(3, 4);
spawnDroidTowerAt(3, 5);
// spawnSplittingXenoGrunt(15, 5);
spawnDeflectXenoGrunt(15, 5);
// spawnSplittingXenoGrunt(15, 4);
// spawnSplittingXenoGrunt(15, 5);
// spawnDodgingDragonKnight(15, 3);
// spawnDemonBoss();
// spawnFireWorm();

//mobBoss1 = spawnMobBoss1();
Expand Down Expand Up @@ -315,7 +330,7 @@ private void spawnTerrain() {
// Top
spawnEntityAt(
ObstacleFactory.createWall(worldBounds.x, WALL_WIDTH * 7),
new GridPoint2(0, tileBounds.y - 1),
new GridPoint2(0, tileBounds.y),
false,
false);
// Bottom
Expand Down Expand Up @@ -421,7 +436,7 @@ private void spawnDemonBoss() {
}

private Entity spawnMobBoss1() {
int[] pickedLanes = new Random().ints(0, 8)
int[] pickedLanes = random.ints(0, 8)
.distinct().limit(5).toArray();
for (int i = 0; i < NUM_MOBBOSS1; i++) {
GridPoint2 randomPos = new GridPoint2(19, pickedLanes[i]);
Expand Down Expand Up @@ -496,12 +511,12 @@ private void spawnProjectile(Vector2 position, short targetLayer, int space, int


private void spawnXenoGrunts() {
int[] pickedLanes = new Random().ints(1, 7)
int[] pickedLanes = random.ints(1, 7)
.distinct().limit(5).toArray();
for (int i = 0; i < NUM_GRUNTS; i++) {
GridPoint2 randomPos = new GridPoint2(19, pickedLanes[i]);
System.out.println(randomPos);
Entity xenoGrunt = NPCFactory.createXenoGrunt(player);
Entity xenoGrunt = NPCFactory.createXenoGrunt();
xenoGrunt.setScale(1.5f, 1.5f);
spawnEntityAt(xenoGrunt, randomPos, true, false);
}
Expand All @@ -512,40 +527,63 @@ private void spawnSplittingXenoGrunt(int x, int y) {
GridPoint2 pos = new GridPoint2(x, y);
Entity xenoGrunt = NPCFactory.createSplittingXenoGrunt();
xenoGrunt.setScale(1.5f, 1.5f);
spawnEntityAt(xenoGrunt, pos, false, true);
spawnEntityAt(xenoGrunt, pos, true, true);
}

// * TEMPORARY FOR TESTING
private void spawnDodgingDragonKnight(int x, int y) {
GridPoint2 pos = new GridPoint2(x, y);
Entity fireworm = NPCFactory.createDodgingDragonKnight();
fireworm.setScale(1.5f, 1.5f);
spawnEntityAt(fireworm, pos, true, true);
}

// * TEMPORARY FOR TESTING
private void spawnDeflectXenoGrunt(int x, int y) {
GridPoint2 pos = new GridPoint2(x, y);
Entity xenoGrunt = NPCFactory.createDeflectXenoGrunt();
xenoGrunt.setScale(1.5f, 1.5f);
spawnEntityAt(xenoGrunt, pos, true, true);
}

private void spawnFireWorm() {
int[] pickedLanes = new Random().ints(1, 7)
int[] pickedLanes = random.ints(1, 7)
.distinct().limit(5).toArray();
for (int i = 0; i < NUM_GRUNTS; i++) {
GridPoint2 randomPos = new GridPoint2(19, pickedLanes[i]);
System.out.println(randomPos);
Entity fireWorm = NPCFactory.createFireWorm(player);
Entity fireWorm = NPCFactory.createFireWorm();
fireWorm.setScale(1.5f, 1.5f);
spawnEntityAt(fireWorm, randomPos, true, false);
}
}

// * TEMPORARY FOR TESTING
private void spawnFireWorm(int x, int y) {
GridPoint2 poistion = new GridPoint2(x, y);
Entity fireWorm = NPCFactory.createFireWorm();
fireWorm.setScale(1.5f, 1.5f);
spawnEntityAt(fireWorm, poistion, true, true);
}
private void spawnSkeleton() {
int[] pickedLanes = new Random().ints(1, 7)
.distinct().limit(5).toArray();
for (int i = 0; i < NUM_GRUNTS; i++) {
GridPoint2 randomPos = new GridPoint2(19, pickedLanes[i]);
System.out.println(randomPos);
Entity skeleton = NPCFactory.createSkeleton(player);
Entity skeleton = NPCFactory.createSkeleton();
skeleton.setScale(1.5f, 1.5f);
spawnEntityAt(skeleton, randomPos, true, false);
}
}

private void spawnDragonKnight() {
int[] pickedLanes = new Random().ints(1, 7)
int[] pickedLanes = random.ints(1, 7)
.distinct().limit(5).toArray();
for (int i = 0; i < NUM_GRUNTS; i++) {
GridPoint2 randomPos = new GridPoint2(19, pickedLanes[i]);
System.out.println(randomPos);
Entity fireWorm = NPCFactory.createDragonKnight(player);
Entity fireWorm = NPCFactory.createDragonKnight();
fireWorm.setScale(1.5f, 1.5f);
spawnEntityAt(fireWorm, randomPos, true, false);
}
Expand All @@ -556,7 +594,7 @@ private void spawnWizard() {
.distinct().limit(5).toArray();
for (int i = 0; i < NUM_GRUNTS; i++) {
GridPoint2 randomPos = new GridPoint2(19, pickedLanes[i]);
Entity wizard = NPCFactory.createWizard(player);
Entity wizard = NPCFactory.createWizard();
wizard.setScale(1.5f, 1.5f);
spawnEntityAt(wizard, randomPos, true, false);
}
Expand All @@ -567,7 +605,7 @@ private void spawnWaterQueen() {
.distinct().limit(5).toArray();
for (int i = 0; i < NUM_GRUNTS; i++) {
GridPoint2 randomPos = new GridPoint2(19, pickedLanes[i]);
Entity waterQueen = NPCFactory.createWaterQueen(player);
Entity waterQueen = NPCFactory.createWaterQueen();
waterQueen.setScale(1.5f, 1.5f);
spawnEntityAt(waterQueen, randomPos, true, false);
}
Expand All @@ -577,7 +615,7 @@ private void spawnWaterSlime() {
.distinct().limit(5).toArray();
for (int i = 0; i < NUM_GRUNTS; i++) {
GridPoint2 randomPos = new GridPoint2(19, pickedLanes[i]);
Entity waterSlime = NPCFactory.createWaterSlime(player);
Entity waterSlime = NPCFactory.createWaterSlime();
waterSlime.setScale(1.5f, 1.5f);
spawnEntityAt(waterSlime, randomPos, true, false);
}
Expand Down Expand Up @@ -615,7 +653,7 @@ private void spawnWaterSlime() {
// }

private Entity spawnMobBoss2() {
int[] pickedLanes = new Random().ints(0, 8)
int[] pickedLanes = random.ints(0, 8)
.distinct().limit(5).toArray();
for (int i = 0; i < NUM_MOBBOSS2; i++) {
GridPoint2 randomPos = new GridPoint2(19, pickedLanes[i]);
Expand Down Expand Up @@ -717,7 +755,7 @@ private void spawnWeaponTower() {
GridPoint2 minPos = new GridPoint2(0, 0);
GridPoint2 maxPos = terrain.getMapBounds(0).sub(2, 2);

for (int i = 0; i < NUM_WEAPON_TOWERS; i++) {
for (int i = 0; i < NUM_WEAPON_TOWERS + 10; i++) {
GridPoint2 randomPos1 = RandomUtils.random(minPos, maxPos);
GridPoint2 randomPos2 = RandomUtils.random(minPos, maxPos);
Entity wallTower = TowerFactory.createWallTower();
Expand All @@ -727,6 +765,20 @@ private void spawnWeaponTower() {
spawnEntityAt(stunTower, randomPos2, true, true);
}
}

// * TEMPORARY FOR TESTING
private void spawnFireTowerTowerAt(int x, int y) {
GridPoint2 pos = new GridPoint2(x, y);
Entity fireTower = TowerFactory.createFireTower();

spawnEntityAt(fireTower, pos, true, true);
}
private void spawnDroidTowerAt(int x, int y) {
GridPoint2 pos = new GridPoint2(x, y);
Entity droidTower = TowerFactory.createDroidTower();

spawnEntityAt(droidTower, pos, true, true);
}

private void spawnTNTTower() {
GridPoint2 minPos = new GridPoint2(0, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
import com.csse3200.game.entities.configs.ProjectileConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


import java.util.ArrayList;
import java.util.Currency;
import java.util.Random;
Expand Down Expand Up @@ -41,6 +39,7 @@ public class CombatStatsComponent extends Component {
private ArrayList<Currency> drops;
private ArrayList<Melee> closeRangeAbilities;
private ArrayList<ProjectileConfig> longRangeAbilities; //TODO change String to Projectiles
private Random rand = new Random();

public CombatStatsComponent(int health, int baseAttack) {
setHealth(health);
Expand Down Expand Up @@ -171,10 +170,9 @@ public void hit(CombatStatsComponent attacker) {
}

/**
* pick a random number from range 0 to the size of the list provided
* */
* Picks a random number from range 0 to the size of the list provided.
*/
public int pickRandom(ArrayList pickFrom) {
Random rand = new Random();
return rand.nextInt(pickFrom.size());
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
package com.csse3200.game.components;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Component used to store information related to cost.
* Any entities that necessitate a cost should register an instance of this class.
*/
public class CostComponent extends Component {


private int cost;

public CostComponent(int cost) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.Fixture;
import com.csse3200.game.components.tasks.bosstask.DemonBossTask;
import com.csse3200.game.entities.Entity;
import com.csse3200.game.physics.BodyUserData;
import com.csse3200.game.physics.PhysicsLayer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ private void onCollisionEnd(Fixture me, Fixture other) {
// * RIGHT NOW TARGET IS NPC, SUBJECT TO CHANGE
// Speed is a bit faster than normal but can change.
Entity newProjectile = ProjectileFactory.createFireworks(PhysicsLayer.NPC,
new Vector2(100, projectile.getPosition().y + (newDirection - (TOTAL_RANGE/2))), new Vector2(3f, 3f));
new Vector2(100, (float) (projectile.getPosition().y + (newDirection - (TOTAL_RANGE/2)))), new Vector2(3f, 3f));

newProjectile.setPosition(newXPosition, (float) projectile.getPosition().y);

Expand Down
Loading

0 comments on commit 9659544

Please sign in to comment.