merge healbullets with bullettype
This commit is contained in:
@@ -379,12 +379,18 @@ public class Bullets implements ContentList{
|
|||||||
JsonIO.copy(damageLightning, damageLightningGround);
|
JsonIO.copy(damageLightning, damageLightningGround);
|
||||||
damageLightningGround.collidesAir = false;
|
damageLightningGround.collidesAir = false;
|
||||||
|
|
||||||
healBullet = new HealBulletType(5.2f, 13){{
|
healBullet = new LaserBoltBulletType(5.2f, 13){{
|
||||||
healPercent = 3f;
|
healPercent = 3f;
|
||||||
|
collidesTeam = true;
|
||||||
|
backColor = Pal.heal;
|
||||||
|
frontColor = Color.white;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
healBulletBig = new HealBulletType(5.2f, 15){{
|
healBulletBig = new LaserBoltBulletType(5.2f, 15){{
|
||||||
healPercent = 5.5f;
|
healPercent = 5.5f;
|
||||||
|
collidesTeam = true;
|
||||||
|
backColor = Pal.heal;
|
||||||
|
frontColor = Color.white;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
fireball = new BulletType(1f, 4){
|
fireball = new BulletType(1f, 4){
|
||||||
|
|||||||
@@ -1191,6 +1191,10 @@ public class UnitTypes implements ContentList{
|
|||||||
smokeEffect = Fx.hitLaser;
|
smokeEffect = Fx.hitLaser;
|
||||||
frontColor = Color.white;
|
frontColor = Color.white;
|
||||||
|
|
||||||
|
healPercent = 5.5f;
|
||||||
|
collidesTeam = true;
|
||||||
|
backColor = Pal.heal;
|
||||||
|
frontColor = Color.white;
|
||||||
backColor = Pal.heal;
|
backColor = Pal.heal;
|
||||||
trailColor = Pal.heal;
|
trailColor = Pal.heal;
|
||||||
}};
|
}};
|
||||||
@@ -1292,6 +1296,7 @@ public class UnitTypes implements ContentList{
|
|||||||
speed = 0.001f;
|
speed = 0.001f;
|
||||||
collides = false;
|
collides = false;
|
||||||
|
|
||||||
|
healPercent = 10f;
|
||||||
splashDamage = 240f;
|
splashDamage = 240f;
|
||||||
splashDamageRadius = 115f;
|
splashDamageRadius = 115f;
|
||||||
}};
|
}};
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import mindustry.gen.*;
|
|||||||
import mindustry.graphics.*;
|
import mindustry.graphics.*;
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
import mindustry.world.*;
|
import mindustry.world.*;
|
||||||
|
import mindustry.world.blocks.*;
|
||||||
|
|
||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
@@ -77,6 +78,8 @@ public abstract class BulletType extends Content{
|
|||||||
public boolean backMove = true;
|
public boolean backMove = true;
|
||||||
/** Bullet range override. */
|
/** Bullet range override. */
|
||||||
public float range = -1f;
|
public float range = -1f;
|
||||||
|
/** Heal Bullet Percent **/
|
||||||
|
public float healPercent = 0f;
|
||||||
|
|
||||||
//additional effects
|
//additional effects
|
||||||
|
|
||||||
@@ -139,11 +142,16 @@ public abstract class BulletType extends Content{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean collides(Bullet bullet, Building tile){
|
public boolean collides(Bullet bullet, Building tile){
|
||||||
return true;
|
return healPercent == 0f ? true : (tile.team != bullet.team || tile.healthf() < 1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void hitTile(Bullet b, Building tile, float initialHealth){
|
public void hitTile(Bullet b, Building tile, float initialHealth){
|
||||||
hit(b);
|
hit(b);
|
||||||
|
|
||||||
|
if(healPercent > 0f && tile.team == b.team && !(tile.block instanceof ConstructBlock)){
|
||||||
|
Fx.healBlockFull.at(tile.x, tile.y, tile.block.size, Pal.heal);
|
||||||
|
tile.heal(healPercent / 100f * tile.maxHealth());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void hitEntity(Bullet b, Hitboxc other, float initialHealth){
|
public void hitEntity(Bullet b, Hitboxc other, float initialHealth){
|
||||||
@@ -185,6 +193,13 @@ public abstract class BulletType extends Content{
|
|||||||
if(status != StatusEffects.none){
|
if(status != StatusEffects.none){
|
||||||
Damage.status(b.team, x, y, splashDamageRadius, status, statusDuration, collidesAir, collidesGround);
|
Damage.status(b.team, x, y, splashDamageRadius, status, statusDuration, collidesAir, collidesGround);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(healPercent >= 0f) {
|
||||||
|
indexer.eachBlock(b.team, x, y, splashDamageRadius, other -> other.damaged(), other -> {
|
||||||
|
Fx.healBlockFull.at(other.x, other.y, other.block.size, Pal.heal);
|
||||||
|
other.heal(healPercent / 100f * other.maxHealth());
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < lightning; i++){
|
for(int i = 0; i < lightning; i++){
|
||||||
|
|||||||
@@ -1,55 +0,0 @@
|
|||||||
package mindustry.entities.bullet;
|
|
||||||
|
|
||||||
import arc.graphics.*;
|
|
||||||
import arc.graphics.g2d.*;
|
|
||||||
import mindustry.content.*;
|
|
||||||
import mindustry.gen.*;
|
|
||||||
import mindustry.graphics.*;
|
|
||||||
import mindustry.world.blocks.*;
|
|
||||||
|
|
||||||
public class HealBulletType extends BulletType{
|
|
||||||
protected float healPercent = 3f;
|
|
||||||
protected float height = 7f, width = 2f;
|
|
||||||
protected Color backColor = Pal.heal, frontColor = Color.white;
|
|
||||||
|
|
||||||
public HealBulletType(float speed, float damage){
|
|
||||||
super(speed, damage);
|
|
||||||
|
|
||||||
shootEffect = Fx.shootHeal;
|
|
||||||
smokeEffect = Fx.hitLaser;
|
|
||||||
hitEffect = Fx.hitLaser;
|
|
||||||
despawnEffect = Fx.hitLaser;
|
|
||||||
collidesTeam = true;
|
|
||||||
hittable = false;
|
|
||||||
reflectable = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public HealBulletType(){
|
|
||||||
this(1f, 1f);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean collides(Bullet b, Building tile){
|
|
||||||
return tile.team != b.team || tile.healthf() < 1f;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void draw(Bullet b){
|
|
||||||
Draw.color(backColor);
|
|
||||||
Lines.stroke(width);
|
|
||||||
Lines.lineAngleCenter(b.x, b.y, b.rotation(), height);
|
|
||||||
Draw.color(frontColor);
|
|
||||||
Lines.lineAngleCenter(b.x, b.y, b.rotation(), height / 2f);
|
|
||||||
Draw.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void hitTile(Bullet b, Building tile, float initialHealth){
|
|
||||||
super.hit(b);
|
|
||||||
|
|
||||||
if(tile.team == b.team && !(tile.block instanceof ConstructBlock)){
|
|
||||||
Fx.healBlockFull.at(tile.x, tile.y, tile.block.size, Pal.heal);
|
|
||||||
tile.heal(healPercent / 100f * tile.maxHealth());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package mindustry.entities.bullet;
|
||||||
|
|
||||||
|
import arc.graphics.*;
|
||||||
|
import arc.graphics.g2d.*;
|
||||||
|
import mindustry.gen.*;
|
||||||
|
import mindustry.content.*;
|
||||||
|
|
||||||
|
public class LaserBoltBulletType extends BasicBulletType{
|
||||||
|
protected float height = 7f, width = 2f;
|
||||||
|
|
||||||
|
public LaserBoltBulletType(float speed, float damage){
|
||||||
|
super(speed, damage);
|
||||||
|
|
||||||
|
smokeEffect = Fx.hitLaser;
|
||||||
|
hitEffect = Fx.hitLaser;
|
||||||
|
despawnEffect = Fx.hitLaser;
|
||||||
|
hittable = false;
|
||||||
|
reflectable = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LaserBoltBulletType(){
|
||||||
|
this(1f, 1f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void draw(Bullet b){
|
||||||
|
Draw.color(backColor);
|
||||||
|
Lines.stroke(width);
|
||||||
|
Lines.lineAngleCenter(b.x, b.y, b.rotation(), height);
|
||||||
|
Draw.color(frontColor);
|
||||||
|
Lines.lineAngleCenter(b.x, b.y, b.rotation(), height / 2f);
|
||||||
|
Draw.reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -230,7 +230,7 @@ public class UnitType extends UnlockableContent{
|
|||||||
mechStepParticles = hitSize > 15f;
|
mechStepParticles = hitSize > 15f;
|
||||||
}
|
}
|
||||||
|
|
||||||
canHeal = weapons.contains(w -> w.bullet instanceof HealBulletType);
|
canHeal = weapons.contains(w -> w.bullet.healPercent > 0f);
|
||||||
|
|
||||||
//add mirrored weapon variants
|
//add mirrored weapon variants
|
||||||
Seq<Weapon> mapped = new Seq<>();
|
Seq<Weapon> mapped = new Seq<>();
|
||||||
|
|||||||
Reference in New Issue
Block a user