Skip to content

Commit

Permalink
Cleanup Anuken#3
Browse files Browse the repository at this point in the history
  • Loading branch information
Natchuz committed Jul 1, 2019
1 parent 72850cd commit 82db324
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
7 changes: 3 additions & 4 deletions core/src/io/anuke/mindustry/core/GameState.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,17 @@ public enum State{
paused, playing, menu
}

public Array<Team> getWeakest(){
public Team getWeakest(){
int min = Integer.MAX_VALUE;
for(int i=0; i < points.length; i++) {
if(points[i]==-1)
continue;
if(min > points[i])
min = points[i];
}
Array<Team> out = new Array<>();
for(int i=0; i<Team.all.length; i++)
if(points[i]==min)
out.add(Team.all[i]);
return out;
return Team.all[i];
return null;
}
}
4 changes: 1 addition & 3 deletions core/src/io/anuke/mindustry/core/Logic.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,7 @@ public void eliminateWeakest(){

calcPoints();

for(Team team : state.getWeakest()){
Call.eliminateTeam(team.ordinal());
}
Call.eliminateTeam(state.getWeakest().ordinal());

Call.onRound();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,13 @@ public void damage(float damage, Team team){
if(eater.entity().items.total() > 0){
Item i = eater.entity.items.take();
Tile target = state.teams.get(team).cores.first();
Call.transferItemTo(i, 1, eater.entity().x, eater.entity().y, target);
for(Tile eaterCheck : state.teams.get(team).eaters){
if(eaterCheck.entity().items.total() < eaterCheck.block().itemCapacity){
target = eaterCheck;
break;
}
}
Call.transferItemTo(i, Math.round(damage/10), eater.entity().x, eater.entity().y, target);
}
}
}
Expand Down

0 comments on commit 82db324

Please sign in to comment.