[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Wesnoth-cvs-commits] wesnoth/src ai_attack.cpp
From: |
David White |
Subject: |
[Wesnoth-cvs-commits] wesnoth/src ai_attack.cpp |
Date: |
Sun, 28 Aug 2005 15:55:20 -0400 |
CVSROOT: /cvsroot/wesnoth
Module name: wesnoth
Branch:
Changes by: David White <address@hidden> 05/08/28 19:55:20
Modified files:
src : ai_attack.cpp
Log message:
made the AI recognize that units with AMLA won't heal when they advance
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/ai_attack.cpp.diff?tr1=1.64&tr2=1.65&r1=text&r2=text
Patches:
Index: wesnoth/src/ai_attack.cpp
diff -u wesnoth/src/ai_attack.cpp:1.64 wesnoth/src/ai_attack.cpp:1.65
--- wesnoth/src/ai_attack.cpp:1.64 Sat Jul 2 21:37:18 2005
+++ wesnoth/src/ai_attack.cpp Sun Aug 28 19:55:20 2005
@@ -1,4 +1,4 @@
-/* $Id: ai_attack.cpp,v 1.64 2005/07/02 21:37:18 ott Exp $ */
+/* $Id: ai_attack.cpp,v 1.65 2005/08/28 19:55:20 Sirp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
@@ -454,18 +454,20 @@
const int xp_for_advance = att->second.max_experience()
- att->second.experience();
- //the reward for advancing a unit is to get a
'negative' loss of that unit
- if(xp >= xp_for_advance) {
- avg_losses -= att->second.type().cost();
-
- //ignore any damage done to this unit
- atthp = hitpoints[i];
- } else {
- //the reward for getting a unit closer to
advancement is to get
- //the proportion of remaining experience
needed, and multiply
- //it by a quarter of the unit cost. This will
cause the AI
- //to heavily favor getting xp for
close-to-advance units.
- avg_losses -=
(att->second.type().cost()*xp)/(xp_for_advance*4);
+ //the reward for advancing a unit is to get a
'negative' loss of that unit
+ if(att->second.type().advances_to().empty() == false) {
+ if(xp >= xp_for_advance) {
+ avg_losses -= att->second.type().cost();
+
+ //ignore any damage done to this unit
+ atthp = hitpoints[i];
+ } else {
+ //the reward for getting a unit closer
to advancement is to get
+ //the proportion of remaining
experience needed, and multiply
+ //it by a quarter of the unit cost.
This will cause the AI
+ //to heavily favor getting xp for
close-to-advance units.
+ avg_losses -=
(att->second.type().cost()*xp)/(xp_for_advance*4);
+ }
}
if(defhp <= 0) {
@@ -492,7 +494,8 @@
//penalty for allowing advancement is a 'negative' kill, and
//defender's hitpoints get restored to maximum
- if(defend_it->second.experience() <
defend_it->second.max_experience() &&
+ if(defend_it->second.type().advances_to().empty() == false &&
+ defend_it->second.experience() <
defend_it->second.max_experience() &&
defend_it->second.experience() + defenderxp >=
defend_it->second.max_experience()) {
chance_to_kill -= 1.0;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Wesnoth-cvs-commits] wesnoth/src ai_attack.cpp,
David White <=