From e0af4cf01c03afbf6ed770dd5053a2fb9a1380c1 Mon Sep 17 00:00:00 2001 From: punchready Date: Thu, 3 Jun 2021 01:39:36 +0200 Subject: [PATCH] fix: minor bugfixes and standard compatibility --- .../marvelous/gamelibrary/gamelogic/GameLogic.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/java/uulm/teamname/marvelous/gamelibrary/gamelogic/GameLogic.java b/src/main/java/uulm/teamname/marvelous/gamelibrary/gamelogic/GameLogic.java index 5151ea0..d76c6dd 100644 --- a/src/main/java/uulm/teamname/marvelous/gamelibrary/gamelogic/GameLogic.java +++ b/src/main/java/uulm/teamname/marvelous/gamelibrary/gamelogic/GameLogic.java @@ -134,7 +134,7 @@ class GameLogic { } case PowerStone -> { Character origin = (Character)state.entities.findEntity(data.originEntity); - int dmg = (int)Math.round(origin.hp.getValue() * 0.1); + int dmg = (int)Math.round(origin.hp.getMax() * 0.1); if(origin.hp.getValue() != 1 && dmg > 0) { result.add(new EventBuilder(EventType.TakenDamageEvent) .withTargetEntity(data.originEntity) @@ -150,7 +150,7 @@ class GameLogic { } case TimeStone -> { Character origin = (Character)state.entities.findEntity(data.originEntity); - int ap = origin.ap.getMax() - origin.ap.getValue(); + int ap = origin.ap.getValue() - origin.ap.getMax(); if(ap < 0) { result.add(new EventBuilder(EventType.ConsumedAPEvent) .withTargetEntity(data.originEntity) @@ -158,7 +158,7 @@ class GameLogic { .withAmount(ap) .buildEntityEvent()); } - int mp = origin.mp.getMax() - origin.mp.getValue(); + int mp = origin.mp.getValue() - origin.mp.getMax(); if(mp < 0) { result.add(new EventBuilder(EventType.ConsumedMPEvent) .withTargetEntity(data.originEntity) @@ -231,7 +231,7 @@ class GameLogic { if(origin.meleeDamage != data.value) { throw new InvalidRequestException(); } - if(data.originField.distanceChebyshev(data.targetField) > 1) { + if(data.originField.distanceChebyshev(data.targetField) != 1) { throw new InvalidRequestException(); } }else if(request.type == RequestType.RangedAttackRequest) { @@ -277,7 +277,6 @@ class GameLogic { Character target = getCharacter(state, data.targetField, data.targetEntity); requireTurn(state, origin); - requireSameTeam(origin, target); requireAlive(origin); requireAlive(target); @@ -359,7 +358,7 @@ class GameLogic { throw new InvalidRequestException(); } - if(target.hp.getValue() != 0) { + if(target.isAlive()) { throw new InvalidRequestException(); } }