package me.rkfg.xmpp.bot.plugins.game.effect;

import java.util.Collection;

import me.rkfg.xmpp.bot.plugins.game.World;
import me.rkfg.xmpp.bot.plugins.game.event.IEvent;
import me.rkfg.xmpp.bot.plugins.game.misc.Utils;

public class DeadEffect extends AbstractEffect {

    public static final String TYPE = "dead";

    public DeadEffect() {
        super(TYPE, "мёртв");
    }

    @Override
    public Collection<IEvent> processEvent(IEvent event) {
        return cancelEvent(); // dead man reacts to no events
    }

    @Override
    public void onBeforeAttach() {
        World.THIS.announce(Utils.getPlayerName(target) + " погиб!");
        target.log("Вы умерли.");
    }

    @Override
    public void onAfterAttach() {
        World.THIS.checkVictory();
    }

    @Override
    public void onAfterDetach() {
        World.THIS.announce(Utils.getPlayerName(target) + " воскрес!");
        target.log("Вы воскресли.");
    }

}

@@ -40,16 +40,75 @@
 ffect;%0A%0A
+import static me.rkfg.xmpp.bot.plugins.game.misc.Attrs.*;%0A%0A
 import j
@@ -503,24 +503,119 @@
 nt event) %7B%0A
+        target.as(PLAYER_OBJ).ifPresent(p -%3E event.getSource().log(%22%25s %D0%BC%D1%91%D1%80%D1%82%D0%B2.%22, p.getName()));%0A
         retu

Add dead message