fix: remove ConsumedMP- and ConsumedAPEvents before TurnEvent for standard compatibility
This commit is contained in:
parent
bc6846b5b1
commit
5a90056cd8
@ -508,6 +508,16 @@ public class GameLogic {
|
|||||||
case ConsumedMPEvent -> {
|
case ConsumedMPEvent -> {
|
||||||
((NPC)state.entities.findEntity(((CharacterEvent)event).targetEntity)).mp.decreaseValue(((CharacterEvent)event).amount);
|
((NPC)state.entities.findEntity(((CharacterEvent)event).targetEntity)).mp.decreaseValue(((CharacterEvent)event).amount);
|
||||||
}
|
}
|
||||||
|
case TurnEvent -> {
|
||||||
|
if(((GameEvent)event).nextCharacter.type != EntityType.NPC) {
|
||||||
|
Character target = (Character)state.entities.findEntity(((GameEvent)event).nextCharacter);
|
||||||
|
target.ap.setValue(target.ap.getMax());
|
||||||
|
target.mp.setValue(target.mp.getMax());
|
||||||
|
}else if(((GameEvent)event).nextCharacter.id == NPCType.Thanos.getID()) {
|
||||||
|
NPC target = (NPC)state.entities.findEntity(((GameEvent)event).nextCharacter);
|
||||||
|
target.mp.setValue(target.mp.getMax());
|
||||||
|
}
|
||||||
|
}
|
||||||
case SpawnEntityEvent -> {
|
case SpawnEntityEvent -> {
|
||||||
state.entities.addEntity(((EntityEvent)event).entity);
|
state.entities.addEntity(((EntityEvent)event).entity);
|
||||||
}
|
}
|
||||||
@ -844,13 +854,6 @@ public class GameLogic {
|
|||||||
private static ArrayList<Event> handleGoose(GameState state) {
|
private static ArrayList<Event> handleGoose(GameState state) {
|
||||||
ArrayList<Event> result = new ArrayList<>();
|
ArrayList<Event> result = new ArrayList<>();
|
||||||
|
|
||||||
EntityID goose = new EntityID(EntityType.NPC, NPCType.Goose.getID());
|
|
||||||
|
|
||||||
result.add(new EventBuilder(EventType.TurnEvent)
|
|
||||||
.withTurnCount(state.turnOrder.size())
|
|
||||||
.withNextCharacter(goose)
|
|
||||||
.buildGameEvent());
|
|
||||||
|
|
||||||
ArrayList<StoneType> inventory = new ArrayList<>(state.unvomitedStones);
|
ArrayList<StoneType> inventory = new ArrayList<>(state.unvomitedStones);
|
||||||
int picked = rand.nextInt(inventory.size());
|
int picked = rand.nextInt(inventory.size());
|
||||||
StoneType stone = inventory.get(picked);
|
StoneType stone = inventory.get(picked);
|
||||||
@ -868,9 +871,14 @@ public class GameLogic {
|
|||||||
}
|
}
|
||||||
IntVector2 position = free.get(rand.nextInt(free.size()));
|
IntVector2 position = free.get(rand.nextInt(free.size()));
|
||||||
|
|
||||||
|
EntityID goose = new EntityID(EntityType.NPC, NPCType.Goose.getID());
|
||||||
result.add(new EventBuilder(EventType.SpawnEntityEvent)
|
result.add(new EventBuilder(EventType.SpawnEntityEvent)
|
||||||
.withEntity(new NPC(goose, position, inventory))
|
.withEntity(new NPC(goose, position, inventory))
|
||||||
.buildEntityEvent());
|
.buildEntityEvent());
|
||||||
|
result.add(new EventBuilder(EventType.TurnEvent)
|
||||||
|
.withTurnCount(state.turnOrder.size())
|
||||||
|
.withNextCharacter(goose)
|
||||||
|
.buildGameEvent());
|
||||||
result.add(new EventBuilder(EventType.SpawnEntityEvent)
|
result.add(new EventBuilder(EventType.SpawnEntityEvent)
|
||||||
.withEntity(new InfinityStone(new EntityID(EntityType.InfinityStones, stone.getID()), position, stone))
|
.withEntity(new InfinityStone(new EntityID(EntityType.InfinityStones, stone.getID()), position, stone))
|
||||||
.buildEntityEvent());
|
.buildEntityEvent());
|
||||||
@ -890,13 +898,6 @@ public class GameLogic {
|
|||||||
private static ArrayList<Event> handleStan(GameState state, HashSet<EntityID> revived) {
|
private static ArrayList<Event> handleStan(GameState state, HashSet<EntityID> revived) {
|
||||||
ArrayList<Event> result = new ArrayList<>();
|
ArrayList<Event> result = new ArrayList<>();
|
||||||
|
|
||||||
EntityID stan = new EntityID(EntityType.NPC, NPCType.Stan.getID());
|
|
||||||
|
|
||||||
result.add(new EventBuilder(EventType.TurnEvent)
|
|
||||||
.withTurnCount(state.turnOrder.size())
|
|
||||||
.withNextCharacter(stan)
|
|
||||||
.buildGameEvent());
|
|
||||||
|
|
||||||
ArrayList<Character> characters = new ArrayList<>();
|
ArrayList<Character> characters = new ArrayList<>();
|
||||||
|
|
||||||
ArrayList<IntVector2> targetOptions = new ArrayList<>();
|
ArrayList<IntVector2> targetOptions = new ArrayList<>();
|
||||||
@ -921,9 +922,14 @@ public class GameLogic {
|
|||||||
}
|
}
|
||||||
IntVector2 spawnPosition = spawnOptions.get(rand.nextInt(spawnOptions.size()));
|
IntVector2 spawnPosition = spawnOptions.get(rand.nextInt(spawnOptions.size()));
|
||||||
|
|
||||||
|
EntityID stan = new EntityID(EntityType.NPC, NPCType.Stan.getID());
|
||||||
result.add(new EventBuilder(EventType.SpawnEntityEvent)
|
result.add(new EventBuilder(EventType.SpawnEntityEvent)
|
||||||
.withEntity(new NPC(stan, spawnPosition))
|
.withEntity(new NPC(stan, spawnPosition))
|
||||||
.buildEntityEvent());
|
.buildEntityEvent());
|
||||||
|
result.add(new EventBuilder(EventType.TurnEvent)
|
||||||
|
.withTurnCount(state.turnOrder.size())
|
||||||
|
.withNextCharacter(stan)
|
||||||
|
.buildGameEvent());
|
||||||
|
|
||||||
for(Character character: characters) {
|
for(Character character: characters) {
|
||||||
if(checkLineOfSight(state, spawnPosition, character.getPosition())) {
|
if(checkLineOfSight(state, spawnPosition, character.getPosition())) {
|
||||||
@ -1115,14 +1121,6 @@ public class GameLogic {
|
|||||||
thanos.mp.setMax(thanos.mp.getMax() + 1);//TODO: use event for this...
|
thanos.mp.setMax(thanos.mp.getMax() + 1);//TODO: use event for this...
|
||||||
}
|
}
|
||||||
|
|
||||||
if(thanos.mp.getValue() != thanos.mp.getMax()) {
|
|
||||||
result.add(new EventBuilder(EventType.ConsumedMPEvent)
|
|
||||||
.withTargetEntity(state.activeCharacter)
|
|
||||||
.withTargetField(thanos.getPosition())
|
|
||||||
.withAmount(thanos.mp.getValue() - thanos.mp.getMax())
|
|
||||||
.buildGameEvent());
|
|
||||||
thanos.mp.setValue(thanos.mp.getMax());
|
|
||||||
}
|
|
||||||
result.addAll(handleThanos(state, thanos));
|
result.addAll(handleThanos(state, thanos));
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@ -1130,20 +1128,6 @@ public class GameLogic {
|
|||||||
|
|
||||||
Character activeCharacter = (Character)state.entities.findEntity(state.activeCharacter);
|
Character activeCharacter = (Character)state.entities.findEntity(state.activeCharacter);
|
||||||
|
|
||||||
if(activeCharacter.ap.getValue() != activeCharacter.ap.getMax()) {
|
|
||||||
result.add(new EventBuilder(EventType.ConsumedAPEvent)
|
|
||||||
.withTargetEntity(state.activeCharacter)
|
|
||||||
.withTargetField(activeCharacter.getPosition())
|
|
||||||
.withAmount(activeCharacter.ap.getValue() - activeCharacter.ap.getMax())
|
|
||||||
.buildGameEvent());
|
|
||||||
}
|
|
||||||
if(activeCharacter.mp.getValue() != activeCharacter.mp.getMax()) {
|
|
||||||
result.add(new EventBuilder(EventType.ConsumedMPEvent)
|
|
||||||
.withTargetEntity(state.activeCharacter)
|
|
||||||
.withTargetField(activeCharacter.getPosition())
|
|
||||||
.withAmount(activeCharacter.mp.getValue() - activeCharacter.mp.getMax())
|
|
||||||
.buildGameEvent());
|
|
||||||
}
|
|
||||||
result.add(new EventBuilder(EventType.TurnEvent)
|
result.add(new EventBuilder(EventType.TurnEvent)
|
||||||
.withTurnCount(state.turnOrder.size())
|
.withTurnCount(state.turnOrder.size())
|
||||||
.withNextCharacter(state.activeCharacter)
|
.withNextCharacter(state.activeCharacter)
|
||||||
|
Loading…
Reference in New Issue
Block a user