mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-25 22:58:47 +07:00
merge healbullets with bullettype
This commit is contained in:
parent
dda77dad4c
commit
e17f28b636
@ -379,12 +379,18 @@ public class Bullets implements ContentList{
|
||||
JsonIO.copy(damageLightning, damageLightningGround);
|
||||
damageLightningGround.collidesAir = false;
|
||||
|
||||
healBullet = new HealBulletType(5.2f, 13){{
|
||||
healBullet = new LaserBoltBulletType(5.2f, 13){{
|
||||
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;
|
||||
collidesTeam = true;
|
||||
backColor = Pal.heal;
|
||||
frontColor = Color.white;
|
||||
}};
|
||||
|
||||
fireball = new BulletType(1f, 4){
|
||||
|
@ -1191,6 +1191,10 @@ public class UnitTypes implements ContentList{
|
||||
smokeEffect = Fx.hitLaser;
|
||||
frontColor = Color.white;
|
||||
|
||||
healPercent = 5.5f;
|
||||
collidesTeam = true;
|
||||
backColor = Pal.heal;
|
||||
frontColor = Color.white;
|
||||
backColor = Pal.heal;
|
||||
trailColor = Pal.heal;
|
||||
}};
|
||||
@ -1292,6 +1296,7 @@ public class UnitTypes implements ContentList{
|
||||
speed = 0.001f;
|
||||
collides = false;
|
||||
|
||||
healPercent = 10f;
|
||||
splashDamage = 240f;
|
||||
splashDamageRadius = 115f;
|
||||
}};
|
||||
|
@ -13,6 +13,7 @@ import mindustry.gen.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.world.blocks.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
@ -77,6 +78,8 @@ public abstract class BulletType extends Content{
|
||||
public boolean backMove = true;
|
||||
/** Bullet range override. */
|
||||
public float range = -1f;
|
||||
/** Heal Bullet Percent **/
|
||||
public float healPercent = 0f;
|
||||
|
||||
//additional effects
|
||||
|
||||
@ -139,11 +142,16 @@ public abstract class BulletType extends Content{
|
||||
}
|
||||
|
||||
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){
|
||||
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){
|
||||
@ -185,6 +193,13 @@ public abstract class BulletType extends Content{
|
||||
if(status != StatusEffects.none){
|
||||
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++){
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
34
core/src/mindustry/entities/bullet/LaserBoltBulletType.java
Normal file
34
core/src/mindustry/entities/bullet/LaserBoltBulletType.java
Normal file
@ -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;
|
||||
}
|
||||
|
||||
canHeal = weapons.contains(w -> w.bullet instanceof HealBulletType);
|
||||
canHeal = weapons.contains(w -> w.bullet.healPercent > 0f);
|
||||
|
||||
//add mirrored weapon variants
|
||||
Seq<Weapon> mapped = new Seq<>();
|
||||
|
Loading…
Reference in New Issue
Block a user