Campaign tweaks

This commit is contained in:
Anuken
2020-10-31 14:52:03 -04:00
parent 9c54fcee2e
commit 05dcd7622b
7 changed files with 17 additions and 48 deletions

View File

@@ -28,7 +28,7 @@ public class LightningBulletType extends BulletType{
@Override
public float estimateDPS(){
return super.estimateDPS() * Math.max(lightningLength / 2f, 1);
return super.estimateDPS() * Math.max(lightningLength / 4f, 1);
}
@Override

View File

@@ -22,37 +22,12 @@ public class GameStats{
/** Friendly buildings destroyed. */
public int buildingsDestroyed;
//TODO fix
public RankResult calculateRank(Sector zone, boolean launched){
//unused
public RankResult calculateRank(Sector sector){
float score = 0;
//TODO implement wave/attack mode based score
/*
if(launched && zone.getRules().attackMode){
score += 3f;
}else if(wavesLasted >= zone.conditionWave){
//each new launch period adds onto the rank 'points'
score += (float)((wavesLasted - zone.conditionWave) / zone.launchPeriod + 1) * 1.2f;
}*/
//TODO implement
int capacity = 3000;//zone.loadout.findCore().itemCapacity;
//weigh used fractions
float frac = 0f;
Seq<Item> obtainable = zone.save == null ? new Seq<>() : zone.info.resources.select(i -> i instanceof Item).as();
for(Item item : obtainable){
frac += Mathf.clamp((float)itemsDelivered.get(item, 0) / capacity) / (float)obtainable.size;
}
score += frac * 1.6f;
if(!launched){
score *= 0.5f;
}
int rankIndex = Mathf.clamp((int)(score), 0, Rank.values().length - 1);
Rank rank = Rank.values()[rankIndex];
int rankIndex = Mathf.clamp((int)score, 0, Rank.all.length - 1);
Rank rank = Rank.all[rankIndex];
String sign = Math.abs((rankIndex + 0.5f) - score) < 0.2f || rank.name().contains("S") ? "" : (rankIndex + 0.5f) < score ? "-" : "+";
return new RankResult(rank, sign);
@@ -70,6 +45,8 @@ public class GameStats{
}
public enum Rank{
F, D, C, B, A, S, SS
F, D, C, B, A, S, SS;
public static final Rank[] all = values();
}
}

View File

@@ -323,7 +323,7 @@ public class UnitType extends UnlockableContent{
//suicide enemy
if(weapons.contains(w -> w.bullet.killShooter)){
//scale down DPS to be insignificant
dpsEstimate /= 40f;
dpsEstimate /= 20f;
}
}
}

View File

@@ -2,7 +2,6 @@ package mindustry.ui.dialogs;
import arc.*;
import mindustry.game.EventType.*;
import mindustry.game.GameStats.*;
import mindustry.game.*;
import mindustry.type.*;
import mindustry.ui.*;
@@ -78,11 +77,6 @@ public class GameOverDialog extends BaseDialog{
}
}
if(state.hasSector()){
RankResult result = state.stats.calculateRank(state.getSector(), true);
t.add(Core.bundle.format("stat.rank", result.rank + result.modifier));
t.row();
}
}).pad(12);
if(state.isCampaign()){

View File

@@ -177,11 +177,14 @@ public class MapsDialog extends BaseDialog{
t.row();
t.add("@editor.author").padRight(10).color(Color.gray);
t.row();
t.add(!map.custom && map.author().isEmpty() ? "Anuke" : map.author()).growX().wrap().padTop(2);
t.add(!map.custom && map.tags.get("author", "").isEmpty() ? "Anuke" : map.author()).growX().wrap().padTop(2);
t.row();
t.add("@editor.description").padRight(10).color(Color.gray).top();
t.row();
t.add(map.description()).growX().wrap().padTop(2);
if(!map.tags.get("description", "").isEmpty()){
t.add("@editor.description").padRight(10).color(Color.gray).top();
t.row();
t.add(map.description()).growX().wrap().padTop(2);
}
}).height(mapsize).width(mapsize);
table.row();

View File

@@ -617,7 +617,7 @@ public class Block extends UnlockableContent{
public ItemStack[] researchRequirements(){
ItemStack[] out = new ItemStack[requirements.length];
for(int i = 0; i < out.length; i++){
int quantity = 60 + Mathf.round(Mathf.pow(requirements[i].amount, 1.15f) * 20 * researchCostMultiplier, 10);
int quantity = 60 + Mathf.round(Mathf.pow(requirements[i].amount, 1.12f) * 20 * researchCostMultiplier, 10);
out[i] = new ItemStack(requirements[i].item, UI.roundAmount(quantity));
}