Skip to content

Commit

Permalink
fix arrowtrap/sungod rotation cooldowns
Browse files Browse the repository at this point in the history
  • Loading branch information
tedpark217 committed Jun 7, 2024
1 parent 18848d5 commit 133d0d3
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion src/server/game/servergamestate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -512,10 +512,39 @@ void ServerGameState::update(const EventList& events) {
break;
}

auto end = dm->sharedTrapInventory.trapsInCooldown.end();
// handle arrowtrap / sungod seperately
if (trapPlacementEvent.cell == CellType::ArrowTrapDown ||
trapPlacementEvent.cell == CellType::ArrowTrapUp ||
trapPlacementEvent.cell == CellType::ArrowTrapLeft ||
trapPlacementEvent.cell == CellType::ArrowTrapRight) {

if (!(dm->sharedTrapInventory.trapsInCooldown.find(CellType::ArrowTrapDown) == end &&
dm->sharedTrapInventory.trapsInCooldown.find(CellType::ArrowTrapUp) == end &&
dm->sharedTrapInventory.trapsInCooldown.find(CellType::ArrowTrapLeft) == end &&
dm->sharedTrapInventory.trapsInCooldown.find(CellType::ArrowTrapRight) == end)) {
break;
}
}

if (trapPlacementEvent.cell == CellType::FireballTrapDown ||
trapPlacementEvent.cell == CellType::FireballTrapUp ||
trapPlacementEvent.cell == CellType::FireballTrapLeft ||
trapPlacementEvent.cell == CellType::FireballTrapRight) {

if (!(dm->sharedTrapInventory.trapsInCooldown.find(CellType::FireballTrapDown) == end &&
dm->sharedTrapInventory.trapsInCooldown.find(CellType::FireballTrapUp) == end &&
dm->sharedTrapInventory.trapsInCooldown.find(CellType::FireballTrapLeft) == end &&
dm->sharedTrapInventory.trapsInCooldown.find(CellType::FireballTrapRight) == end)) {
break;
}
}

// handle remaining traps
auto it = dm->sharedTrapInventory.trapsInCooldown.find(trapPlacementEvent.cell);

// in cooldown map sadly
if (it != dm->sharedTrapInventory.trapsInCooldown.end()) {
if (it != end){
break;
}

Expand Down

0 comments on commit 133d0d3

Please sign in to comment.