Flag players hostile for damaging siege engines on a city grid
Damaging a siege engine on a city grid adds the attacker (or the owning player, for pets) to that city's outlaw list, unless they are in the city's nation or an allied nation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c9208000bb
commit
89cdf5655d
1 file changed
+38
-1
@@ -1867,8 +1867,10 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
||||
// Siege engines switch to whoever damages them, players and pets alike.
|
||||
// Misses and non-damaging powers do not pull them.
|
||||
|
||||
if (target.isSiege() && value < 0f && attacker != null && !attacker.equals(target))
|
||||
if (target.isSiege() && value < 0f && attacker != null && !attacker.equals(target)) {
|
||||
target.setCombatTarget(attacker);
|
||||
flagSiegeAttackerHostile(target, attacker);
|
||||
}
|
||||
|
||||
if (attacker.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
||||
|
||||
@@ -1903,6 +1905,41 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
||||
return 0;
|
||||
}
|
||||
|
||||
private static void flagSiegeAttackerHostile(Mob siegeEngine, AbstractCharacter attacker) {
|
||||
|
||||
// Damaging a siege engine on a city grid flags the player hostile to that
|
||||
// city, unless they belong to the city's nation or an allied nation.
|
||||
// Pets flag their owner.
|
||||
|
||||
City city;
|
||||
AbstractCharacter flagged;
|
||||
Guild cityNation;
|
||||
|
||||
city = ZoneManager.getCityAtLocation(siegeEngine.loc);
|
||||
|
||||
if (city == null)
|
||||
return;
|
||||
|
||||
flagged = attacker;
|
||||
|
||||
if (attacker.getObjectType().equals(GameObjectType.Mob))
|
||||
flagged = ((Mob) attacker).guardCaptain;
|
||||
|
||||
if (flagged == null || !flagged.getObjectType().equals(GameObjectType.PlayerCharacter))
|
||||
return;
|
||||
|
||||
cityNation = city.getGuild().getNation();
|
||||
|
||||
if (flagged.getGuild().getNation().equals(cityNation))
|
||||
return;
|
||||
|
||||
if (cityNation.getAllyList().contains(flagged.getGuild().getNation()))
|
||||
return;
|
||||
|
||||
if (!city.cityOutlaws.contains(flagged.getObjectUUID()))
|
||||
city.cityOutlaws.add(flagged.getObjectUUID());
|
||||
}
|
||||
|
||||
public float getCurrentHitpoints() {
|
||||
return this.health.get();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user