mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-15 18:27:36 +07:00
Difficulty & AI tweaks
This commit is contained in:
@ -462,17 +462,19 @@ public class Pathfinder implements Runnable{
|
|||||||
@Override
|
@Override
|
||||||
protected void getPositions(IntSeq out){
|
protected void getPositions(IntSeq out){
|
||||||
if(state.rules.randomWaveAI && team == state.rules.waveTeam){
|
if(state.rules.randomWaveAI && team == state.rules.waveTeam){
|
||||||
rand.setSeed(state.rules.waves ? state.wave : (int)(state.tick / (5400)));
|
rand.setSeed(state.rules.waves ? state.wave : (int)(state.tick / (5400)) + hashCode());
|
||||||
|
|
||||||
//maximum amount of different target flag types they will attack
|
//maximum amount of different target flag types they will attack
|
||||||
int max = 2;
|
int max = 1;
|
||||||
|
|
||||||
for(int attempt = 0; attempt < 5 && max > 0; attempt++){
|
for(int attempt = 0; attempt < 5 && max > 0; attempt++){
|
||||||
var targets = indexer.getEnemy(team, randomTargets[rand.random(randomTargets.length - 1)]);
|
var targets = indexer.getEnemy(team, randomTargets[rand.random(randomTargets.length - 1)]);
|
||||||
if(!targets.isEmpty()){
|
if(!targets.isEmpty()){
|
||||||
max --;
|
max --;
|
||||||
for(Building other : targets){
|
for(Building other : targets){
|
||||||
out.add(other.tile.array());
|
if((other.items != null && other.items.any()) || other.status() != BlockStatus.noInput){
|
||||||
|
out.add(other.tile.array());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package mindustry.ai.types;
|
|||||||
|
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
import mindustry.entities.units.*;
|
import mindustry.entities.units.*;
|
||||||
|
import mindustry.game.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.world.meta.*;
|
import mindustry.world.meta.*;
|
||||||
|
|
||||||
@ -29,6 +30,30 @@ public class FlyingAI extends AIController{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Teamc targetFlag(float x, float y, BlockFlag flag, boolean enemy){
|
||||||
|
if(state.rules.randomWaveAI){
|
||||||
|
if(unit.team == Team.derelict) return null;
|
||||||
|
var list = enemy ? indexer.getEnemy(unit.team, flag) : indexer.getFlagged(unit.team, flag);
|
||||||
|
if(list.isEmpty()) return null;
|
||||||
|
|
||||||
|
Building closest = null;
|
||||||
|
float cdist = 0f;
|
||||||
|
for(Building t : list){
|
||||||
|
if((t.items != null && t.items.any()) || t.status() != BlockStatus.noInput){
|
||||||
|
float dst = t.dst2(x, y);
|
||||||
|
if(closest == null || dst < cdist){
|
||||||
|
closest = t;
|
||||||
|
cdist = dst;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return closest;
|
||||||
|
}else{
|
||||||
|
return super.targetFlag(x, y, flag, enemy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Teamc findTarget(float x, float y, float range, boolean air, boolean ground){
|
public Teamc findTarget(float x, float y, float range, boolean air, boolean ground){
|
||||||
var result = findMainTarget(x, y, range, air, ground);
|
var result = findMainTarget(x, y, range, air, ground);
|
||||||
|
@ -6,8 +6,8 @@ public enum Difficulty{
|
|||||||
//TODO these need tweaks
|
//TODO these need tweaks
|
||||||
easy(1f, 0.75f, 1.5f),
|
easy(1f, 0.75f, 1.5f),
|
||||||
normal(1f, 1f, 1f),
|
normal(1f, 1f, 1f),
|
||||||
hard(1.25f, 1.5f, 0.75f),
|
hard(1.25f, 1.5f, 0.8f),
|
||||||
eradication(1.5f, 2f, 0.5f);
|
eradication(1.5f, 2f, 0.6f);
|
||||||
|
|
||||||
public static final Difficulty[] all = values();
|
public static final Difficulty[] all = values();
|
||||||
|
|
||||||
|
@ -26,4 +26,4 @@ org.gradle.caching=true
|
|||||||
org.gradle.internal.http.socketTimeout=100000
|
org.gradle.internal.http.socketTimeout=100000
|
||||||
org.gradle.internal.http.connectionTimeout=100000
|
org.gradle.internal.http.connectionTimeout=100000
|
||||||
android.enableR8.fullMode=false
|
android.enableR8.fullMode=false
|
||||||
archash=8073823706
|
archash=25e8455084
|
||||||
|
Reference in New Issue
Block a user