Skip to content

Commit

Permalink
Better mana checks
Browse files Browse the repository at this point in the history
  • Loading branch information
tonihele committed Jul 21, 2024
1 parent 6d39db2 commit f407bfd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@ public void castKeeperSpell(short keeperSpellId, EntityId target, Point tile, Ve
}

// Deduct the mana
playerControllers.get(playerId).getManaControl().updateMana(0, keeperSpell.getManaCost());
playerControllers.get(playerId).getManaControl().addMana(-keeperSpell.getManaCost());

// Cast the spell
boolean spellUpgraded = researchableEntity.isUpgraded();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ && checkCastRule(mapInformation, mapTile, keeperSpell, player)
}

private static boolean checkPlayerMana(KeeperSpell keeperSpell, Keeper player) {
return keeperSpell.getManaCost() <= player.getMana();
return keeperSpell.getManaCost() <= player.getMana() - player.getManaLoose();
}

private static boolean checkTargetRule(EntityId target, EntityData entityData, KwdFile kwdFile, KeeperSpell keeperSpell, Keeper player) {
Expand Down

0 comments on commit f407bfd

Please sign in to comment.