From f38686da314acb638e8f655cff6db865c6841056 Mon Sep 17 00:00:00 2001 From: Adam Borowski Date: Wed, 21 Oct 2009 15:39:41 +0200 Subject: Add missing Chronos conducts for hasting yourself, casting swiftness, using weapons of speed and boots of running. --- crawl-ref/source/acr.cc | 6 ++++ crawl-ref/source/enum.h | 1 + crawl-ref/source/fight.cc | 2 ++ crawl-ref/source/it_use2.cc | 1 + crawl-ref/source/misc.cc | 1 + crawl-ref/source/religion.cc | 72 ++++++++++++++++++++++++++++++++++++++++++++ crawl-ref/source/religion.h | 1 + crawl-ref/source/spells1.cc | 1 + 8 files changed, 85 insertions(+) diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index 16124258df..93a6b4f235 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -3928,6 +3928,12 @@ static void _move_player(coord_def move) } apply_berserk_penalty = !attacking; + + if (!attacking && you.religion == GOD_CHRONOS && one_chance_in(10) + && player_equip_ego_type(EQ_BOOTS, SPARM_RUNNING)) + { + did_god_conduct(DID_HASTY, 1, true); + } } diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h index f3a56d87c2..6ff1c74d74 100644 --- a/crawl-ref/source/enum.h +++ b/crawl-ref/source/enum.h @@ -783,6 +783,7 @@ enum conduct_type DID_KILL_SLIME, // Jiyva DID_KILL_PLANT, // Feawn DID_ALLY_KILLED_PLANT, // Feawn + DID_HASTY, // Chronos NUM_CONDUCTS }; diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc index 4976e87c01..e1e8d6b339 100644 --- a/crawl-ref/source/fight.cc +++ b/crawl-ref/source/fight.cc @@ -1879,6 +1879,8 @@ void melee_attack::player_check_weapon_effects() did_god_conduct(DID_HOLY, 1); else if (is_demonic(*weapon)) did_god_conduct(DID_UNHOLY, 1); + else if (get_weapon_brand(*weapon) == SPWPN_SPEED) + did_god_conduct(DID_HASTY, 1); } } diff --git a/crawl-ref/source/it_use2.cc b/crawl-ref/source/it_use2.cc index b4a6fd84aa..6b7042be03 100644 --- a/crawl-ref/source/it_use2.cc +++ b/crawl-ref/source/it_use2.cc @@ -138,6 +138,7 @@ bool potion_effect(potion_type pot_eff, int pow, bool drank_it, bool was_known) case POT_SPEED: haste_player((40 + random2(pow)) / factor); + did_god_conduct(DID_HASTY, 10, was_known); break; case POT_MIGHT: diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc index cd292c8144..987975349b 100644 --- a/crawl-ref/source/misc.cc +++ b/crawl-ref/source/misc.cc @@ -2653,6 +2653,7 @@ bool go_berserk(bool intentional) you.duration[DUR_MIGHT] += you.duration[DUR_BERSERKER]; haste_player( you.duration[DUR_BERSERKER] ); + did_god_conduct(DID_HASTY, 8, intentional); if (you.berserk_penalty != NO_BERSERK_PENALTY) you.berserk_penalty = 0; diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index 0ab4acb1c6..c38d0f9a80 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -3505,6 +3505,22 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known, } break; + case DID_HASTY: + if (you.religion == GOD_CHRONOS) + { + if (!known) + { + simple_god_message(" forgives your accidental hurry, just this once."); + break; + } + simple_god_message(" thinks you should slow down."); + piety_change = -level; + if (level > 5) + penance = level - 5; + retval = true; + } + break; + case DID_NOTHING: case DID_STABBING: // unused case DID_STIMULANTS: // unused @@ -3979,6 +3995,43 @@ bool is_chaotic_item(const item_def& item) return (retval); } +bool is_hasty_item(const item_def& item) +{ + switch (item.base_type) + { + case OBJ_WEAPONS: + { + const int item_brand = get_weapon_brand(item); + if (item_brand == SPWPN_SPEED) + return true; + } + break; + case OBJ_ARMOUR: + { + const int item_brand = get_armour_ego_type(item); + if (item_brand == SPARM_RUNNING) + return true; + } + break; + case OBJ_WANDS: + if (item.sub_type == WAND_HASTING) + return true; + break; + case OBJ_POTIONS: + if (item.sub_type == POT_SPEED || item.sub_type == POT_BERSERK_RAGE) + return true; + break; + case OBJ_JEWELLERY: + // should this include AMU_RESIST_SLOWING? + if (item.sub_type == AMU_RAGE) + return true; + break; + default: + break; + } + return false; +} + bool is_holy_discipline(int discipline) { return (discipline & SPTYP_HOLY); @@ -4017,6 +4070,15 @@ bool is_chaotic_spell(spell_type spell, god_type god) || spell == SPELL_SUMMON_UGLY_THING); } +bool is_hasty_spell(spell_type spell, god_type god) +{ + UNUSED(god); + + return (spell == SPELL_HASTE + || spell == SPELL_SWIFTNESS + || spell == SPELL_BERSERKER_RAGE); +} + // The default suitable() function for is_spellbook_type(). bool is_any_spell(spell_type spell, god_type god) { @@ -4188,6 +4250,11 @@ conduct_type god_hates_item_handling(const item_def &item) } break; + case GOD_CHRONOS: + if (item_type_known(item) && is_hasty_item(item)) + return (DID_HASTY); + break; + default: break; } @@ -4229,6 +4296,11 @@ bool god_hates_spell_type(spell_type spell, god_type god) return (true); break; + case GOD_CHRONOS: + if (is_hasty_spell(spell)) + return (true); + break; + default: break; } diff --git a/crawl-ref/source/religion.h b/crawl-ref/source/religion.h index 9445a4fbe6..3a24511bcf 100644 --- a/crawl-ref/source/religion.h +++ b/crawl-ref/source/religion.h @@ -131,6 +131,7 @@ bool is_evil_discipline(int discipline); bool is_holy_spell(spell_type spell, god_type god = GOD_NO_GOD); bool is_evil_spell(spell_type spell, god_type god = GOD_NO_GOD); bool is_chaotic_spell(spell_type spell, god_type god = GOD_NO_GOD); +bool is_hasty_spell(spell_type spell, god_type god = GOD_NO_GOD); bool is_any_spell(spell_type spell, god_type god = GOD_NO_GOD); bool is_spellbook_type(const item_def& item, bool book_or_rod, bool (*suitable)(spell_type spell, god_type god) = diff --git a/crawl-ref/source/spells1.cc b/crawl-ref/source/spells1.cc index 963cba6d11..739ece6593 100644 --- a/crawl-ref/source/spells1.cc +++ b/crawl-ref/source/spells1.cc @@ -1427,6 +1427,7 @@ void cast_swiftness(int power) // you're levitating, for instance. _increase_duration(DUR_SWIFTNESS, 20 + random2(power), 100, "You feel quick."); + did_god_conduct(DID_HASTY, 8, true); } void cast_fly(int power) -- cgit v1.2.3-54-g00ecf