[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Wesnoth-cvs-commits] wesnoth/src actions.cpp
From: |
David White |
Subject: |
[Wesnoth-cvs-commits] wesnoth/src actions.cpp |
Date: |
Sun, 12 Jun 2005 17:39:50 -0400 |
CVSROOT: /cvsroot/wesnoth
Module name: wesnoth
Branch:
Changes by: David White <address@hidden> 05/06/12 21:39:50
Modified files:
src : actions.cpp
Log message:
made 'steadfast' ability double resistance instead of halving damage
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/actions.cpp.diff?tr1=1.229&tr2=1.230&r1=text&r2=text
Patches:
Index: wesnoth/src/actions.cpp
diff -u wesnoth/src/actions.cpp:1.229 wesnoth/src/actions.cpp:1.230
--- wesnoth/src/actions.cpp:1.229 Sun Jun 5 17:29:59 2005
+++ wesnoth/src/actions.cpp Sun Jun 12 21:39:49 2005
@@ -1,4 +1,4 @@
-/* $Id: actions.cpp,v 1.229 2005/06/05 17:29:59 isaaccp Exp $ */
+/* $Id: actions.cpp,v 1.230 2005/06/12 21:39:49 Sirp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
@@ -533,7 +533,16 @@
int divisor = 100;
const int base_damage = attack.damage();
- const int resistance_modifier = d->second.damage_against(attack);
+ int resistance_modifier = d->second.damage_against(attack);
+
+ //steadfast doubles resistance, but is capped at increasing resistance
to 50%
+ if (steadfast && resistance_modifier < 100 && resistance_modifier > 50)
{
+ const int diff = 100 - resistance_modifier;
+ resistance_modifier -= diff;
+ if(resistance_modifier < 50) {
+ resistance_modifier = 50;
+ }
+ }
if (strings) {
std::stringstream str_base;
@@ -581,22 +590,19 @@
}
}
- if (steadfast) {
- divisor *= 2;
- if (strings) {
- std::stringstream str;
- str << _("steadfast") << EMPTY_COLUMN << _("Halved");
- strings->attack_calculations.push_back(str.str());
- }
- }
-
if (strings && resistance_modifier != 100) {
const int resist = resistance_modifier - 100;
std::stringstream str_resist;
str_resist << gettext(resist < 0 ? N_("defender resistance vs")
: N_("defender vulnerability vs"))
- << ' ' << gettext(attack.type().c_str()) <<
EMPTY_COLUMN
+ << ' ' << gettext(attack.type().c_str());
+ if(steadfast && resistance_modifier < 100) {
+ str_resist << ' ' << _(" (+steadfast)");
+ }
+
+ str_resist << EMPTY_COLUMN
<< (resist > 0 ? "+" : "") << resist << '%';
- strings->attack_calculations.push_back(str_resist.str());
+ strings->attack_calculations.push_back(str_resist.str());
+
}
bonus *= resistance_modifier;