fix: minor bugfixes and standard compatibility
This commit is contained in:
parent
9be5f6c10c
commit
e0af4cf01c
@ -134,7 +134,7 @@ class GameLogic {
|
|||||||
}
|
}
|
||||||
case PowerStone -> {
|
case PowerStone -> {
|
||||||
Character origin = (Character)state.entities.findEntity(data.originEntity);
|
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) {
|
if(origin.hp.getValue() != 1 && dmg > 0) {
|
||||||
result.add(new EventBuilder(EventType.TakenDamageEvent)
|
result.add(new EventBuilder(EventType.TakenDamageEvent)
|
||||||
.withTargetEntity(data.originEntity)
|
.withTargetEntity(data.originEntity)
|
||||||
@ -150,7 +150,7 @@ class GameLogic {
|
|||||||
}
|
}
|
||||||
case TimeStone -> {
|
case TimeStone -> {
|
||||||
Character origin = (Character)state.entities.findEntity(data.originEntity);
|
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) {
|
if(ap < 0) {
|
||||||
result.add(new EventBuilder(EventType.ConsumedAPEvent)
|
result.add(new EventBuilder(EventType.ConsumedAPEvent)
|
||||||
.withTargetEntity(data.originEntity)
|
.withTargetEntity(data.originEntity)
|
||||||
@ -158,7 +158,7 @@ class GameLogic {
|
|||||||
.withAmount(ap)
|
.withAmount(ap)
|
||||||
.buildEntityEvent());
|
.buildEntityEvent());
|
||||||
}
|
}
|
||||||
int mp = origin.mp.getMax() - origin.mp.getValue();
|
int mp = origin.mp.getValue() - origin.mp.getMax();
|
||||||
if(mp < 0) {
|
if(mp < 0) {
|
||||||
result.add(new EventBuilder(EventType.ConsumedMPEvent)
|
result.add(new EventBuilder(EventType.ConsumedMPEvent)
|
||||||
.withTargetEntity(data.originEntity)
|
.withTargetEntity(data.originEntity)
|
||||||
@ -231,7 +231,7 @@ class GameLogic {
|
|||||||
if(origin.meleeDamage != data.value) {
|
if(origin.meleeDamage != data.value) {
|
||||||
throw new InvalidRequestException();
|
throw new InvalidRequestException();
|
||||||
}
|
}
|
||||||
if(data.originField.distanceChebyshev(data.targetField) > 1) {
|
if(data.originField.distanceChebyshev(data.targetField) != 1) {
|
||||||
throw new InvalidRequestException();
|
throw new InvalidRequestException();
|
||||||
}
|
}
|
||||||
}else if(request.type == RequestType.RangedAttackRequest) {
|
}else if(request.type == RequestType.RangedAttackRequest) {
|
||||||
@ -277,7 +277,6 @@ class GameLogic {
|
|||||||
Character target = getCharacter(state, data.targetField, data.targetEntity);
|
Character target = getCharacter(state, data.targetField, data.targetEntity);
|
||||||
|
|
||||||
requireTurn(state, origin);
|
requireTurn(state, origin);
|
||||||
requireSameTeam(origin, target);
|
|
||||||
|
|
||||||
requireAlive(origin);
|
requireAlive(origin);
|
||||||
requireAlive(target);
|
requireAlive(target);
|
||||||
@ -359,7 +358,7 @@ class GameLogic {
|
|||||||
throw new InvalidRequestException();
|
throw new InvalidRequestException();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(target.hp.getValue() != 0) {
|
if(target.isAlive()) {
|
||||||
throw new InvalidRequestException();
|
throw new InvalidRequestException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user