use of com.skelril.nitro.combat.PlayerCombatParser in project Skree by Skelril.
the class BuildWorldWrapper method createFor.
private PlayerCombatParser createFor(Cancellable event) {
return new PlayerCombatParser() {
@Override
public void processPvP(Player attacker, Player defender) {
Optional<PvPService> optService = Sponge.getServiceManager().provide(PvPService.class);
if (optService.isPresent()) {
PvPService service = optService.get();
if (service.getPvPState(attacker).allowByDefault() && service.getPvPState(defender).allowByDefault()) {
return;
}
}
attacker.sendMessage(Text.of(TextColors.RED, "PvP is opt-in only in build worlds!"));
event.setCancelled(true);
}
};
}
use of com.skelril.nitro.combat.PlayerCombatParser in project Skree by Skelril.
the class ZonePvPListener method createFor.
private PlayerCombatParser createFor(Cancellable event) {
return new PlayerCombatParser() {
@Override
public void processPvP(Player attacker, Player defender) {
Optional<PvPService> optService = Sponge.getServiceManager().provide(PvPService.class);
if (optService.isPresent()) {
PvPService service = optService.get();
if (service.getPvPState(attacker).allowByDefault() && service.getPvPState(defender).allowByDefault()) {
return;
}
}
attacker.sendMessage(Text.of(TextColors.RED, "PvP is opt-in only in this area!"));
event.setCancelled(true);
}
};
}
use of com.skelril.nitro.combat.PlayerCombatParser in project Skree by Skelril.
the class FrimusBossManager method handleDamaged.
private void handleDamaged() {
List<Instruction<DamagedCondition, Boss<Living, ZoneBossDetail<FreakyFourInstance>>>> damagedProcessor = getDamagedProcessor();
damagedProcessor.add((condition, boss) -> {
DamageEntityEvent event = condition.getEvent();
new PlayerCombatParser() {
@Override
public void processPlayerAttack(Player attacker, Living defender) {
if (condition.getDamageSource().get() instanceof IndirectEntityDamageSource) {
attacker.sendMessage(Text.of(TextColors.RED, "Projectiles can't harm me... Mwahahaha!"));
event.setCancelled(true);
}
}
}.parse(event);
return Optional.empty();
});
}
use of com.skelril.nitro.combat.PlayerCombatParser in project Skree by Skelril.
the class DeathMark method apply.
@Override
public Optional<Instruction<DamagedCondition, Boss<Zombie, CatacombsBossDetail>>> apply(DamagedCondition damagedCondition, Boss<Zombie, CatacombsBossDetail> zombieCatacombsBossDetailBoss) {
new PlayerCombatParser() {
@Override
public void processPlayerAttack(Player attacker, Living defender) {
CatacombsBossDetail detail = zombieCatacombsBossDetailBoss.getDetail();
CatacombsInstance inst = detail.getZone();
if (detail.isWarmingMark()) {
return;
}
if (detail.getMarked().isPresent()) {
if (attacker.equals(detail.getMarked().get())) {
inst.getPlayerMessageChannel(PlayerClassifier.SPECTATOR).send(Text.of(TextColors.YELLOW, attacker.getName() + " has been freed!"));
} else {
detail.getMarked().get().offer(Keys.HEALTH, 0D);
}
detail.setMarked(null);
} else if (activate(detail)) {
detail.warmMark();
inst.getPlayerMessageChannel(PlayerClassifier.SPECTATOR).send(Text.of(TextColors.DARK_RED, "The necromancer stares intently at " + attacker.getName() + "!"));
Task.builder().execute(() -> {
if (!inst.contains(attacker)) {
detail.setMarked(null);
return;
}
detail.setMarked(attacker);
inst.getPlayerMessageChannel(PlayerClassifier.SPECTATOR).send(Text.of(TextColors.DARK_RED, attacker.getName() + " has been marked!"));
}).delay(3, TimeUnit.SECONDS).submit(SkreePlugin.inst());
}
}
}.parse(damagedCondition.getEvent());
return Optional.empty();
}
use of com.skelril.nitro.combat.PlayerCombatParser in project Skree by Skelril.
the class TheForgeListener method onPlayerCombat.
@Listener
public void onPlayerCombat(CollideEntityEvent.Impact event, @First Projectile projectile) {
Optional<TheForgeInstance> optInst = manager.getApplicableZone(projectile);
if (!optInst.isPresent()) {
return;
}
new PlayerCombatParser() {
@Override
public void processMonsterAttack(Living attacker, Player defender) {
if (!(event instanceof DamageEntityEvent)) {
return;
}
DamageEntityEvent dEvent = (DamageEntityEvent) event;
if (isFlying(defender)) {
dEvent.setBaseDamage(dEvent.getBaseDamage() * 3);
}
}
}.parse(event);
}
Aggregations