Block damage multiplier rule

This commit is contained in:
Anuken 2020-06-15 09:58:46 -04:00
parent 0968f0be59
commit d04ce2a750
13 changed files with 45 additions and 33 deletions

View File

@ -780,10 +780,10 @@ rules.wavetimer = Wave Timer
rules.waves = Waves
rules.attack = Attack Mode
rules.enemyCheat = Infinite AI (Red Team) Resources
rules.unitdrops = Unit Drops
rules.blockhealthmultiplier = Block Health Multiplier
rules.blockdamagemultiplier = Block Damage Multiplier
rules.unitbuildspeedmultiplier = Unit Production Speed Multiplier
rules.unithealthmultiplier = Unit Health Multiplier
rules.blockhealthmultiplier = Block Health Multiplier
rules.unitdamagemultiplier = Unit Damage Multiplier
rules.enemycorebuildradius = Enemy Core No-Build Radius:[lightgray] (tiles)
rules.wavespacing = Wave Spacing:[lightgray] (sec)

View File

@ -133,6 +133,9 @@ public class Vars implements Loadable{
public static boolean clearSectors = false;
/** whether any light rendering is enabled */
public static boolean enableLight = true;
/** Whether to draw shadows of blocks at map edges and static blocks.
* Do not change unless you know exactly what you are doing.*/
public static boolean enableDarkness = true;
/** application data directory, equivalent to {@link Settings#getDataDirectory()} */
public static Fi dataDirectory;
/** data subdirectory used for screenshots */

View File

@ -222,7 +222,7 @@ public class Renderer implements ApplicationListener{
Draw.draw(Layer.light, lights::draw);
}
if(state.rules.drawDarkness){
if(enableDarkness){
Draw.draw(Layer.darkness, blocks::drawDarkness);
}

View File

@ -93,6 +93,10 @@ public abstract class BulletType extends Content{
public float weaveMag = -1f;
public float hitShake = 0f;
public float lightRadius = 16f;
public float lightOpacity = 0.3f;
public Color lightColor = Pal.powerLight;
public BulletType(float speed, float damage){
this.speed = speed;
this.damage = damage;
@ -161,6 +165,10 @@ public abstract class BulletType extends Content{
public void draw(Bulletc b){
}
public void drawLight(Bulletc b){
Drawf.light(b, lightRadius, lightColor, lightOpacity);
}
public void init(Bulletc b){
if(killShooter && b.owner() instanceof Healthc){
((Healthc)b.owner()).kill();

View File

@ -28,6 +28,9 @@ public class ContinuousLaserBulletType extends BulletType{
pierce = true;
hittable = false;
hitColor = colors[2];
incendAmount = 1;
incendSpread = 5;
incendChance = 0.4f;
}
protected ContinuousLaserBulletType(){
@ -53,15 +56,6 @@ public class ContinuousLaserBulletType extends BulletType{
}
}
/*
@Override
public void hit(Bulletc b, float hitx, float hity){
hitEffect.at(hitx, hity, colors[2]);
if(Mathf.chance(0.4)){
Fires.create(world.tileWorld(hitx + Mathf.range(5f), hity + Mathf.range(5f)));
}
}*/
@Override
public void draw(Bulletc b){
float baseLen = length * b.fout();
@ -82,4 +76,9 @@ public class ContinuousLaserBulletType extends BulletType{
Draw.reset();
}
@Override
public void drawLight(Bulletc b){
//no light drawn here
}
}

View File

@ -95,4 +95,9 @@ public class LaserBulletType extends BulletType{
Tmp.v1.trns(b.rotation(), baseLen * 1.1f);
Drawf.light(b.x(), b.y(), b.x() + Tmp.v1.x, b.y() + Tmp.v1.y, width * 1.4f * b.fout(), colors[0], 0.6f);
}
@Override
public void drawLight(Bulletc b){
//no light drawn here
}
}

View File

@ -18,6 +18,7 @@ import static mindustry.Vars.*;
@Component
abstract class BulletComp implements Timedc, Damagec, Hitboxc, Teamc, Posc, Drawc, Shielderc, Ownerc, Velc, Bulletc, Timerc{
@Import Team team;
@Import Entityc owner;
IntSeq collided = new IntSeq(6);
Object data;
@ -49,9 +50,9 @@ abstract class BulletComp implements Timedc, Damagec, Hitboxc, Teamc, Posc, Draw
@Override
public float damageMultiplier(){
if(owner() instanceof Unitc){
return ((Unitc)owner()).damageMultiplier();
}
if(owner instanceof Unitc) return ((Unitc)owner).damageMultiplier() * state.rules.unitDamageMultiplier;
if(owner instanceof Tilec) return state.rules.blockDamageMultiplier;
return 1f;
}
@ -133,8 +134,7 @@ abstract class BulletComp implements Timedc, Damagec, Hitboxc, Teamc, Posc, Draw
Draw.z(Layer.bullet);
type.draw(this);
//TODO refactor
Drawf.light(x(), y(), 16f, Pal.powerLight, 0.3f);
type.drawLight(this);
}
/** Sets the bullet's rotation in degrees. */

View File

@ -32,10 +32,12 @@ public class Rules{
public float unitBuildSpeedMultiplier = 1f;
/** How much health units start with. */
public float unitHealthMultiplier = 1f;
/** How much health blocks start with. */
public float blockHealthMultiplier = 1f;
/** How much damage any other units deal. */
public float unitDamageMultiplier = 1f;
/** How much health blocks start with. */
public float blockHealthMultiplier = 1f;
/** How much damage blocks (turrets) deal. */
public float blockDamageMultiplier = 1f;
/** Multiplier for buildings resource cost. */
public float buildCostMultiplier = 1f;
/** Multiplier for building speed. */
@ -68,9 +70,6 @@ public class Rules{
public boolean tutorial = false;
/** Whether a gameover can happen at all. Set this to false to implement custom gameover conditions. */
public boolean canGameOver = true;
/** Whether to draw shadows of blocks at map edges and static blocks.
* Do not change unless you know exactly what you are doing.*/
public boolean drawDarkness = true;
/** EXPERIMENTAL building AI. TODO remove */
public boolean buildAI = true;
/** Starting items put in cores */
@ -93,7 +92,7 @@ public class Rules{
/** special tags for additional info */
public StringMap tags = new StringMap();
/** Copies this ruleset exactly. Not very efficient at all, do not use often. */
/** Copies this ruleset exactly. Not efficient at all, do not use often. */
public Rules copy(){
return JsonIO.copy(this);
}

View File

@ -43,9 +43,8 @@ public class Pixelator implements Disposable{
Draw.draw(Layer.end, () -> {
buffer.end();
Draw.blend(Blending.disabled);
Draw.rect(buffer);
Draw.blend();
Blending.disabled.apply();
buffer.blit(Shaders.screenspace);
Core.camera.position.set(px, py);
renderer.setScale(pre);

View File

@ -669,7 +669,7 @@ public class Mods implements Loadable{
return new LoadedMod(sourceFile, zip, mainMod, meta);
}
/** Represents a plugin that has been loaded from a jar file.*/
/** Represents a mod's state. May be a jar file, folder or zip. */
public static class LoadedMod implements Publishable, Disposable{
/** The location of this mod's zip file/folder on the disk. */
public final Fi file;
@ -803,7 +803,7 @@ public class Mods implements Loadable{
}
}
/** Plugin metadata information.*/
/** Mod metadata information.*/
public static class ModMeta{
public String name, displayName, author, description, version, main, minGameVersion;
public Seq<String> dependencies = Seq.with();

View File

@ -293,8 +293,7 @@ public class Administration{
public boolean adminPlayer(String id, String usid){
PlayerInfo info = getCreateInfo(id);
if(info.admin && info.adminUsid != null && info.adminUsid.equals(usid))
return false;
if(info.admin && info.adminUsid != null && info.adminUsid.equals(usid)) return false;
info.adminUsid = usid;
info.admin = true;
@ -310,8 +309,7 @@ public class Administration{
public boolean unAdminPlayer(String id){
PlayerInfo info = getCreateInfo(id);
if(!info.admin)
return false;
if(!info.admin) return false;
info.admin = false;
save();

View File

@ -140,6 +140,7 @@ public class CustomRulesDialog extends BaseDialog{
number("$rules.buildspeedmultiplier", f -> rules.buildSpeedMultiplier = f, () -> rules.buildSpeedMultiplier);
number("$rules.deconstructrefundmultiplier", false, f -> rules.deconstructRefundMultiplier = f, () -> rules.deconstructRefundMultiplier, () -> !rules.infiniteResources);
number("$rules.blockhealthmultiplier", f -> rules.blockHealthMultiplier = f, () -> rules.blockHealthMultiplier);
number("$rules.blockdamagemultiplier", f -> rules.blockDamageMultiplier = f, () -> rules.blockDamageMultiplier);
main.button("$configure",
() -> loadoutDialog.show(Blocks.coreShard.itemCapacity, rules.loadout,

View File

@ -1,3 +1,3 @@
org.gradle.daemon=true
org.gradle.jvmargs=-Xms256m -Xmx1024m
archash=9fadfb97c7270920c22ac75ee4815663df7efc3d
archash=a074a6f49cf19f417b40fede82a429dab8c91cc0