Skip to content

Commit

Permalink
feat: orbs of energy (bringing back the crystal ball)
Browse files Browse the repository at this point in the history
This commit adds a new "energy" orb ego that offers passive channeling,
like Wucad Mu. The implementation is set to stack with Wucad Mu and any
other potential source of energy (currently none) in the following ways:

- The trigger chance is multiplied by the number of sources.
- The all sources must backfire for the backfire effect to trigger.

Wucad Mu's channeling was interesting, but compared to an enhancer staff
or other unrands the effect underwhelemed many players. In addition to
offering channeling with a shield, this commit buffs Wucad Mu by making
it count as two sources of channeling for internal calculations.

XXX: Unsure of the best way to communicate this to the player without
turning our inscriptions into a line of dubious code, inscribing it
*channel++ just doesn't sit right.
  • Loading branch information
ebering committed Dec 27, 2021
1 parent 92c0926 commit 17eb628
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 21 deletions.
5 changes: 5 additions & 0 deletions crawl-ref/source/describe.cc
Expand Up @@ -1805,6 +1805,11 @@ static const char* _item_ego_desc(special_armour_type ego)
return "it causes witnesses of the wearer's kills to go into a frenzy.";
case SPARM_GUILE:
return "it weakens the willpower of the wielder and everyone they hex.";
case SPARM_ENERGY:
return "it occasionally powers its wielder's spells, but with a chance"
" of causing confusion or draining the wielder's intelligence."
" It becomes more likely to activate and less likely to backfire"
" with Evocations skill.";
default:
return "it makes the wearer crave the taste of eggplant.";
}
Expand Down
2 changes: 2 additions & 0 deletions crawl-ref/source/item-name.cc
Expand Up @@ -571,6 +571,7 @@ const char* armour_ego_name(const item_def& item, bool terse)
case SPARM_RAGE: return "wrath";
case SPARM_MAYHEM: return "mayhem";
case SPARM_GUILE: return "guile";
case SPARM_ENERGY: return "energy";
default: return "bugginess";
}
}
Expand Down Expand Up @@ -617,6 +618,7 @@ const char* armour_ego_name(const item_def& item, bool terse)
case SPARM_RAGE: return "*Rage";
case SPARM_MAYHEM: return "mayhem";
case SPARM_GUILE: return "guile";
case SPARM_ENERGY: return "*channel";
default: return "buggy";
}
}
Expand Down
1 change: 1 addition & 0 deletions crawl-ref/source/item-prop-enum.h
Expand Up @@ -489,6 +489,7 @@ enum special_armour_type
SPARM_RAGE,
SPARM_MAYHEM,
SPARM_GUILE,
SPARM_ENERGY,
NUM_REAL_SPECIAL_ARMOURS,
NUM_SPECIAL_ARMOURS,
};
Expand Down
2 changes: 1 addition & 1 deletion crawl-ref/source/item-prop.cc
Expand Up @@ -1846,7 +1846,7 @@ bool item_skills(const item_def &item, set<skill_type> &skills)
if (is_shield(item))
skills.insert(SK_SHIELDS);

if (gives_ability(item))
if (gives_ability(item) || get_armour_ego_type(item) == SPARM_ENERGY)
skills.insert(SK_EVOCATIONS);
}

Expand Down
4 changes: 3 additions & 1 deletion crawl-ref/source/makeitem.cc
Expand Up @@ -781,7 +781,8 @@ static special_armour_type _generate_armour_type_ego(armour_type type)
1, SPARM_LIGHT,
1, SPARM_RAGE,
1, SPARM_MAYHEM,
1, SPARM_GUILE);
1, SPARM_GUILE,
1, SPARM_ENERGY);

