fix: make movement events pick up infinity stones

This commit is contained in:
punchready 2021-05-27 17:30:36 +02:00
parent 3522cee9a4
commit 7f7459e7a7

View File

@ -509,7 +509,13 @@ class GameLogic {
((Character)state.entities.findEntity(((CharacterEvent)event).targetEntity)).hp.increaseValue(((CharacterEvent)event).amount);
}
case MoveEvent -> {
(state.entities.findEntity(((CharacterEvent)event).originEntity)).setPosition(((CharacterEvent)event).targetField);
Character target = (Character)state.entities.findEntity(((CharacterEvent)event).originEntity);
for(Entity entity: state.entities.findByPosition(((CharacterEvent)event).targetField)) {
if(entity instanceof InfinityStone) {
target.inventory.addStone(((InfinityStone)entity).type);
}
}
target.setPosition(((CharacterEvent)event).targetField);
}
case UseInfinityStoneEvent -> {
state.stoneCooldown.setCooldown(((CharacterEvent)event).stoneType, 10); //TODO: use stone cooldown from config