Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can summon high xp imps by changing power power stat #3339

Merged
merged 4 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/fxdata/magic.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -1428,7 +1428,7 @@ PanelTabIndex = 2
SoundSamples = 831
SoundPlayed = 0
Power = 0 0 0 0 0 0 0 0 0
Cost = 300 300 300 300 300 300 300 300 300
Cost = 150 150 150 150 150 150 150 150 150
Castability = OWNED_GROUND
Artifact = SPELLBOOK_IMP
Properties =
Expand Down
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
19 changes: 10 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 @@ -1281,14 +1277,15 @@ static TbResult magic_use_power_imp(PowerKind power_kind, PlayerNumber plyr_idx,
struct Thing *heartng;
struct Coord3d pos;
struct PowerConfigStats *powerst = get_power_model_stats(power_kind);
struct MagicStats *pwrdynst = get_power_dynamic_stats(power_kind);
if (!i_can_allocate_free_control_structure()
|| !i_can_allocate_free_thing_structure(FTAF_FreeEffectIfNoSlots)) {
return Lb_FAIL;
}
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 All @@ -1302,6 +1299,10 @@ static TbResult magic_use_power_imp(PowerKind power_kind, PlayerNumber plyr_idx,
ERRORLOG("There was place to create new creature, but creation failed");
return Lb_OK;
}
if (pwrdynst->strength[splevel] != 0)
{
creature_change_multiple_levels(thing, pwrdynst->strength[splevel]);
}
thing->veloc_push_add.x.val += CREATURE_RANDOM(thing, 161) - 80;
thing->veloc_push_add.y.val += CREATURE_RANDOM(thing, 161) - 80;
thing->veloc_push_add.z.val += 160;
Expand Down
Loading