|
楼主 |
发表于 2022-11-21 21:06:31
|
显示全部楼层
阳炎的武器我试了,有一定效果,但是代码不是写在武器相关的java文件里,我只在一个BaseEveryFrameCombatPlugin的继承类里面找到了有关距离计算的代码:
List<ShipAPI> nearbyShips = CombatUtils.getShipsWithinRange(shipLoc, area);
for (ShipAPI thisShip : nearbyShips) {
if (thisShip.getCollisionClass() == CollisionClass.NONE) {
continue;
}
Vector2f damagePoint = CollisionUtils.getCollisionPoint(shipLoc, thisShip.getLocation(), thisShip);
if (damagePoint == null) {
damagePoint = thisShip.getLocation();
}
Vector2f forward = new Vector2f(damagePoint);
forward.normalise();
forward.scale(5f);
Vector2f.add(forward, damagePoint, damagePoint);
float falloff = 1f - MathUtils.getDistance(ship, thisShip) / area;
if (ship.getOwner() == thisShip.getOwner() && ship != thisShip) {
falloff *= 0.5f;
}
engine.applyDamage(thisShip, damagePoint, damage * falloff, DamageType.ENERGY, emp * falloff * 0.25f, false,
false, ship);
ShipAPI empTarget = thisShip;
for (int i = 0; i <= (int) (damage * (falloff / 250f) * EXPLOSION_INTENSITY.get(ship.getHullSize())); i++) {
Vector2f point = MathUtils.getRandomPointInCircle(thisShip.getLocation(),
thisShip.getCollisionRadius() * 1.5f);
engine.spawnEmpArc(ship, point, empTarget, empTarget, DamageType.ENERGY, damage * falloff * 0.5f, emp *
falloff * 0.5f, 1000f, null,
(float) Math.sqrt(damage), COLOR_EMP_FRINGE, COLOR_EMP_CORE);
}
}
但是这个类名是爆炸...,效果应该是爆炸时候对附近的船进行能量伤害,应该不是我想要的武器
|
|