Merge remote-tracking branch 'origin/master'

This commit is contained in:
Anuken
2023-01-07 11:36:52 -05:00
9 changed files with 32 additions and 26 deletions

View File

@@ -145,7 +145,7 @@ public class BuilderAI extends AIController{
float minDst = Float.MAX_VALUE;
Player closest = null;
for(var player : Groups.player){
if(player.unit().canBuild() && !player.dead()){
if(player.unit().canBuild() && !player.dead() && player.team() == unit.team){
float dst = player.dst2(unit);
if(dst < minDst){
closest = player;

View File

@@ -43,7 +43,7 @@ public class Lightning{
bhit = false;
for(int i = 0; i < length / 2; i++){
hitCreate.create(null, team, x, y, rotation, damage, 1f, 1f, hitter);
hitCreate.create(null, team, x, y, rotation, damage * (hitter == null ? 1f : hitter.damageMultiplier()), 1f, 1f, hitter);
lines.add(new Vec2(x + Mathf.range(3f), y + Mathf.range(3f)));
if(lines.size > 1){

View File

@@ -141,9 +141,9 @@ public class EnergyFieldAbility extends Ability{
}else{
anyNearby = true;
if(other instanceof Building b){
b.damage(unit.team, damage);
b.damage(unit.team, damage * state.rules.unitDamage(unit.team));
}else{
other.damage(damage);
other.damage(damage * state.rules.unitDamage(unit.team));
}
if(other instanceof Statusc s){
s.apply(status, statusDuration);

View File

@@ -88,7 +88,7 @@ abstract class CrawlComp implements Posc, Rotc, Hitboxc, Unitc{
//TODO area damage to units
if(t.build != null && t.build.team != team){
t.build.damage(team, type.crushDamage * Time.delta);
t.build.damage(team, type.crushDamage * Time.delta * state.rules.unitDamage(team));
}
if(Mathf.chanceDelta(0.025)){

View File

@@ -192,7 +192,7 @@ abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{
}
if(type.legSplashDamage > 0){
Damage.damage(team, l.base.x, l.base.y, type.legSplashRange, type.legSplashDamage, false, true);
Damage.damage(team, l.base.x, l.base.y, type.legSplashRange, type.legSplashDamage * state.rules.unitDamage(team), false, true);
}
}

View File

@@ -66,7 +66,7 @@ abstract class TankComp implements Posc, Flyingc, Hitboxc, Unitc, ElevationMovec
//damage radius is 1 tile smaller to prevent it from just touching walls as it passes
&& Math.max(Math.abs(dx), Math.abs(dy)) <= r - 1){
t.build.damage(team, type.crushDamage * Time.delta * t.block().crushDamageMultiplier);
t.build.damage(team, type.crushDamage * Time.delta * t.block().crushDamageMultiplier * state.rules.unitDamage(team));
}
}
}

View File

@@ -618,7 +618,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
//if this unit crash landed (was flying), damage stuff in a radius
if(type.flying && !spawnedByCore && type.createWreck){
Damage.damage(team, x, y, Mathf.pow(hitSize, 0.94f) * 1.25f, Mathf.pow(hitSize, 0.75f) * type.crashDamageMultiplier * 5f, true, false, true);
Damage.damage(team, x, y, Mathf.pow(hitSize, 0.94f) * 1.25f, Mathf.pow(hitSize, 0.75f) * type.crashDamageMultiplier * 5f * state.rules.unitDamage(team), true, false, true);
}
if(!headless && type.createScorch){

View File

@@ -45,8 +45,10 @@ public class Scripts implements Disposable{
try{
Object o = context.evaluateString(scope, text, "console.js", 1);
if(o instanceof NativeJavaObject n) o = n.unwrap();
if(o instanceof Undefined) o = "undefined";
return String.valueOf(o);
if(o == null) o = "null";
else if(o instanceof Undefined) o = "undefined";
var out = o.toString();
return out == null ? "null" : out;
}catch(Throwable t){
return getError(t, false);
}