package net.sourceforge.pain.logic.event.console.command;
import net.sourceforge.pain.data.type.*;
import net.sourceforge.pain.logic.event.console.*;
import net.sourceforge.pain.logic.fn.*;
import net.sourceforge.pain.logic.fn.factory.*;
import net.sourceforge.pain.logic.affect.*;
import net.sourceforge.pain.network.console.*;
public final class Kill extends CommandHandler {
public void processCommand() throws Exception {
String target = commandParams;
if (target == null || target.length() == 0) {
MessageOutFn.outln(console, "Kill whom?");
} else {
final Interactive victim = SpaceFindFn.findByPrefix(player.asLocated(), target);
if (victim == null) {
MessageOutFn.outln(console, "They aren't here");
} else if (victim.sameObjectAs(player)) {
MessageOutFn.outln(console, "Suicide is a mortal sin.");
} else if (victim.isAffected(AffectType.AFFECT_IMMORTAL)) {
MessageOutFn.outln(console, "You failed.");
} else {
Creature creature = (Creature) victim.getRole(Creature.class);
if (creature == null) {
MessageOutFn.outln(console, "You failed.");
} else {
// real kill!!
MessageOutFn.outOne(victim, "$n {*{R[*] POWER HIT [*]{x you", player);
MessageOutFn.outOne(player, "You {*{R[*] POWER HIT [*]{x $n", victim);
MessageOutFn.outSpaceNoVictim(player, victim, "$n {*{R[*] POWER HIT [*]{x $N", player, victim);
MessageOutFn.outln(victim, "You have been KILLED!");
Console victimConsole = ConsoleFn.getConsole(victim);
if (victimConsole != null) {
ConsoleFn.forceDisconnect(victimConsole);
}
MessageOutFn.outOne(player, "$n is DEAD!", victim);
MessageOutFn.outSpaceNoVictim(player, victim, "$n is DEAD!", victim);
GlobalFactory.destroyObject(victim);
}
}
}
}
public void showHelp() {
MessageOutFn.outln(console, command.name+": allow you to kill any creature in room");
}
}