Skip to content

Commit

Permalink
directly take imp gold value, no longer times 2
Browse files Browse the repository at this point in the history
and if you have many imps, high level imps still affordable
  • Loading branch information
Loobinex committed Jul 3, 2024
1 parent d14ca6a commit 8965ad3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
3 changes: 1 addition & 2 deletions src/engine_redraw.c
Original file line number Diff line number Diff line change
Expand Up @@ -846,8 +846,7 @@ TbBool draw_spell_cursor(PlayerState wrkstate, ThingIndex tng_idx, MapSubtlCoord
{
i = get_power_overcharge_level(player);
set_pointer_graphic(MousePG_SpellCharge0+i);
const struct MagicStats* pwrdynst = get_power_dynamic_stats(pwkind);
draw_spell_cost = pwrdynst->cost[i];
draw_spell_cost = compute_power_price(player->id_number, pwkind, i);
return true;
}
}
Expand Down
14 changes: 5 additions & 9 deletions src/magic.c
Original file line number Diff line number Diff line change
Expand Up @@ -756,14 +756,10 @@ TbBool can_cast_power_at_xy(PlayerNumber plyr_idx, PowerKind pwkind,
*/
GoldAmount compute_power_price_scaled_with_amount(PlayerNumber plyr_idx, PowerKind pwkind, long pwlevel, long amount)
{
const struct MagicStats *pwrdynst;
long i;
pwrdynst = get_power_dynamic_stats(pwkind);
// Increase price by given amount
i = amount + 1;
if (i < 1)
i = 1;
return pwrdynst->cost[pwlevel]*i/2;
const struct MagicStats *pwrdynst = get_power_dynamic_stats(pwkind);
if (amount < 0)
amount = 0;
return pwrdynst->cost[pwlevel] + (pwrdynst->cost[0] * amount);
}

/**
Expand Down Expand Up @@ -1289,7 +1285,7 @@ static TbResult magic_use_power_imp(PowerKind power_kind, PlayerNumber plyr_idx,
if ((mod_flags & PwMod_CastForFree) == 0)
{
// If we can't afford the spell, fail
if (!pay_for_spell(plyr_idx, power_kind, 0)) {
if (!pay_for_spell(plyr_idx, power_kind, splevel)) {
return Lb_FAIL;
}
}
Expand Down

0 comments on commit 8965ad3

Please sign in to comment.