Definition of all bullet types listed on trello
This commit is contained in:
@@ -70,6 +70,11 @@ public class Player extends Unit implements BlockBuilder {
|
||||
heal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getArmor() {
|
||||
return 0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemoteShoot(BulletType type, float x, float y, float rotation, short data) {
|
||||
Weapon weapon = Upgrade.getByID(Bits.getLeftByte(data));
|
||||
|
||||
@@ -178,6 +178,7 @@ public abstract class Unit extends SyncEntity implements SerializableEntity {
|
||||
public void drawUnder(){}
|
||||
public void drawOver(){}
|
||||
|
||||
public abstract float getArmor();
|
||||
public abstract boolean acceptsAmmo(Item item);
|
||||
public abstract void addAmmo(Item item);
|
||||
public abstract float getMass();
|
||||
|
||||
@@ -7,10 +7,16 @@ import io.anuke.ucore.core.Effects;
|
||||
import io.anuke.ucore.entities.BaseBulletType;
|
||||
|
||||
public abstract class BulletType extends BaseBulletType<Bullet>{
|
||||
/**Knockback in velocity.*/
|
||||
public float knockback;
|
||||
/**Whether this bullet hits tiles.*/
|
||||
public boolean hitTiles = true;
|
||||
/**Status effect applied on hit.*/
|
||||
public StatusEffect status = StatusEffects.none;
|
||||
/**Intensity of applied status effect in terms of duration.*/
|
||||
public float statusIntensity = 0.5f;
|
||||
/**What fraction of armor is pierced, 0-1*/
|
||||
public float armorPierce = 0f;
|
||||
|
||||
public BulletType(float speed, float damage){
|
||||
this.speed = speed;
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
package io.anuke.mindustry.entities.bullet;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.math.GridPoint2;
|
||||
import io.anuke.mindustry.content.fx.BulletFx;
|
||||
import io.anuke.mindustry.content.fx.Fx;
|
||||
import io.anuke.mindustry.entities.effect.Fire;
|
||||
import io.anuke.mindustry.entities.effect.Puddle;
|
||||
import io.anuke.mindustry.type.Liquid;
|
||||
import io.anuke.ucore.core.Effects;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
import io.anuke.ucore.graphics.Fill;
|
||||
import io.anuke.ucore.util.Geometry;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
import static io.anuke.mindustry.Vars.tilesize;
|
||||
import static io.anuke.mindustry.Vars.world;
|
||||
|
||||
public class LiquidBulletType extends BulletType {
|
||||
Liquid liquid;
|
||||
|
||||
public LiquidBulletType(Liquid liquid) {
|
||||
super(2.5f, 0);
|
||||
this.liquid = liquid;
|
||||
|
||||
lifetime = 70f;
|
||||
despawneffect = Fx.none;
|
||||
hiteffect = BulletFx.hitLiquid;
|
||||
drag = 0.01f;
|
||||
knockback = 0.5f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Bullet b) {
|
||||
Draw.color(liquid.color, Color.WHITE, b.fout() / 100f + Mathf.randomSeedRange(b.id, 0.1f));
|
||||
|
||||
Fill.circle(b.x, b.y, 0.5f + b.fout()*2.5f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hit(Bullet b, float hitx, float hity) {
|
||||
Effects.effect(hiteffect, liquid.color, hitx, hity);
|
||||
Puddle.deposit(world.tileWorld(hitx, hity), liquid, 5f);
|
||||
|
||||
if(liquid.temperature <= 0.5f && liquid.flammability < 0.3f){
|
||||
float intensity = 400f;
|
||||
Fire.extinguish(world.tileWorld(hitx, hity), intensity);
|
||||
for(GridPoint2 p : Geometry.d4){
|
||||
Fire.extinguish(world.tileWorld(hitx + p.x*tilesize, hity + p.y*tilesize), intensity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -55,6 +55,11 @@ public class BaseUnit extends Unit{
|
||||
this.state.set(this, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getArmor() {
|
||||
return type.armor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean acceptsAmmo(Item item) {
|
||||
return type.ammo.containsKey(item) && inventory.canAcceptAmmo(type.ammo.get(item));
|
||||
|
||||
@@ -44,6 +44,7 @@ public abstract class UnitType {
|
||||
protected float maxVelocity = 5f;
|
||||
protected float reload = 40f;
|
||||
protected float retreatPercent = 0.2f;
|
||||
protected float armor = 0f;
|
||||
protected ObjectMap<Item, AmmoType> ammo = new ObjectMap<>();
|
||||
|
||||
public UnitType(String name){
|
||||
|
||||
Reference in New Issue
Block a user