Skip to content

Commit

Permalink
Begin data-ifying passive divine abilities [WIP]
Browse files Browse the repository at this point in the history
Add a new layer representing passive divine abilities, rather than
checking directly for specific gods and piety levels.  The idea is to
decouple abilities from specific gods, allowing the same abilities to
be used for randgods.

Ashenzari, Beogh, Cheibriados, and Dithmenos have been converted so far.
  • Loading branch information
neilmoore committed Nov 29, 2015
1 parent de31b62 commit 5f1ddaa
Show file tree
Hide file tree
Showing 44 changed files with 716 additions and 374 deletions.
3 changes: 2 additions & 1 deletion crawl-ref/source/abyss.cc
Expand Up @@ -24,6 +24,7 @@
#include "dgn-overview.h"
#include "dgn-proclayouts.h"
#include "files.h"
#include "godpassive.h" // passive_t::slow_abyss
#include "hiscores.h"
#include "itemprop.h"
#include "items.h"
Expand Down Expand Up @@ -1592,7 +1593,7 @@ void generate_abyss()
static void _increase_depth()
{
int delta = you.time_taken * (you.abyss_speed + 40) / 200;
if (!you_worship(GOD_CHEIBRIADOS) || you.penance[GOD_CHEIBRIADOS])
if (!have_passive(passive_t::slow_abyss))
delta *= 2;
if (you.duration[DUR_TELEPORT])
delta *= 5;
Expand Down
3 changes: 2 additions & 1 deletion crawl-ref/source/acquire.cc
Expand Up @@ -21,6 +21,7 @@
#include "dungeon.h"
#include "food.h"
#include "goditem.h"
#include "godpassive.h"
#include "itemname.h"
#include "itemprop.h"
#include "items.h"
Expand Down Expand Up @@ -1423,7 +1424,7 @@ int acquirement_create_item(object_class_type class_wanted,
acq_item.quantity = quant;

// Remove curse flag from item, unless worshipping Ashenzari.
if (you_worship(GOD_ASHENZARI))
if (have_passive(passive_t::want_curses))
do_curse_item(acq_item, true);
else
do_uncurse_item(acq_item, false);
Expand Down
7 changes: 4 additions & 3 deletions crawl-ref/source/areas.cc
Expand Up @@ -16,6 +16,7 @@
#include "env.h"
#include "fprop.h"
#include "godconduct.h"
#include "godpassive.h" // passive_t::umbra
#include "libutil.h"
#include "losglobal.h"
#include "message.h"
Expand Down Expand Up @@ -710,11 +711,11 @@ int player::umbra_radius() const
{
int size = -1;

if (religion == GOD_DITHMENOS && piety >= piety_breakpoint(0)
&& !penance[GOD_DITHMENOS])
if (have_passive(passive_t::umbra))
{
// The cap is reached at piety 160 = ******.
size = min((int)piety, piety_breakpoint(5)) * LOS_RADIUS / piety_breakpoint(5);
size = min((int)piety, piety_breakpoint(5)) * LOS_RADIUS
/ piety_breakpoint(5);
}

if (player_equip_unrand(UNRAND_SHADOWS))
Expand Down
3 changes: 2 additions & 1 deletion crawl-ref/source/art-func.h
Expand Up @@ -28,6 +28,7 @@
#include "food.h" // For evokes
#include "ghost.h" // For is_dragonkind ghost_demon datas
#include "godconduct.h" // did_god_conduct
#include "godpassive.h" // passive_t::want_curses
#include "mgen_data.h" // For Sceptre of Asmodeus evoke
#include "mon-death.h" // For demon axe's SAME_ATTITUDE
#include "mon-place.h" // For Sceptre of Asmodeus evoke
Expand Down Expand Up @@ -171,7 +172,7 @@ static void _CURSES_equip(item_def *item, bool *show_msgs, bool unmeld)
static void _CURSES_world_reacts(item_def *item)
{
// don't spam messages for ash worshippers
if (one_chance_in(30) && !you_worship(GOD_ASHENZARI))
if (one_chance_in(30) && !have_passive(passive_t::want_curses))
curse_an_item(true);
}

Expand Down
3 changes: 2 additions & 1 deletion crawl-ref/source/attack.cc
Expand Up @@ -22,6 +22,7 @@
#include "fight.h"
#include "fineff.h"
#include "godconduct.h"
#include "godpassive.h" // passive_t::no_haste
#include "itemname.h"
#include "itemprop.h"
#include "message.h"
Expand Down Expand Up @@ -749,7 +750,7 @@ void attack::chaos_affects_defender()
beam.flavour = BEAM_HEALING;
break;
case CHAOS_HASTE:
if (defender->is_player() && you_worship(GOD_CHEIBRIADOS))
if (defender->is_player() && have_passive(passive_t::no_haste))
{
simple_god_message(" protects you from inadvertent hurry.");
obvious_effect = true;
Expand Down
5 changes: 3 additions & 2 deletions crawl-ref/source/attitude-change.cc
Expand Up @@ -16,6 +16,7 @@
#include "env.h"
#include "godabil.h"
#include "godcompanions.h"
#include "godpassive.h" // passive_t::convert_orcs
#include "libutil.h"
#include "message.h"
#include "mon-behv.h"
Expand Down Expand Up @@ -72,7 +73,7 @@ void beogh_follower_convert(monster* mons, bool orc_hit)
return;

// For followers of Beogh, decide whether orcs will join you.
if (you_worship(GOD_BEOGH)
if (will_have_passive(passive_t::convert_orcs)
&& mons->foe == MHITYOU
&& mons_genus(mons->type) == MONS_ORC
&& !mons->is_summoned()
Expand All @@ -86,7 +87,7 @@ void beogh_follower_convert(monster* mons, bool orc_hit)

const int hd = mons->get_experience_level();

if (in_good_standing(GOD_BEOGH, 2)
if (have_passive(passive_t::convert_orcs)
&& random2(you.piety / 15) + random2(4 + you.experience_level / 3)
> random2(hd) + hd + random2(5))
{
Expand Down
3 changes: 2 additions & 1 deletion crawl-ref/source/beam.cc
Expand Up @@ -32,6 +32,7 @@
#include "fight.h"
#include "godabil.h"
#include "godconduct.h"
#include "godpassive.h" // passive_t::convert_orcs
#include "item_use.h"
#include "itemprop.h"
#include "items.h"
Expand Down Expand Up @@ -4373,7 +4374,7 @@ void bolt::enchantment_affect_monster(monster* mon)

set_attack_conducts(conducts, mon, you.can_see(*mon));

if (in_good_standing(GOD_BEOGH, 2)
if (have_passive(passive_t::convert_orcs)
&& mons_genus(mon->type) == MONS_ORC
&& mon->asleep() && mons_near(mon))
{
Expand Down
11 changes: 6 additions & 5 deletions crawl-ref/source/decks.cc
Expand Up @@ -25,6 +25,7 @@
#include "evoke.h"
#include "food.h"
#include "ghost.h"
#include "godpassive.h" // passive_t::no_haste
#include "godwrath.h"
#include "invent.h"
#include "itemprop.h"
Expand Down Expand Up @@ -1418,7 +1419,7 @@ static void _velocity_card(int power, deck_rarity_type rarity)

if (you.duration[DUR_SLOW] && (power_level > 0 || coinflip()))
{
if (you_worship(GOD_CHEIBRIADOS))
if (have_passive(passive_t::no_haste))
simple_god_message(" protects you from inadvertent hurry.");
else
{
Expand Down Expand Up @@ -1476,7 +1477,7 @@ static void _velocity_card(int power, deck_rarity_type rarity)
}
else if (!(for_hostiles == ENCH_HASTE && haste_immune))
{
if (you_worship(GOD_CHEIBRIADOS))
if (have_passive(passive_t::no_haste))
_suppressed_card_message(you.religion, DID_HASTY);
else
{
Expand All @@ -1501,7 +1502,7 @@ static void _velocity_card(int power, deck_rarity_type rarity)
}
else if (!(for_allies == ENCH_HASTE && haste_immune))
{
if (you_worship(GOD_CHEIBRIADOS))
if (have_passive(passive_t::no_haste))
_suppressed_card_message(you.religion, DID_HASTY);
else
{
Expand Down Expand Up @@ -2010,8 +2011,8 @@ static void _potion_card(int power, deck_rarity_type rarity)
if (power_level >= 2 && coinflip())
pot = (coinflip() ? POT_HEAL_WOUNDS : POT_MAGIC);

if (you_worship(GOD_CHEIBRIADOS) && (pot == POT_HASTE
|| pot == POT_BERSERK_RAGE))
if (have_passive(passive_t::no_haste)
&& (pot == POT_HASTE || pot == POT_BERSERK_RAGE))
{
simple_god_message(" protects you from inadvertent hurry.");
return;
Expand Down
3 changes: 2 additions & 1 deletion crawl-ref/source/fight.cc
Expand Up @@ -20,6 +20,7 @@
#include "fineff.h"
#include "fprop.h"
#include "godabil.h"
#include "godpassive.h" // passive_t::shadow_attacks
#include "hints.h"
#include "invent.h"
#include "itemprop.h"
Expand Down Expand Up @@ -174,7 +175,7 @@ bool fight_melee(actor *attacker, actor *defender, bool *did_hit, bool simu)
if (!simu && you.props.exists("spectral_weapon"))
trigger_spectral_weapon(&you, defender);

if (!simu && you_worship(GOD_DITHMENOS))
if (!simu && will_have_passive(passive_t::shadow_attacks))
dithmenos_shadow_melee(defender);

return true;
Expand Down

0 comments on commit 5f1ddaa

Please sign in to comment.