Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Team 7 tower stat alterations #302

Merged
merged 2 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions source/core/assets/configs/tower.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,51 +2,51 @@
"income": {
"health": 10,
"baseAttack": 0,
"cost": 10
"cost": 100
},
"wall": {
"health": 300,
"baseAttack": 0,
"cost": 45
"cost": 200
},
"TNTTower": {
"health": 10,
"baseAttack": 5,
"cost": 30
"cost": 50
},
"weapon": {
"health": 75,
"baseAttack": 15,
"cost": 15
"cost": 50
},
"DroidTower": {
"health": 100,
"baseAttack": 25,
"cost": 45
"cost": 300
},
"fireTower": {
"health": 100,
"baseAttack": 25,
"cost": 45
"cost": 300
},
"stunTower": {
"health": 100,
"baseAttack": 25,
"cost": 45
"cost": 500
},
"fireworksTower": {
"health": 125,
"baseAttack": 45,
"cost": 70
"cost": 500
},
"pierceTower": {
"health": 125,
"baseAttack": 45,
"cost": 70
"cost": 500
},
"ricochetTower": {
"health": 125,
"baseAttack": 45,
"cost": 70
"cost": 500
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class CurrencyTask extends DefaultTask implements PriorityTask {
private long endTime;
private int interval;
private final Scrap scrap = new Scrap(); // currency to update
private final int currencyAmount = 30; // amount of currency to update
private final int currencyAmount = 10; // amount of currency to update
private static final String IDLE = "idleStartEco";
private static final String MOVE = "moveStartEco";
private static final String DEATH = "deathStartEco";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,9 @@ public int getPriority() {
*/
public boolean isTargetVisible() {
// If there is an obstacle in the path to the max range point, mobs visible.
return physics.raycast(towerPosition, maxRangePosition, TARGET, hit);
boolean top = physics.raycast(towerPosition.add(0f,0.4f), maxRangePosition.add(0f,0.4f), TARGET, hit);
boolean bottom = physics.raycast(towerPosition.sub(0f,0.4f), maxRangePosition.sub(0f,0.4f), TARGET, hit);
return top || bottom;
}

private void changeFireRateInterval(int newInterval) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ public int getPriority() {
* @return true if mobs are present and false otherwise.
*/
public boolean isTargetVisible() {
return physics.raycast(towerPosition, maxRangePosition, TARGET, hit);
boolean top = physics.raycast(towerPosition.add(0f,0.4f), maxRangePosition.add(0f,0.4f), TARGET, hit);
boolean bottom = physics.raycast(towerPosition.sub(0f,0.4f), maxRangePosition.sub(0f,0.4f), TARGET, hit);
return top || bottom;
}

private void changeFireRateInterval(int newInterval) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,9 @@ public int getPriority() {
* @return true if targets are detected, false otherwise
*/
public boolean isTargetVisible() {
return physics.raycast(towerPosition, maxRangePosition, TARGET, hit);
boolean top = physics.raycast(towerPosition.add(0f,0.4f), maxRangePosition.add(0f,0.4f), TARGET, hit);
boolean bottom = physics.raycast(towerPosition.sub(0f,0.4f), maxRangePosition.sub(0f,0.4f), TARGET, hit);
return top || bottom;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,9 @@ public int getPriority() {
* @return true if targets are detected, false otherwise
*/
public boolean isTargetVisible() {
return physics.raycast(towerPosition, maxRangePosition, TARGET, hit);
boolean top = physics.raycast(towerPosition.add(0f,0.4f), maxRangePosition.add(0f,0.4f), TARGET, hit);
boolean bottom = physics.raycast(towerPosition.sub(0f,0.4f), maxRangePosition.sub(0f,0.4f), TARGET, hit);
return top || bottom;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ public int getPriority() {
* @return true if targets are detected, false otherwise
*/
public boolean isTargetVisible() {
return physics.raycast(towerPosition, maxRangePosition, TARGET, hit);
boolean top = physics.raycast(towerPosition.add(0f,0.4f), maxRangePosition.add(0f,0.4f), TARGET, hit);
boolean bottom = physics.raycast(towerPosition.sub(0f,0.4f), maxRangePosition.sub(0f,0.4f), TARGET, hit);
return top || bottom;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,9 @@ public int getPriority() {
* @return true if targets are detected, false otherwise
*/
public boolean isTargetVisible() {
return physics.raycast(towerPosition, maxRangePosition, TARGET, hit);
boolean top = physics.raycast(towerPosition.add(0f,0.4f), maxRangePosition.add(0f,0.4f), TARGET, hit);
boolean bottom = physics.raycast(towerPosition.sub(0f,0.4f), maxRangePosition.sub(0f,0.4f), TARGET, hit);
return top || bottom;
}

private void changeFireRateInterval(int newInterval) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ public STATE getState() {
*/
public boolean isTargetVisible() {
// If there is an obstacle in the path to the max range point, mobs visible.
return physics.raycast(towerPosition, maxRangePosition, TARGET, hit);
boolean top = physics.raycast(towerPosition.add(0f,0.4f), maxRangePosition.add(0f,0.4f), TARGET, hit);
boolean bottom = physics.raycast(towerPosition.sub(0f,0.4f), maxRangePosition.sub(0f,0.4f), TARGET, hit);
return top || bottom;
}

public boolean isReadyToDelete() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,9 @@ private int getInactivePriority() {
*/
private boolean isTargetVisible() {
// If there is an obstacle in the path to the max range point, mobs visible.
return physics.raycast(towerPosition, maxRangePosition, TARGET, hit);
boolean top = physics.raycast(towerPosition.add(0f,0.4f), maxRangePosition.add(0f,0.4f), TARGET, hit);
boolean bottom = physics.raycast(towerPosition.sub(0f,0.4f), maxRangePosition.sub(0f,0.4f), TARGET, hit);
return top || bottom;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class IncomeTowerConfig {
private int baseAttack = 0;
private int cost = 1;
private float attackRate = 0;
private float incomeRate = 10;
public float incomeRate = 3;

/**
* Function for getting tower's health
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,6 @@ public static Entity createRicochetTower() {
.addComponent(new CostComponent(config.getCost()))
.addComponent(new UpgradableStatsComponent(config.getAttackRate()))
.addComponent(aiTaskComponent);
// ADD ANIMATION COMPONENTS

ricochetTower.setScale(1.5f, 1.5f);
return ricochetTower;
Expand Down
20 changes: 10 additions & 10 deletions source/core/src/main/com/csse3200/game/screens/TowerType.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@

public enum TowerType {
WEAPON("Weapon Tower", "weapon_tower", "The Weapon Tower is a simple and basic turret that fires rapid shots at enemies dealing damage over time.",
0, "15", "images/turret-select/Weapon-Tower-Default.png", "images/turret-select/weapon-tower-selected.png"),
0, "50", "images/turret-select/Weapon-Tower-Default.png", "images/turret-select/weapon-tower-selected.png"),
TNT("TNT Tower", "tnt_tower", "The TNT Tower launches explosive projectiles, dealing area damage to groups of enemies.",
1, "30", "images/turret-select/tnt-tower-default.png", "images/turret-select/tnt-tower-selected.png"),
1, "50", "images/turret-select/tnt-tower-default.png", "images/turret-select/tnt-tower-selected.png"),
DROID("Droid Tower", "droid_tower", "Droid Towers deploy robotic helpers that assist in combat and provide support to nearby turrets.",
2, "45", "images/turret-select/droid-tower-default.png", "images/turret-select/droid-tower-selected.png"),
2, "300", "images/turret-select/droid-tower-default.png", "images/turret-select/droid-tower-selected.png"),
WALL("Wall Tower", "wall", "The Wall Tower creates barriers to block enemy paths, slowing down their progress.",
3, "45", "images/turret-select/wall-tower-default.png", "images/turret-select/wall-tower-selected.png"),
3, "200", "images/turret-select/wall-tower-default.png", "images/turret-select/wall-tower-selected.png"),
FIRE("Fire Tower", "fire_tower", "The Fire Tower emits flames, causing damage over time to enemies caught in its fiery radius.",
4, "45", "images/turret-select/fire-tower-default.png", "images/turret-select/fire-tower-selected.png"),
4, "300", "images/turret-select/fire-tower-default.png", "images/turret-select/fire-tower-selected.png"),
STUN("Stun Tower", "stun_tower", "The Stun Tower releases electric shocks that temporarily immobilize and damage enemies.",
5, "45", "images/turret-select/stun-tower-default.png", "images/turret-select/stun-tower-selected.png"),
5, "500", "images/turret-select/stun-tower-default.png", "images/turret-select/stun-tower-selected.png"),
INCOME("Income Tower", "income_tower", "The Income Tower generates additional in-game currency over time.",
6, "10", "images/turret-select/mine-tower-default.png", "images/turret-select/mine-tower-selected.png"),
6, "100", "images/turret-select/mine-tower-default.png", "images/turret-select/mine-tower-selected.png"),
PIERCE("Pierce Tower", "pierce_tower", "The Pierce Tower fires a projectile that pierces through targets and does not dissipate upon contact.",
6, "0", "images/turret-select/pierce-tower-default.png", "images/turret-select/pierce-tower-selected.png"),
6, "400", "images/turret-select/pierce-tower-default.png", "images/turret-select/pierce-tower-selected.png"),
RICOCHET("Ricochet Tower", "ricochet_tower", "The Ricochet Tower fires a projectile that upon contact does damage and changes direction",
7, "0", "images/turret-select/ricochet-tower-default.png", "images/turret-select/ricochet-tower-selected.png"),
7, "400", "images/turret-select/ricochet-tower-default.png", "images/turret-select/ricochet-tower-selected.png"),
FIREWORK("Firework Tower", "fireworks_tower", "The Firework Tower fires a projectile that splits on contact with its target",
8, "0", "images/turret-select/firework-tower-default.png", "images/turret-select/firework-tower-selected.png");
8, "400", "images/turret-select/firework-tower-default.png", "images/turret-select/firework-tower-selected.png");

private final String towerName;
private final String skinName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public void setUp() {
weaponTower = TowerFactory.createWeaponTower();
wallTower = TowerFactory.createWallTower();
fireTower = TowerFactory.createFireTower();
stunTower = TowerFactory.createFireTower();
stunTower = TowerFactory.createStunTower();
tntTower = TowerFactory.createTNTTower();
droidTower = TowerFactory.createDroidTower();
}
Expand Down Expand Up @@ -186,39 +186,39 @@ void testWeaponTowerCombatStatsComponentAndCostComponent() {
"Health should be 75");
assertEquals(15, weaponTower.getComponent(CombatStatsComponent.class).getBaseAttack(),
"BaseAttack should be 15");
assertEquals(15, weaponTower.getComponent(CostComponent.class).getCost(),
"Cost should be 15");
assertEquals(50, weaponTower.getComponent(CostComponent.class).getCost(),
"Cost should be 50");
assertEquals(100, fireTower.getComponent(CombatStatsComponent.class).getHealth(),
"Fire Tower health must be 100");
assertEquals(25, fireTower.getComponent(CombatStatsComponent.class).getBaseAttack(),
"Fire Tower base attack must be 25");
assertEquals(45, fireTower.getComponent(CostComponent.class).getCost(),
"Fire Tower cost must 45");
assertEquals(300, fireTower.getComponent(CostComponent.class).getCost(),
"Fire Tower cost must 300");
assertEquals(100, stunTower.getComponent(CombatStatsComponent.class).getHealth(),
"Stun Tower health must be 100");
assertEquals(25, stunTower.getComponent(CombatStatsComponent.class).getBaseAttack(),
"Stun Tower base attack must be 25");
assertEquals(45, stunTower.getComponent(CostComponent.class).getCost(),
"Stun Tower cost must 45");
assertEquals(500, stunTower.getComponent(CostComponent.class).getCost(),
"Stun Tower cost must 500");
assertEquals(10, tntTower.getComponent(CombatStatsComponent.class).getHealth(),
"TNT Tower health must be 10");
assertEquals(5, tntTower.getComponent(CombatStatsComponent.class).getBaseAttack(),
"TNT Tower base attack must be 5");
assertEquals(30, tntTower.getComponent(CostComponent.class).getCost(),
"TNT Tower cost must 30");
assertEquals(50, tntTower.getComponent(CostComponent.class).getCost(),
"TNT Tower cost must 50");
assertEquals(100, droidTower.getComponent(CombatStatsComponent.class).getHealth(),
"Droid Tower health must be 100");
assertEquals(25, droidTower.getComponent(CombatStatsComponent.class).getBaseAttack(),
"Droid Tower base attack must be 25");
assertEquals(45, droidTower.getComponent(CostComponent.class).getCost(),
"Droid Tower cost must 45");
assertEquals(300, droidTower.getComponent(CostComponent.class).getCost(),
"Droid Tower cost must 300");
}

@Test
void testWallTowerCombatStatsComponentAndCostComponent() {
assertEquals(300, wallTower.getComponent(CombatStatsComponent.class).getHealth(), "Health should be 300");
assertEquals(0, wallTower.getComponent(CombatStatsComponent.class).getBaseAttack(), "BaseAttack should be 0");
assertEquals(45, wallTower.getComponent(CostComponent.class).getCost(), "Cost should be 45");
assertEquals(200, wallTower.getComponent(CostComponent.class).getCost(), "Cost should be 200");
}

@Test
Expand Down
Loading