fix: minor bugfixes and standard compatibility
This commit is contained in:
parent
9be5f6c10c
commit
e0af4cf01c
@ -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();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user