-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4b19e60
commit 7b28e35
Showing
10 changed files
with
165 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package fos.ai; | ||
|
||
import fos.content.FOSUnitTypes; | ||
import mindustry.entities.Units; | ||
import mindustry.entities.units.AIController; | ||
import mindustry.gen.Unit; | ||
|
||
public class ProtectorAI extends AIController { | ||
public Unit protectTarget; | ||
|
||
@Override | ||
public void updateUnit() { | ||
super.updateUnit(); | ||
|
||
if (protectTarget == null) { | ||
protectTarget = Units.closest(unit.team, unit.x, unit.y, u -> u.isPlayer() || u.type == FOSUnitTypes.legion); | ||
} | ||
} | ||
|
||
@Override | ||
public void updateMovement() { | ||
super.updateMovement(); | ||
|
||
if (protectTarget == null) return; | ||
|
||
// Just circle around the unit. That's the entire move set of this AI. | ||
circle(protectTarget, protectTarget.hitSize * 2); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package fos.type.abilities; | ||
|
||
import arc.graphics.g2d.*; | ||
import arc.scene.ui.layout.Table; | ||
import arc.util.Strings; | ||
import fos.type.draw.FOSStats; | ||
import mindustry.entities.abilities.Ability; | ||
import mindustry.gen.*; | ||
import mindustry.type.UnitType; | ||
import mindustry.world.meta.*; | ||
|
||
public class UnitResistanceAbility extends Ability { | ||
public UnitType unitType; | ||
public float resistance; | ||
|
||
public UnitResistanceAbility(UnitType type, float resistance) { | ||
this.unitType = type; | ||
this.resistance = resistance; | ||
} | ||
|
||
@Override | ||
public void addStats(Table t) { | ||
t.add("[lightgray]" + Stat.unitType.localized() + ": [white]" + unitType.localizedName); | ||
t.row(); | ||
t.add("[lightgray]" + FOSStats.unitDamageRes.localized() + ": [white]+" + Strings.autoFixed(resistance * 100, 1000) + StatUnit.percent.localized()); | ||
t.row(); | ||
} | ||
|
||
@Override | ||
public void draw(Unit unit) { | ||
super.draw(unit); | ||
|
||
int units = Groups.unit.count(u -> u.type == unitType); | ||
for (int i = 0; i < units; i++) { | ||
Draw.color(unit.team.color); | ||
Draw.alpha(resistance); | ||
Fill.circle(unit.x, unit.y, unit.hitSize); | ||
Lines.stroke(2f); | ||
Lines.circle(unit.x, unit.y, unit.hitSize); | ||
} | ||
} | ||
|
||
@Override | ||
public void update(Unit unit) { | ||
// Apply damage resistance based on the amount of given unit type. | ||
int units = Groups.unit.count(u -> u.type == unitType); | ||
unit.healthMultiplier += resistance * units; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters