Merging changes from private branch
This commit is contained in:
@@ -4,6 +4,7 @@ import arc.*;
|
||||
import arc.scene.ui.layout.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.ui.*;
|
||||
|
||||
public abstract class Ability implements Cloneable{
|
||||
protected static final float descriptionWidth = 350f;
|
||||
@@ -13,11 +14,26 @@ public abstract class Ability implements Cloneable{
|
||||
public float data;
|
||||
|
||||
public void update(Unit unit){}
|
||||
|
||||
public void draw(Unit unit){}
|
||||
|
||||
public void death(Unit unit){}
|
||||
|
||||
public void created(Unit unit){}
|
||||
|
||||
public void init(UnitType type){}
|
||||
|
||||
public void displayBars(Unit unit, Table bars){}
|
||||
|
||||
public void display(Table t){
|
||||
t.table(Styles.grayPanel, a -> {
|
||||
a.add("[accent]" + localized()).padBottom(4).center().top().expandX();
|
||||
a.row();
|
||||
a.left().top().defaults().left();
|
||||
addStats(a);
|
||||
}).pad(5).margin(10).growX().top().uniformX();
|
||||
}
|
||||
|
||||
public void addStats(Table t){
|
||||
if(Core.bundle.has(getBundle() + ".description")){
|
||||
t.add(Core.bundle.get(getBundle() + ".description")).wrap().width(descriptionWidth);
|
||||
|
||||
@@ -13,8 +13,8 @@ import static mindustry.Vars.*;
|
||||
|
||||
public class LiquidRegenAbility extends Ability{
|
||||
public Liquid liquid;
|
||||
public float slurpSpeed = 9f;
|
||||
public float regenPerSlurp = 2.9f;
|
||||
public float slurpSpeed = 5f;
|
||||
public float regenPerSlurp = 6f;
|
||||
public float slurpEffectChance = 0.4f;
|
||||
public Effect slurpEffect = Fx.heal;
|
||||
|
||||
@@ -31,7 +31,7 @@ public class LiquidRegenAbility extends Ability{
|
||||
//TODO timer?
|
||||
|
||||
//TODO effects?
|
||||
if(unit.damaged()){
|
||||
if(unit.damaged() && !unit.isFlying()){
|
||||
boolean healed = false;
|
||||
int tx = unit.tileX(), ty = unit.tileY();
|
||||
int rad = Math.max((int)(unit.hitSize / tilesize * 0.6f), 1);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package mindustry.entities.abilities;
|
||||
|
||||
import arc.graphics.*;
|
||||
import arc.math.*;
|
||||
import arc.util.*;
|
||||
import mindustry.*;
|
||||
import mindustry.content.*;
|
||||
@@ -9,8 +10,9 @@ import mindustry.gen.*;
|
||||
|
||||
public class MoveEffectAbility extends Ability{
|
||||
public float minVelocity = 0.08f;
|
||||
public float interval = 3f;
|
||||
public float x, y, rotation;
|
||||
public float interval = 3f, chance = 0f;
|
||||
public int amount = 1;
|
||||
public float x, y, rotation, rangeX, rangeY, rangeLengthMin, rangeLengthMax;
|
||||
public boolean rotateEffect = false;
|
||||
public float effectParam = 3f;
|
||||
public boolean teamColor = false;
|
||||
@@ -38,10 +40,17 @@ public class MoveEffectAbility extends Ability{
|
||||
if(Vars.headless) return;
|
||||
|
||||
counter += Time.delta;
|
||||
if(unit.vel.len2() >= minVelocity * minVelocity && (counter >= interval) && !unit.inFogTo(Vars.player.team())){
|
||||
Tmp.v1.trns(unit.rotation - 90f, x, y);
|
||||
if(unit.vel.len2() >= minVelocity * minVelocity && (counter >= interval || (chance > 0 && Mathf.chanceDelta(chance))) && !unit.inFogTo(Vars.player.team())){
|
||||
if(rangeLengthMax > 0){
|
||||
Tmp.v1.trns(unit.rotation - 90f, x, y).add(Tmp.v2.rnd(Mathf.random(rangeLengthMin, rangeLengthMax)));
|
||||
}else{
|
||||
Tmp.v1.trns(unit.rotation - 90f, x + Mathf.range(rangeX), y + Mathf.range(rangeY));
|
||||
}
|
||||
|
||||
counter %= interval;
|
||||
effect.at(Tmp.v1.x + unit.x, Tmp.v1.y + unit.y, (rotateEffect ? unit.rotation : effectParam) + rotation, teamColor ? unit.team.color : color, parentizeEffects ? unit : null);
|
||||
for(int i = 0; i < amount; i++){
|
||||
effect.at(Tmp.v1.x + unit.x, Tmp.v1.y + unit.y, (rotateEffect ? unit.rotation : effectParam) + rotation, teamColor ? unit.team.color : color, parentizeEffects ? unit : null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user