[Hide Content]From 29023a051c3d4b4e8ac6dae06722a193a4f8d2c2 Mon Sep 17 00:00:00 2001
From: Keanan Smith <keanan.smith@gmail.com>
Date: Tue, 28 Jan 2014 16:00:07 -0700
Subject: [PATCH] Adding Over 100 percent fails to spell descriptions
---
crawl-ref/source/describe.cc | 5 +++--
crawl-ref/source/spl-cast.cc | 4 ++--
crawl-ref/source/spl-cast.h | 2 +-
3 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc
index 4b06785..f948246 100644
--- a/crawl-ref/source/describe.cc
+++ b/crawl-ref/source/describe.cc
@@ -2763,12 +2763,13 @@ static void _append_spell_stats(const spell_type spell,
else
{
const string schools = spell_schools_string(spell);
- char* failure = failure_rate_to_string(spell_fail(spell));
+ char* failure = failure_rate_to_string(spell_fail(spell,false));
snprintf(info, INFO_SIZE,
- "\nLevel: %d School%s: %s Fail: %s",
+ "\nLevel: %d School%s: %s %s Fail: %s",
spell_difficulty(spell),
schools.find("/") != string::npos ? "s" : "",
schools.c_str(),
+ ((spell_fail(spell,false)>=100)?"Guaranteed":""),
failure);
free(failure);
}
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index efb0df4..6bb7834 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -312,7 +312,7 @@ static int _apply_spellcasting_success_boosts(spell_type spell, int chance)
return chance * fail_reduce / 100;
}
-int spell_fail(spell_type spell)
+int spell_fail(spell_type spell,bool capped)
{
int chance = 60;
@@ -398,7 +398,7 @@ int spell_fail(spell_type spell)
// Apply the effects of Vehumet and items of wizardry.
chance2 = _apply_spellcasting_success_boosts(spell, chance2);
- if (chance2 > 100)
+ if (capped && chance2 > 100)
chance2 = 100;
return chance2;
diff --git a/crawl-ref/source/spl-cast.h b/crawl-ref/source/spl-cast.h
index 0eb7dc5..a34ea23 100644
--- a/crawl-ref/source/spl-cast.h
+++ b/crawl-ref/source/spl-cast.h
@@ -57,7 +57,7 @@ int list_spells(bool toggle_with_I = true, bool viewing = false,
bool allow_preselect = true,
const string &title = "Your Spells",
spell_selector selector = NULL);
-int spell_fail(spell_type spell);
+int spell_fail(spell_type spell,bool capped = true);
int calc_spell_power(spell_type spell, bool apply_intel,
bool fail_rate_chk = false, bool cap_power = true,
bool rod = false);
--
1.8.1.2