Added incapacitation and cloning sickness debuffs

This commit is contained in:
Mads Boddum
2016-10-18 14:50:58 +02:00
parent 7d4d14a3fa
commit 48cb3ebde0
3 changed files with 18 additions and 12 deletions
+3 -2
View File
@@ -27,6 +27,7 @@
***********************************************************************************/
package services.combat;
import intents.BuffIntent;
import intents.chat.ChatBroadcastIntent;
import java.awt.Color;
import java.util.HashMap;
@@ -356,6 +357,7 @@ public class CombatManager extends Manager {
incapacitatedCreatures.put(incapacitatedPlayer, executor.schedule(() -> expireIncapacitation(incapacitatedPlayer), incapacitationCounter, TimeUnit.SECONDS));
}
new BuffIntent("incapWeaken", incapacitator, incapacitatedPlayer, false).broadcast();
new ChatBroadcastIntent(incapacitator.getOwner(), new ProsePackage(new StringId("base_player", "prose_target_incap"), "TT", incapacitatedPlayer.getName())).broadcast();
new ChatBroadcastIntent(incapacitatedPlayer.getOwner(), new ProsePackage(new StringId("base_player", "prose_victim_incap"), "TT", incapacitator.getName())).broadcast();
}
@@ -392,7 +394,7 @@ public class CombatManager extends Manager {
private void killCreature(CreatureObject killer, CreatureObject corpse) {
corpse.setPosture(Posture.DEAD);
Log.i(this, "%s was killed", corpse);
Log.i(this, "%s was killed by %s", corpse, killer);
new CreatureKilledIntent(killer, corpse).broadcast();
}
@@ -422,7 +424,6 @@ public class CombatManager extends Manager {
if (incapacitationTimer != null) {
if (incapacitationTimer.cancel(false)) { // If the task is running, let them get back up
killCreature(killer, corpse);
Log.i(this, "%s was deathblown by %s", corpse, killer);
}
} else {
// Can't happen with the current code, but in case it's ever refactored...
+2 -1
View File
@@ -27,6 +27,7 @@
***********************************************************************************/
package services.combat;
import intents.BuffIntent;
import intents.FactionIntent;
import intents.PlayerEventIntent;
import intents.chat.ChatBroadcastIntent;
@@ -367,7 +368,7 @@ public final class CorpseService extends Service {
corpse.setTurnScale(1);
corpse.setMovementScale(1);
corpse.setHealth(corpse.getMaxHealth());
// TODO NGE: cloning debuff
new BuffIntent("incapWeaken", corpse, corpse, true).broadcastAfterIntent(new BuffIntent("cloning_sickness", corpse, corpse, false));
}
/**
+13 -9
View File
@@ -54,7 +54,7 @@ public class BuffService extends Service {
// TODO buff slots A, B, C and D
// TODO remove buffs on respec. Listen for respec event and remove buffs with BuffData where REMOVE_ON_RESPEC == 1
// TODO remove group buff(s) from receiver when distance between caster and receiver is 100m. Perform same check upon zoning in
// TODO decay buffs on deathblow
// TODO decay buffs on deathblow buffs with BuffData where DECAY_ON_PVP_DEATH == 1
private final ScheduledExecutorService executor;
private final Map<CreatureObject, DelayQueue<BuffDelayed>> buffRemoval;
@@ -155,7 +155,9 @@ public class BuffService extends Service {
}
private void handleDisappear(CreatureObject creature) {
buffRemoval.remove(creature);
synchronized(buffRemoval) {
buffRemoval.remove(creature);
}
}
private void addBuff(CRC buffCrc, CreatureObject receiver, CreatureObject buffer) {
@@ -191,14 +193,16 @@ public class BuffService extends Service {
removeBuff(creature, buffCrc, true);
} else if(buff.getDuration() >= 0) {
// If this buff doesn't last forever or hasn't expired, we'll schedule it for removal in the future
DelayQueue<BuffDelayed> buffQueue = buffRemoval.get(creature);
if(buffQueue == null) {
buffQueue = new DelayQueue<>();
buffRemoval.put(creature, buffQueue);
synchronized (buffRemoval) {
DelayQueue<BuffDelayed> buffQueue = buffRemoval.get(creature);
if(buffQueue == null) {
buffQueue = new DelayQueue<>();
buffRemoval.put(creature, buffQueue);
}
buffQueue.add(new BuffDelayed(buff, buffCrc, creature));
}
buffQueue.add(new BuffDelayed(buff, buffCrc, creature));
}
}