From c4116cba97f4c691fec38d975301e81dc28b4b5c Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 8 Oct 2022 16:47:32 +0200 Subject: [PATCH] Update InFightDamage Add WinconditionAmongUs --- .../fightsystem/listener/InFightDamage.java | 4 ++- .../winconditions/WinconditionAmongUs.java | 33 +++++++++++++++++++ .../winconditions/Winconditions.java | 3 +- 3 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 FightSystem_Core/src/de/steamwar/fightsystem/winconditions/WinconditionAmongUs.java diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/listener/InFightDamage.java b/FightSystem_Core/src/de/steamwar/fightsystem/listener/InFightDamage.java index 09ec33a..9be2167 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/listener/InFightDamage.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/listener/InFightDamage.java @@ -20,10 +20,12 @@ package de.steamwar.fightsystem.listener; import de.steamwar.fightsystem.ArenaMode; +import de.steamwar.fightsystem.Config; import de.steamwar.fightsystem.FightSystem; import de.steamwar.fightsystem.fight.Fight; import de.steamwar.fightsystem.states.FightState; import de.steamwar.fightsystem.states.StateDependentListener; +import de.steamwar.fightsystem.winconditions.Winconditions; import net.md_5.bungee.api.ChatMessageType; import org.bukkit.entity.Arrow; import org.bukkit.entity.Player; @@ -36,7 +38,7 @@ import java.util.Objects; public class InFightDamage implements Listener { public InFightDamage() { - new StateDependentListener(ArenaMode.AntiReplay, FightState.Running, this); + new StateDependentListener(!Config.ActiveWinconditions.contains(Winconditions.AMONG_US), FightState.Running, this); } @EventHandler diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/winconditions/WinconditionAmongUs.java b/FightSystem_Core/src/de/steamwar/fightsystem/winconditions/WinconditionAmongUs.java new file mode 100644 index 0000000..927ed90 --- /dev/null +++ b/FightSystem_Core/src/de/steamwar/fightsystem/winconditions/WinconditionAmongUs.java @@ -0,0 +1,33 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2020 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.fightsystem.winconditions; + +import de.steamwar.fightsystem.states.FightState; +import de.steamwar.fightsystem.states.OneShotStateDependent; + +public class WinconditionAmongUs extends Wincondition { + + public WinconditionAmongUs() { + super("AmongUs"); + new OneShotStateDependent(Winconditions.AMONG_US, FightState.Ingame, () -> { + // TODO: Select 1 imposter from each team + }); + } +} diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/winconditions/Winconditions.java b/FightSystem_Core/src/de/steamwar/fightsystem/winconditions/Winconditions.java index 9d7ae2a..620a247 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/winconditions/Winconditions.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/winconditions/Winconditions.java @@ -38,5 +38,6 @@ public enum Winconditions { PUMPKIN_TECH_KO, HELLS_BELLS, - METEOR + METEOR, + AMONG_US }