From bffa12619c4d2c7026f3962ca8b3820a8534d74e Mon Sep 17 00:00:00 2001 From: Lixfel Date: Mon, 24 May 2021 08:30:02 +0200 Subject: [PATCH] Fix points Signed-off-by: Lixfel --- .../winconditions/WinconditionPoints.java | 17 ++++++++++------- .../WinconditionRelativeWhitelistPercent.java | 1 - 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/winconditions/WinconditionPoints.java b/FightSystem_Main/src/de/steamwar/fightsystem/winconditions/WinconditionPoints.java index b661148..84959d4 100644 --- a/FightSystem_Main/src/de/steamwar/fightsystem/winconditions/WinconditionPoints.java +++ b/FightSystem_Main/src/de/steamwar/fightsystem/winconditions/WinconditionPoints.java @@ -118,17 +118,20 @@ public class WinconditionPoints extends PercentWincondition implements Listener @Override protected void enable() { super.enable(); - points = 0; - int ownBlocks = totalBlocks; - int enemyBlocks = teamMap.get(Fight.getOpposite(fightTeam)).totalBlocks; - - if(enemyBlocks == 0) + TeamPoints opponent = teamMap.get(Fight.getOpposite(fightTeam)); + if(opponent.totalBlocks == 0) return; - if(enemyBlocks < ownBlocks) { + setup(opponent.totalBlocks); + opponent.setup(totalBlocks); + } + + private void setup(int enemyBlocks){ + points = 0; + if(enemyBlocks < totalBlocks) { this.factor = 100; //Original mit 20 (20% = 0.2 ergeben 2000 Punkte } else { - double f = 100.0 * ownBlocks / enemyBlocks; + double f = 100.0 * totalBlocks / enemyBlocks; if(f > 100) f = 100; diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/winconditions/WinconditionRelativeWhitelistPercent.java b/FightSystem_Main/src/de/steamwar/fightsystem/winconditions/WinconditionRelativeWhitelistPercent.java index cc48b84..b64df9c 100644 --- a/FightSystem_Main/src/de/steamwar/fightsystem/winconditions/WinconditionRelativeWhitelistPercent.java +++ b/FightSystem_Main/src/de/steamwar/fightsystem/winconditions/WinconditionRelativeWhitelistPercent.java @@ -41,5 +41,4 @@ public class WinconditionRelativeWhitelistPercent extends PercentWincondition im } }; } - }