niwa99/Tower-Defense

View on GitHub

Showing 49 of 88 total issues

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    private void setMediumInformation() {
        textDifficultyHeader.setText(R.string.difficulty_medium);
        textDifficultyDescription.setText(R.string.difficulty_medium_description);
        textValueMaxWave.setText(PreferenceManager.getStatisticsValue(PreferenceManager.Statistics.MEDIUM_MAX_WAVE));
        textValueEnemiesKilled.setText(PreferenceManager.getStatisticsValue(PreferenceManager.Statistics.MEDIUM_ENEMIES_KILLED));
app/src/main/java/de/dhbw/activities/DifficultyFragment.java on lines 62..73
app/src/main/java/de/dhbw/activities/DifficultyFragment.java on lines 88..99

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 163.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    private void setEasyInformation() {
        textDifficultyHeader.setText(R.string.difficulty_easy);
        textDifficultyDescription.setText(R.string.difficulty_easy_description);
        textValueMaxWave.setText(PreferenceManager.getStatisticsValue(PreferenceManager.Statistics.EASY_MAX_WAVE));
        textValueEnemiesKilled.setText(PreferenceManager.getStatisticsValue(PreferenceManager.Statistics.EASY_ENEMIES_KILLED));
app/src/main/java/de/dhbw/activities/DifficultyFragment.java on lines 75..86
app/src/main/java/de/dhbw/activities/DifficultyFragment.java on lines 88..99

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 163.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    private void setHardInformation() {
        textDifficultyHeader.setText(R.string.difficulty_hard);
        textDifficultyDescription.setText(R.string.difficulty_hard_description);
        textValueMaxWave.setText(PreferenceManager.getStatisticsValue(PreferenceManager.Statistics.HARD_MAX_WAVE));
        textValueEnemiesKilled.setText(PreferenceManager.getStatisticsValue(PreferenceManager.Statistics.HARD_ENEMIES_KILLED));
app/src/main/java/de/dhbw/activities/DifficultyFragment.java on lines 62..73
app/src/main/java/de/dhbw/activities/DifficultyFragment.java on lines 75..86

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 163.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    public TowerBoombastic(Field field, int level, GameActivity gameActivity) {
        super(UUID.randomUUID(), TowerType.BOOMBASTIC,
                level, getTowerBoombasticCostsByLevel(level),
                getTowerBoombasticDamageByLevel(level), getTowerBoombasticRangeByLevel(level), getTowerBoombasticFirerateByLevel(level), field, gameActivity);

app/src/main/java/de/dhbw/map/objects/tower/TowerLaser.java on lines 44..63

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 136.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    public TowerLaser(Field field, int level, GameActivity gameActivity) {
        super(UUID.randomUUID(), TowerType.ASSAULTLASER, level, getLaserCostsByLevel(level), getLaserDamageByLevel(level),
                getLaserRangeByLevel(level), getLaserFireRateByLevel(level), field, gameActivity);

        ImageView baseImage = new ImageView(gameActivity);
Severity: Major
Found in app/src/main/java/de/dhbw/map/objects/tower/TowerLaser.java and 1 other location - About 2 hrs to fix
app/src/main/java/de/dhbw/map/objects/tower/TowerBoombastic.java on lines 44..62

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 136.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

            } else if (path[pathNumber].getY() == path[pathNumber - 1].getY()) {
                if (path[pathNumber].getY() < path[pathNumber + 1].getY()) {
                    if (path[pathNumber].getX() < path[pathNumber - 1].getX()) {
                        pathImage = Constants.DRAWABLE_PATH_RIGHT_DOWN;
                    } else {
Severity: Major
Found in app/src/main/java/de/dhbw/map/structure/MapStructure.java and 1 other location - About 1 hr to fix
app/src/main/java/de/dhbw/map/structure/MapStructure.java on lines 100..114

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 126.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

            } else {
                if (path[pathNumber].getX() < path[pathNumber + 1].getX()) {
                    if (path[pathNumber].getY() < path[pathNumber - 1].getY()) {
                        pathImage = Constants.DRAWABLE_PATH_RIGHT_DOWN;
                    } else {
Severity: Major
Found in app/src/main/java/de/dhbw/map/structure/MapStructure.java and 1 other location - About 1 hr to fix
app/src/main/java/de/dhbw/map/structure/MapStructure.java on lines 86..100

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 126.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

            case 3:
                starlvlThree = new ImageView(gameActivity);
                starlvlThree.setImageResource(R.drawable.star);
                starlvlThree.setX(field.getSpawnPoint().getX() + 50);
                starlvlThree.setY(field.getSpawnPoint().getY());
Severity: Minor
Found in app/src/main/java/de/dhbw/map/objects/tower/ATower.java and 1 other location - About 55 mins to fix
app/src/main/java/de/dhbw/map/objects/tower/ATower.java on lines 73..78

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 66.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

            case 4:
                starlvlFour = new ImageView(gameActivity);
                starlvlFour.setImageResource(R.drawable.star);
                starlvlFour.setX(field.getSpawnPoint().getX() + 100);
                starlvlFour.setY(field.getSpawnPoint().getY());
Severity: Minor
Found in app/src/main/java/de/dhbw/map/objects/tower/ATower.java and 1 other location - About 55 mins to fix
app/src/main/java/de/dhbw/map/objects/tower/ATower.java on lines 79..84

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 66.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 21 locations. Consider refactoring.
Open

    private static int getLaserCostsByLevel(int level) {
        switch (level) {
            case 1: return TOWER_LASER_LEVEL_1_COSTS;
            case 2: return TOWER_LASER_LEVEL_2_COSTS;
            case 3: return TOWER_LASER_LEVEL_3_COSTS;
Severity: Major
Found in app/src/main/java/de/dhbw/map/objects/tower/TowerLaser.java and 20 other locations - About 35 mins to fix
app/src/main/java/de/dhbw/map/objects/tower/TowerArtillery.java on lines 85..93
app/src/main/java/de/dhbw/map/objects/tower/TowerArtillery.java on lines 100..108
app/src/main/java/de/dhbw/map/objects/tower/TowerArtillery.java on lines 115..123
app/src/main/java/de/dhbw/map/objects/tower/TowerArtillery.java on lines 130..138
app/src/main/java/de/dhbw/map/objects/tower/TowerBoombastic.java on lines 114..122
app/src/main/java/de/dhbw/map/objects/tower/TowerBoombastic.java on lines 129..137
app/src/main/java/de/dhbw/map/objects/tower/TowerBoombastic.java on lines 144..152
app/src/main/java/de/dhbw/map/objects/tower/TowerBoombastic.java on lines 159..167
app/src/main/java/de/dhbw/map/objects/tower/TowerFreezer.java on lines 129..137
app/src/main/java/de/dhbw/map/objects/tower/TowerFreezer.java on lines 144..152
app/src/main/java/de/dhbw/map/objects/tower/TowerFreezer.java on lines 159..167
app/src/main/java/de/dhbw/map/objects/tower/TowerFreezer.java on lines 174..182
app/src/main/java/de/dhbw/map/objects/tower/TowerFreezer.java on lines 189..197
app/src/main/java/de/dhbw/map/objects/tower/TowerLaser.java on lines 117..125
app/src/main/java/de/dhbw/map/objects/tower/TowerLaser.java on lines 137..145
app/src/main/java/de/dhbw/map/objects/tower/TowerLaser.java on lines 157..165
app/src/main/java/de/dhbw/map/objects/tower/TowerPlasmarizer.java on lines 91..99
app/src/main/java/de/dhbw/map/objects/tower/TowerPlasmarizer.java on lines 106..114
app/src/main/java/de/dhbw/map/objects/tower/TowerPlasmarizer.java on lines 121..129
app/src/main/java/de/dhbw/map/objects/tower/TowerPlasmarizer.java on lines 136..144

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 46.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 21 locations. Consider refactoring.
Open

    private static int getLaserRangeByLevel(int level) {
        switch (level) {
            case 1: return TOWER_LASER_LEVEL_1_RANGE_IN_PIXELS;
            case 2: return TOWER_LASER_LEVEL_2_RANGE_IN_PIXELS;
            case 3: return TOWER_LASER_LEVEL_3_RANGE_IN_PIXELS;
Severity: Major
Found in app/src/main/java/de/dhbw/map/objects/tower/TowerLaser.java and 20 other locations - About 35 mins to fix
app/src/main/java/de/dhbw/map/objects/tower/TowerArtillery.java on lines 85..93
app/src/main/java/de/dhbw/map/objects/tower/TowerArtillery.java on lines 100..108
app/src/main/java/de/dhbw/map/objects/tower/TowerArtillery.java on lines 115..123
app/src/main/java/de/dhbw/map/objects/tower/TowerArtillery.java on lines 130..138
app/src/main/java/de/dhbw/map/objects/tower/TowerBoombastic.java on lines 114..122
app/src/main/java/de/dhbw/map/objects/tower/TowerBoombastic.java on lines 129..137
app/src/main/java/de/dhbw/map/objects/tower/TowerBoombastic.java on lines 144..152
app/src/main/java/de/dhbw/map/objects/tower/TowerBoombastic.java on lines 159..167
app/src/main/java/de/dhbw/map/objects/tower/TowerFreezer.java on lines 129..137
app/src/main/java/de/dhbw/map/objects/tower/TowerFreezer.java on lines 144..152
app/src/main/java/de/dhbw/map/objects/tower/TowerFreezer.java on lines 159..167
app/src/main/java/de/dhbw/map/objects/tower/TowerFreezer.java on lines 174..182
app/src/main/java/de/dhbw/map/objects/tower/TowerFreezer.java on lines 189..197
app/src/main/java/de/dhbw/map/objects/tower/TowerLaser.java on lines 97..105
app/src/main/java/de/dhbw/map/objects/tower/TowerLaser.java on lines 117..125
app/src/main/java/de/dhbw/map/objects/tower/TowerLaser.java on lines 157..165
app/src/main/java/de/dhbw/map/objects/tower/TowerPlasmarizer.java on lines 91..99
app/src/main/java/de/dhbw/map/objects/tower/TowerPlasmarizer.java on lines 106..114
app/src/main/java/de/dhbw/map/objects/tower/TowerPlasmarizer.java on lines 121..129
app/src/main/java/de/dhbw/map/objects/tower/TowerPlasmarizer.java on lines 136..144

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 46.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 21 locations. Consider refactoring.
Open

    private static int getTowerArtilleryDamageByLevel(int level) {
        switch (level) {
            case 1: return TOWER_ARTILLERY_LEVEL_1_DAMAGE;
            case 2: return TOWER_ARTILLERY_LEVEL_2_DAMAGE;
            case 3: return TOWER_ARTILLERY_LEVEL_3_DAMAGE;
app/src/main/java/de/dhbw/map/objects/tower/TowerArtillery.java on lines 85..93
app/src/main/java/de/dhbw/map/objects/tower/TowerArtillery.java on lines 115..123
app/src/main/java/de/dhbw/map/objects/tower/TowerArtillery.java on lines 130..138
app/src/main/java/de/dhbw/map/objects/tower/TowerBoombastic.java on lines 114..122
app/src/main/java/de/dhbw/map/objects/tower/TowerBoombastic.java on lines 129..137
app/src/main/java/de/dhbw/map/objects/tower/TowerBoombastic.java on lines 144..152
app/src/main/java/de/dhbw/map/objects/tower/TowerBoombastic.java on lines 159..167
app/src/main/java/de/dhbw/map/objects/tower/TowerFreezer.java on lines 129..137
app/src/main/java/de/dhbw/map/objects/tower/TowerFreezer.java on lines 144..152
app/src/main/java/de/dhbw/map/objects/tower/TowerFreezer.java on lines 159..167
app/src/main/java/de/dhbw/map/objects/tower/TowerFreezer.java on lines 174..182
app/src/main/java/de/dhbw/map/objects/tower/TowerFreezer.java on lines 189..197
app/src/main/java/de/dhbw/map/objects/tower/TowerLaser.java on lines 97..105
app/src/main/java/de/dhbw/map/objects/tower/TowerLaser.java on lines 117..125
app/src/main/java/de/dhbw/map/objects/tower/TowerLaser.java on lines 137..145
app/src/main/java/de/dhbw/map/objects/tower/TowerLaser.java on lines 157..165
app/src/main/java/de/dhbw/map/objects/tower/TowerPlasmarizer.java on lines 91..99
app/src/main/java/de/dhbw/map/objects/tower/TowerPlasmarizer.java on lines 106..114
app/src/main/java/de/dhbw/map/objects/tower/TowerPlasmarizer.java on lines 121..129
app/src/main/java/de/dhbw/map/objects/tower/TowerPlasmarizer.java on lines 136..144

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 46.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 4 locations. Consider refactoring.
Open

                case CAR:
                    for (int i = 0; i < wave.getAmount(); i++) {
                        addEnemy(new Car(wave.getEnemyType().getLabel(), wave.getLevel(), gameActivity));
                    }
                    break;
Severity: Major
Found in app/src/main/java/de/dhbw/game/wave/Wave.java and 3 other locations - About 35 mins to fix
app/src/main/java/de/dhbw/game/wave/Wave.java on lines 29..33
app/src/main/java/de/dhbw/game/wave/Wave.java on lines 39..43
app/src/main/java/de/dhbw/game/wave/Wave.java on lines 44..48

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 46.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 21 locations. Consider refactoring.
Open

    private static int getTowerBoombasticDamageByLevel(int level) {
        switch (level) {
            case 1: return TOWER_BOOMBASTIC_LEVEL_1_DAMAGE;
            case 2: return TOWER_BOOMBASTIC_LEVEL_2_DAMAGE;
            case 3: return TOWER_BOOMBASTIC_LEVEL_3_DAMAGE;
app/src/main/java/de/dhbw/map/objects/tower/TowerArtillery.java on lines 85..93
app/src/main/java/de/dhbw/map/objects/tower/TowerArtillery.java on lines 100..108
app/src/main/java/de/dhbw/map/objects/tower/TowerArtillery.java on lines 115..123
app/src/main/java/de/dhbw/map/objects/tower/TowerArtillery.java on lines 130..138
app/src/main/java/de/dhbw/map/objects/tower/TowerBoombastic.java on lines 114..122
app/src/main/java/de/dhbw/map/objects/tower/TowerBoombastic.java on lines 144..152
app/src/main/java/de/dhbw/map/objects/tower/TowerBoombastic.java on lines 159..167
app/src/main/java/de/dhbw/map/objects/tower/TowerFreezer.java on lines 129..137
app/src/main/java/de/dhbw/map/objects/tower/TowerFreezer.java on lines 144..152
app/src/main/java/de/dhbw/map/objects/tower/TowerFreezer.java on lines 159..167
app/src/main/java/de/dhbw/map/objects/tower/TowerFreezer.java on lines 174..182
app/src/main/java/de/dhbw/map/objects/tower/TowerFreezer.java on lines 189..197
app/src/main/java/de/dhbw/map/objects/tower/TowerLaser.java on lines 97..105
app/src/main/java/de/dhbw/map/objects/tower/TowerLaser.java on lines 117..125
app/src/main/java/de/dhbw/map/objects/tower/TowerLaser.java on lines 137..145
app/src/main/java/de/dhbw/map/objects/tower/TowerLaser.java on lines 157..165
app/src/main/java/de/dhbw/map/objects/tower/TowerPlasmarizer.java on lines 91..99
app/src/main/java/de/dhbw/map/objects/tower/TowerPlasmarizer.java on lines 106..114
app/src/main/java/de/dhbw/map/objects/tower/TowerPlasmarizer.java on lines 121..129
app/src/main/java/de/dhbw/map/objects/tower/TowerPlasmarizer.java on lines 136..144

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 46.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 21 locations. Consider refactoring.
Open

    private static int getLaserFireRateByLevel(int level) {
        switch (level) {
            case 1: return TOWER_LASER_LEVEL_1_FIRERATE_IN_SECONDS;
            case 2: return TOWER_LASER_LEVEL_2_FIRERATE_IN_SECONDS;
            case 3: return TOWER_LASER_LEVEL_3_FIRERATE_IN_SECONDS;
Severity: Major
Found in app/src/main/java/de/dhbw/map/objects/tower/TowerLaser.java and 20 other locations - About 35 mins to fix
app/src/main/java/de/dhbw/map/objects/tower/TowerArtillery.java on lines 85..93
app/src/main/java/de/dhbw/map/objects/tower/TowerArtillery.java on lines 100..108
app/src/main/java/de/dhbw/map/objects/tower/TowerArtillery.java on lines 115..123
app/src/main/java/de/dhbw/map/objects/tower/TowerArtillery.java on lines 130..138
app/src/main/java/de/dhbw/map/objects/tower/TowerBoombastic.java on lines 114..122
app/src/main/java/de/dhbw/map/objects/tower/TowerBoombastic.java on lines 129..137
app/src/main/java/de/dhbw/map/objects/tower/TowerBoombastic.java on lines 144..152
app/src/main/java/de/dhbw/map/objects/tower/TowerBoombastic.java on lines 159..167
app/src/main/java/de/dhbw/map/objects/tower/TowerFreezer.java on lines 129..137
app/src/main/java/de/dhbw/map/objects/tower/TowerFreezer.java on lines 144..152
app/src/main/java/de/dhbw/map/objects/tower/TowerFreezer.java on lines 159..167
app/src/main/java/de/dhbw/map/objects/tower/TowerFreezer.java on lines 174..182
app/src/main/java/de/dhbw/map/objects/tower/TowerFreezer.java on lines 189..197
app/src/main/java/de/dhbw/map/objects/tower/TowerLaser.java on lines 97..105
app/src/main/java/de/dhbw/map/objects/tower/TowerLaser.java on lines 117..125
app/src/main/java/de/dhbw/map/objects/tower/TowerLaser.java on lines 137..145
app/src/main/java/de/dhbw/map/objects/tower/TowerPlasmarizer.java on lines 91..99
app/src/main/java/de/dhbw/map/objects/tower/TowerPlasmarizer.java on lines 106..114
app/src/main/java/de/dhbw/map/objects/tower/TowerPlasmarizer.java on lines 121..129
app/src/main/java/de/dhbw/map/objects/tower/TowerPlasmarizer.java on lines 136..144

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 46.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 21 locations. Consider refactoring.
Open

    private static int getPlasmarizerDamageByLevel(int level) {
        switch (level) {
            case 1: return TOWER_PLASMARIZER_LEVEL_1_DAMAGE;
            case 2: return TOWER_PLASMARIZER_LEVEL_2_DAMAGE;
            case 3: return TOWER_PLASMARIZER_LEVEL_3_DAMAGE;
app/src/main/java/de/dhbw/map/objects/tower/TowerArtillery.java on lines 85..93
app/src/main/java/de/dhbw/map/objects/tower/TowerArtillery.java on lines 100..108
app/src/main/java/de/dhbw/map/objects/tower/TowerArtillery.java on lines 115..123
app/src/main/java/de/dhbw/map/objects/tower/TowerArtillery.java on lines 130..138
app/src/main/java/de/dhbw/map/objects/tower/TowerBoombastic.java on lines 114..122
app/src/main/java/de/dhbw/map/objects/tower/TowerBoombastic.java on lines 129..137
app/src/main/java/de/dhbw/map/objects/tower/TowerBoombastic.java on lines 144..152
app/src/main/java/de/dhbw/map/objects/tower/TowerBoombastic.java on lines 159..167
app/src/main/java/de/dhbw/map/objects/tower/TowerFreezer.java on lines 129..137
app/src/main/java/de/dhbw/map/objects/tower/TowerFreezer.java on lines 144..152
app/src/main/java/de/dhbw/map/objects/tower/TowerFreezer.java on lines 159..167
app/src/main/java/de/dhbw/map/objects/tower/TowerFreezer.java on lines 174..182
app/src/main/java/de/dhbw/map/objects/tower/TowerFreezer.java on lines 189..197
app/src/main/java/de/dhbw/map/objects/tower/TowerLaser.java on lines 97..105
app/src/main/java/de/dhbw/map/objects/tower/TowerLaser.java on lines 117..125
app/src/main/java/de/dhbw/map/objects/tower/TowerLaser.java on lines 137..145
app/src/main/java/de/dhbw/map/objects/tower/TowerLaser.java on lines 157..165
app/src/main/java/de/dhbw/map/objects/tower/TowerPlasmarizer.java on lines 91..99
app/src/main/java/de/dhbw/map/objects/tower/TowerPlasmarizer.java on lines 121..129
app/src/main/java/de/dhbw/map/objects/tower/TowerPlasmarizer.java on lines 136..144

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 46.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 21 locations. Consider refactoring.
Open

    private static int getPlasmarizerCostsByLevel(int level) {
        switch (level) {
            case 1: return TOWER_PLASMARIZER_LEVEL_1_COSTS;
            case 2: return TOWER_PLASMARIZER_LEVEL_2_COSTS;
            case 3: return TOWER_PLASMARIZER_LEVEL_3_COSTS;
app/src/main/java/de/dhbw/map/objects/tower/TowerArtillery.java on lines 85..93
app/src/main/java/de/dhbw/map/objects/tower/TowerArtillery.java on lines 100..108
app/src/main/java/de/dhbw/map/objects/tower/TowerArtillery.java on lines 115..123
app/src/main/java/de/dhbw/map/objects/tower/TowerArtillery.java on lines 130..138
app/src/main/java/de/dhbw/map/objects/tower/TowerBoombastic.java on lines 114..122
app/src/main/java/de/dhbw/map/objects/tower/TowerBoombastic.java on lines 129..137
app/src/main/java/de/dhbw/map/objects/tower/TowerBoombastic.java on lines 144..152
app/src/main/java/de/dhbw/map/objects/tower/TowerBoombastic.java on lines 159..167
app/src/main/java/de/dhbw/map/objects/tower/TowerFreezer.java on lines 129..137
app/src/main/java/de/dhbw/map/objects/tower/TowerFreezer.java on lines 144..152
app/src/main/java/de/dhbw/map/objects/tower/TowerFreezer.java on lines 159..167
app/src/main/java/de/dhbw/map/objects/tower/TowerFreezer.java on lines 174..182
app/src/main/java/de/dhbw/map/objects/tower/TowerFreezer.java on lines 189..197
app/src/main/java/de/dhbw/map/objects/tower/TowerLaser.java on lines 97..105
app/src/main/java/de/dhbw/map/objects/tower/TowerLaser.java on lines 117..125
app/src/main/java/de/dhbw/map/objects/tower/TowerLaser.java on lines 137..145
app/src/main/java/de/dhbw/map/objects/tower/TowerLaser.java on lines 157..165
app/src/main/java/de/dhbw/map/objects/tower/TowerPlasmarizer.java on lines 106..114
app/src/main/java/de/dhbw/map/objects/tower/TowerPlasmarizer.java on lines 121..129
app/src/main/java/de/dhbw/map/objects/tower/TowerPlasmarizer.java on lines 136..144

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 46.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 21 locations. Consider refactoring.
Open

    private static int getFreezerSlownessByLevel(int level) {
        switch (level) {
            case 1: return TOWER_FREEZER_LEVEL_1_SLOWNESS;
            case 2: return TOWER_FREEZER_LEVEL_2_SLOWNESS;
            case 3: return TOWER_FREEZER_LEVEL_3_SLOWNESS;
Severity: Major
Found in app/src/main/java/de/dhbw/map/objects/tower/TowerFreezer.java and 20 other locations - About 35 mins to fix
app/src/main/java/de/dhbw/map/objects/tower/TowerArtillery.java on lines 85..93
app/src/main/java/de/dhbw/map/objects/tower/TowerArtillery.java on lines 100..108
app/src/main/java/de/dhbw/map/objects/tower/TowerArtillery.java on lines 115..123
app/src/main/java/de/dhbw/map/objects/tower/TowerArtillery.java on lines 130..138
app/src/main/java/de/dhbw/map/objects/tower/TowerBoombastic.java on lines 114..122
app/src/main/java/de/dhbw/map/objects/tower/TowerBoombastic.java on lines 129..137
app/src/main/java/de/dhbw/map/objects/tower/TowerBoombastic.java on lines 144..152
app/src/main/java/de/dhbw/map/objects/tower/TowerBoombastic.java on lines 159..167
app/src/main/java/de/dhbw/map/objects/tower/TowerFreezer.java on lines 129..137
app/src/main/java/de/dhbw/map/objects/tower/TowerFreezer.java on lines 159..167
app/src/main/java/de/dhbw/map/objects/tower/TowerFreezer.java on lines 174..182
app/src/main/java/de/dhbw/map/objects/tower/TowerFreezer.java on lines 189..197
app/src/main/java/de/dhbw/map/objects/tower/TowerLaser.java on lines 97..105
app/src/main/java/de/dhbw/map/objects/tower/TowerLaser.java on lines 117..125
app/src/main/java/de/dhbw/map/objects/tower/TowerLaser.java on lines 137..145
app/src/main/java/de/dhbw/map/objects/tower/TowerLaser.java on lines 157..165
app/src/main/java/de/dhbw/map/objects/tower/TowerPlasmarizer.java on lines 91..99
app/src/main/java/de/dhbw/map/objects/tower/TowerPlasmarizer.java on lines 106..114
app/src/main/java/de/dhbw/map/objects/tower/TowerPlasmarizer.java on lines 121..129
app/src/main/java/de/dhbw/map/objects/tower/TowerPlasmarizer.java on lines 136..144

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 46.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 21 locations. Consider refactoring.
Open

    private static int getFreezerDamageByLevel(int level) {
        switch (level) {
            case 1: return TOWER_FREEZER_LEVEL_1_DAMAGE;
            case 2: return TOWER_FREEZER_LEVEL_2_DAMAGE;
            case 3: return TOWER_FREEZER_LEVEL_3_DAMAGE;
Severity: Major
Found in app/src/main/java/de/dhbw/map/objects/tower/TowerFreezer.java and 20 other locations - About 35 mins to fix
app/src/main/java/de/dhbw/map/objects/tower/TowerArtillery.java on lines 85..93
app/src/main/java/de/dhbw/map/objects/tower/TowerArtillery.java on lines 100..108
app/src/main/java/de/dhbw/map/objects/tower/TowerArtillery.java on lines 115..123
app/src/main/java/de/dhbw/map/objects/tower/TowerArtillery.java on lines 130..138
app/src/main/java/de/dhbw/map/objects/tower/TowerBoombastic.java on lines 114..122
app/src/main/java/de/dhbw/map/objects/tower/TowerBoombastic.java on lines 129..137
app/src/main/java/de/dhbw/map/objects/tower/TowerBoombastic.java on lines 144..152
app/src/main/java/de/dhbw/map/objects/tower/TowerBoombastic.java on lines 159..167
app/src/main/java/de/dhbw/map/objects/tower/TowerFreezer.java on lines 129..137
app/src/main/java/de/dhbw/map/objects/tower/TowerFreezer.java on lines 144..152
app/src/main/java/de/dhbw/map/objects/tower/TowerFreezer.java on lines 174..182
app/src/main/java/de/dhbw/map/objects/tower/TowerFreezer.java on lines 189..197
app/src/main/java/de/dhbw/map/objects/tower/TowerLaser.java on lines 97..105
app/src/main/java/de/dhbw/map/objects/tower/TowerLaser.java on lines 117..125
app/src/main/java/de/dhbw/map/objects/tower/TowerLaser.java on lines 137..145
app/src/main/java/de/dhbw/map/objects/tower/TowerLaser.java on lines 157..165
app/src/main/java/de/dhbw/map/objects/tower/TowerPlasmarizer.java on lines 91..99
app/src/main/java/de/dhbw/map/objects/tower/TowerPlasmarizer.java on lines 106..114
app/src/main/java/de/dhbw/map/objects/tower/TowerPlasmarizer.java on lines 121..129
app/src/main/java/de/dhbw/map/objects/tower/TowerPlasmarizer.java on lines 136..144

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 46.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 5 locations. Consider refactoring.
Open

                case BOOMBASTIC:
                    TowerBoombastic newBoombastic = new TowerBoombastic(getMapStructure().getField(pos), level, gameActivity);
                    getMatchField().addTower(newBoombastic);
                    getMapStructure().getField(pos).setFieldDescription(FieldDescription.TOWER);
                    break;
Severity: Major
Found in app/src/main/java/de/dhbw/game/Game.java and 4 other locations - About 35 mins to fix
app/src/main/java/de/dhbw/game/Game.java on lines 257..261
app/src/main/java/de/dhbw/game/Game.java on lines 262..266
app/src/main/java/de/dhbw/game/Game.java on lines 272..276
app/src/main/java/de/dhbw/game/Game.java on lines 277..281

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 46.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Severity
Category
Status
Source
Language