fix: make movement events pick up infinity stones
This commit is contained in:
parent
3522cee9a4
commit
7f7459e7a7
@ -509,7 +509,13 @@ class GameLogic {
|
|||||||
((Character)state.entities.findEntity(((CharacterEvent)event).targetEntity)).hp.increaseValue(((CharacterEvent)event).amount);
|
((Character)state.entities.findEntity(((CharacterEvent)event).targetEntity)).hp.increaseValue(((CharacterEvent)event).amount);
|
||||||
}
|
}
|
||||||
case MoveEvent -> {
|
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 -> {
|
case UseInfinityStoneEvent -> {
|
||||||
state.stoneCooldown.setCooldown(((CharacterEvent)event).stoneType, 10); //TODO: use stone cooldown from config
|
state.stoneCooldown.setCooldown(((CharacterEvent)event).stoneType, 10); //TODO: use stone cooldown from config
|
||||||
|
Loading…
Reference in New Issue
Block a user