mirror of
https://github.com/Anuken/Mindustry.git
synced 2024-11-11 14:56:10 +03:00
Mutual status effect transitions
This commit is contained in:
parent
9f926ef71e
commit
baedba0d5b
@ -21,7 +21,7 @@ public class StatusEffects implements ContentList{
|
||||
|
||||
burning = new StatusEffect("burning"){{
|
||||
color = Pal.lightFlame;
|
||||
damage = 0.12f; //over 8 seconds, this would be 60 damage
|
||||
damage = 0.12f; //over 8 seconds, this would be ~60 damage
|
||||
effect = Fx.burning;
|
||||
|
||||
init(() -> {
|
||||
@ -29,7 +29,7 @@ public class StatusEffects implements ContentList{
|
||||
trans(tarred, ((unit, time, newTime, result) -> {
|
||||
unit.damagePierce(8f);
|
||||
Fx.burning.at(unit.x + Mathf.range(unit.bounds() / 2f), unit.y + Mathf.range(unit.bounds() / 2f));
|
||||
result.set(this, Math.min(time + newTime, 300f));
|
||||
result.set(burning, Math.min(time + newTime, 300f));
|
||||
}));
|
||||
});
|
||||
}};
|
||||
@ -45,7 +45,7 @@ public class StatusEffects implements ContentList{
|
||||
|
||||
trans(blasted, ((unit, time, newTime, result) -> {
|
||||
unit.damagePierce(18f);
|
||||
result.set(this, time);
|
||||
result.set(freezing, time);
|
||||
}));
|
||||
});
|
||||
}};
|
||||
@ -72,7 +72,7 @@ public class StatusEffects implements ContentList{
|
||||
if(unit.team == state.rules.waveTeam){
|
||||
Events.fire(Trigger.shock);
|
||||
}
|
||||
result.set(this, time);
|
||||
result.set(wet, time);
|
||||
}));
|
||||
opposite(burning);
|
||||
});
|
||||
@ -97,7 +97,7 @@ public class StatusEffects implements ContentList{
|
||||
trans(tarred, ((unit, time, newTime, result) -> {
|
||||
unit.damagePierce(8f);
|
||||
Fx.burning.at(unit.x + Mathf.range(unit.bounds() / 2f), unit.y + Mathf.range(unit.bounds() / 2f));
|
||||
result.set(this, Math.min(time + newTime, 200f));
|
||||
result.set(melting, Math.min(time + newTime, 200f));
|
||||
}));
|
||||
});
|
||||
}};
|
||||
|
@ -61,6 +61,10 @@ abstract class StatusComp implements Posc, Flyingc{
|
||||
statuses.add(entry);
|
||||
}
|
||||
|
||||
void clearStatuses(){
|
||||
statuses.clear();
|
||||
}
|
||||
|
||||
/** Removes a status effect. */
|
||||
void unapply(StatusEffect effect){
|
||||
statuses.remove(e -> {
|
||||
|
@ -63,6 +63,7 @@ public class StatusEffect extends MappableContent{
|
||||
|
||||
protected void trans(StatusEffect effect, TransitionHandler handler){
|
||||
transitions.put(effect, handler);
|
||||
effect.transitions.put(this, handler);
|
||||
}
|
||||
|
||||
protected void opposite(StatusEffect... effect){
|
||||
|
Loading…
Reference in New Issue
Block a user