Skip to content

Commit

Permalink
added slow case to switch statements in effects component and added i…
Browse files Browse the repository at this point in the history
…n target parameter toa pply single effect
  • Loading branch information
gregchan550 committed Sep 9, 2023
1 parent c56f18f commit 28bd40f
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,16 @@ private void onCollisionEnd(Fixture me, Fixture other) {
if (aoe) {
applyAoeEffect(ProjectileEffects.BURN);
} else {
applySingleEffect(ProjectileEffects.BURN, otherCombatStats);
applySingleEffect(ProjectileEffects.BURN, otherCombatStats, otherEntity);
}
}
case SLOW -> {
if (aoe) {
applyAoeEffect(ProjectileEffects.SLOW);
} else {
applySingleEffect(ProjectileEffects.SLOW, otherCombatStats, otherEntity);
}
}
case SLOW -> {}
case STUN -> {}
}
}
Expand All @@ -95,7 +101,7 @@ private void onCollisionEnd(Fixture me, Fixture other) {
* Used for singe targeting projectiles to apply effects entity it collides with.
* @param effect effect to be applied to entity
*/
public void applySingleEffect(ProjectileEffects effect, CombatStatsComponent targetCombatStats) {
public void applySingleEffect(ProjectileEffects effect, CombatStatsComponent targetCombatStats, Entity targetEntity) {
Entity hostEntity = getEntity();
CombatStatsComponent hostCombatStats = hostEntity.getComponent(CombatStatsComponent.class);

Expand All @@ -110,7 +116,7 @@ public void applySingleEffect(ProjectileEffects effect, CombatStatsComponent tar
case BURN -> {
burnEffect(targetCombatStats, hostCombatStats);
}
case SLOW -> {}
case SLOW -> {slowEffect(targetEntity);}
case STUN -> {}
}
}
Expand Down Expand Up @@ -213,7 +219,7 @@ private void slowEffect(Entity targetEntity) {
// towers
towerFlag = true;
//targetEntity.getEvents().trigger("upgradeTower", TowerUpgraderComponent.UPGRADE.FIRERATE, -30);
} else if (!PhysicsLayer.contains(PhysicsLayer.ALL, targetEntity.getComponent(HitboxComponent.class).getLayer())) {
} else if (!PhysicsLayer.contains(PhysicsLayer.NPC, targetEntity.getComponent(HitboxComponent.class).getLayer())) {
// mobs
mobFlag = true;
targetPhysics = targetEntity.getComponent(PhysicsMovementComponent.class);
Expand Down

0 comments on commit 28bd40f

Please sign in to comment.