case ARM_SCARF:
return random_choose_weighted(1, SPARM_RESISTANCE,
Expand Down Expand Up @@ -988,6 +989,7 @@ bool is_armour_brand_ok(int type, int brand, bool strict)
case SPARM_RAGE:
case SPARM_MAYHEM:
case SPARM_GUILE:
case SPARM_ENERGY:
return type == ARM_ORB;

case NUM_SPECIAL_ARMOURS:
Expand Down
1 change: 1 addition & 0 deletions crawl-ref/source/mapdef.cc
Expand Up @@ -4950,6 +4950,7 @@ int str_to_ego(object_class_type item_type, string ego_str)
"wrath",
"mayhem",
"guile",
"energy",
nullptr
};
COMPILE_CHECK(ARRAYSZ(armour_egos) == NUM_REAL_SPECIAL_ARMOURS);
Expand Down
3 changes: 2 additions & 1 deletion crawl-ref/source/rltiles/dc-item.txt
Expand Up @@ -541,7 +541,8 @@ i-infusion BRAND_ARM_INFUSION
i-light BRAND_ARM_LIGHT
i-rage BRAND_ARM_RAGE
i-mayhem BRAND_ARM_MAYHEM
i-guile BRAND_ARM_GUILE BRAND_ARM_LAST
i-guile BRAND_ARM_GUILE
i-energy BRAND_ARM_ENERGY BRAND_ARM_LAST
%rim 1

###########OBJ_WANDS
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions crawl-ref/source/shopping.cc
Expand Up @@ -356,6 +356,7 @@ unsigned int item_value(item_def item, bool ident)
case SPARM_RAMPAGING:
case SPARM_INFUSION:
case SPARM_LIGHT:
case SPARM_ENERGY:
valued += 50;
break;

Expand Down
41 changes: 23 additions & 18 deletions crawl-ref/source/spl-cast.cc
Expand Up @@ -670,34 +670,39 @@ void do_cast_spell_cmd(bool force)
flush_input_buffer(FLUSH_ON_FAILURE);
}

static void _handle_wucad_mu(int cost)
static void _handle_channeling(int cost)
{
if (!player_equip_unrand(UNRAND_WUCAD_MU))
return;

if (you.has_mutation(MUT_HP_CASTING))
return;

if (!x_chance_in_y(you.skill(SK_EVOCATIONS), 54))
const int sources = 2 * player_equip_unrand(UNRAND_WUCAD_MU)
+ you.wearing_ego(EQ_ALL_ARMOUR, SPARM_ENERGY);

if (!x_chance_in_y(sources * you.skill(SK_EVOCATIONS), 54))
return;

did_god_conduct(DID_WIZARDLY_ITEM, 10);

// The chance of backfiring goes down with evo skill and up with cost
if (one_chance_in(max(you.skill(SK_EVOCATIONS) - cost, 1)))
{
mpr(random_choose("Weird images run through your mind.",
"Your head hurts.",
"You feel a strange surge of energy.",
"You feel uncomfortable."));
if (coinflip())
confuse_player(2 + random2(4));
else
lose_stat(STAT_INT, 1 + random2avg(5, 2));
// and is greatly reduced by more sources of channeling
for (int i = 0; i < sources; ++i)
{
if (!one_chance_in(max(you.skill(SK_EVOCATIONS) - cost, 1)))
{
mpr("Magical energy flows into your mind!");
inc_mp(cost, true);
return;
}
}

mpr("Magical energy flows into your mind!");
inc_mp(cost, true);
mpr(random_choose("Weird images run through your mind.",
"Your head hurts.",
"You feel a strange surge of energy.",
"You feel uncomfortable."));
if (coinflip())
confuse_player(2 + random2(4));
else
lose_stat(STAT_INT, 1 + random2avg(5, 2));
}

/**
Expand Down Expand Up @@ -956,7 +961,7 @@ spret cast_a_spell(bool check_range, spell_type spell, dist *_target,
practise_casting(spell, cast_result == spret::success);
if (cast_result == spret::success)
{
_handle_wucad_mu(cost);
_handle_channeling(cost);
if (player_equip_unrand(UNRAND_MAJIN) && one_chance_in(500))
_majin_speak(spell);
did_god_conduct(DID_SPELL_CASTING, 1 + random2(5));
Expand Down

0 comments on commit 17eb628

Please sign in to comment.