This commit is contained in:
uid66289 2003-12-23 20:48:23 +00:00
parent a55be98487
commit 32f66ee7ca
48 changed files with 638 additions and 326 deletions

View file

@ -1,4 +1,4 @@
Version CVS:
Version 0.6:
* radical storyline changes, this breaks saves from older versions
* fog of war
* support for multiple campaigns
@ -45,14 +45,24 @@ Version CVS:
* Goblin Pillager
* Death Knight
* Elvish Scout
* Pikeman
* Dwarvish Steelclad
* undead are now immune to poinson and plague
* reduced movement for Elvish Lord
* reduced cost of Mage
* changed Mage attack to fire based
* changed Shaman slowing attack to 3-2 from 4-1, and reduced cost from 21 to 18
* changed 'Red Mage' to neutral alignment
* removed 'Elvish Outrider' as evolution from 'Horseman'
* removed 'Elvish Outrider' as evolution from Horseman
* Scout has been renamed to Cavalry
* Cavalry stats adjusted, increased cost by one, reduced movement by one,
reduced experience needed to advance
* fixed max experience for Orcish Warlord.
* 'Blood Bat' unit description clarified
* Halberdier changed to 3rd level unit
* Spearman now advances to Pikeman
* Fire resistance added to 'Red Mage' branch units
* Holy resistance added to Holy units.
* auto-naming (currently elves and humans only) of units and renaming of units
* units now have races defined in cfg-files
* more and improved unit graphics and animations
@ -77,6 +87,9 @@ Version CVS:
* added coding support for displaying different terrain images (particularly useful for villages) at different times of the day
* fixed minor bugs in unit configuration files for Elvish Sharpshooter and Fencer
* footsteps disappear as you walk over them
* added engine support for weapons that can reach multiple hexes
* added some utility macros to WML
* added a rotate function, you can quickly rotate a SDL_Surface by any angle
* text is drawn on screen progressively instead of all at once during introductory sequence
* fixed problems with map updating on map scene
* fixed bug with 'slow' attacks sometimes causing saved games to be corrupt

34
configure vendored
View file

@ -1,7 +1,7 @@
#! /bin/sh
# From configure.ac Version: 0.4.
# From configure.ac Version: 0.5.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.58 for wesnoth 0.4.
# Generated by GNU Autoconf 2.58 for wesnoth 0.5.
#
# Report bugs to <davidnwhite@optusnet.com.au>.
#
@ -270,8 +270,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='wesnoth'
PACKAGE_TARNAME='Battle for Wesnoth'
PACKAGE_VERSION='0.4'
PACKAGE_STRING='wesnoth 0.4'
PACKAGE_VERSION='0.5'
PACKAGE_STRING='wesnoth 0.5'
PACKAGE_BUGREPORT='davidnwhite@optusnet.com.au'
ac_unique_file="src/actions.cpp"
@ -789,7 +789,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures wesnoth 0.4 to adapt to many kinds of systems.
\`configure' configures wesnoth 0.5 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -851,7 +851,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of wesnoth 0.4:";;
short | recursive ) echo "Configuration of wesnoth 0.5:";;
esac
cat <<\_ACEOF
@ -983,7 +983,7 @@ fi
test -n "$ac_init_help" && exit 0
if $ac_init_version; then
cat <<\_ACEOF
wesnoth configure 0.4
wesnoth configure 0.5
generated by GNU Autoconf 2.58
Copyright (C) 2003 Free Software Foundation, Inc.
@ -997,7 +997,7 @@ cat >&5 <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by wesnoth $as_me 0.4, which was
It was created by wesnoth $as_me 0.5, which was
generated by GNU Autoconf 2.58. Invocation command line was
$ $0 $@
@ -1336,11 +1336,15 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
PACKAGE=wesnoth
MAJOR_VERSION=0
MINOR_VERSION="6RC1"
# MICRO_VERSION=0
# VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION
VERSION=$MAJOR_VERSION.$MINOR_VERSION
MAJOR_VERSION="0"
MINOR_VERSION="6RC2"
MICRO_VERSION=""
if test "x$MICRO_VERSION" = "x"; then
VERSION=$MAJOR_VERSION.$MINOR_VERSION
else
VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION
fi
am__api_version="1.7"
ac_aux_dir=
@ -6201,7 +6205,7 @@ _ASBOX
} >&5
cat >&5 <<_CSEOF
This file was extended by wesnoth $as_me 0.4, which was
This file was extended by wesnoth $as_me 0.5, which was
generated by GNU Autoconf 2.58. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -6264,7 +6268,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
wesnoth config.status 0.4
wesnoth config.status 0.5
configured by $0, generated by GNU Autoconf 2.58,
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"

View file

@ -6,7 +6,7 @@ AC_INIT(wesnoth, 0.5, davidnwhite@optusnet.com.au, Battle for Wesnoth)
AC_REVISION($Version: 0.5$)
PACKAGE=wesnoth
MAJOR_VERSION="0"
MINOR_VERSION="6RC1"
MINOR_VERSION="6RC2"
MICRO_VERSION=""
if test "x$MICRO_VERSION" = "x"; then

123
data/battleworld.cfg Normal file
View file

@ -0,0 +1,123 @@
#
# Large involved multiplayer
#
[multiplayer]
name="Battle World"
map=battleworld
turns=90
id=multiplayer_battleworld
{DAWN}
{MORNING}
{AFTERNOON}
{DUSK}
{FIRST_WATCH}
{SECOND_WATCH}
[side]
side=1
enemy=2,3,4,5
canrecruit=1
controller=human
[/side]
[side]
side=2
enemy=1,3,4,5
canrecruit=1
controller=human
[/side]
[side]
side=3
enemy=1,2,4,5
canrecruit=1
controller=human
[/side]
[side]
side=4
enemy=1,2,3,5
canrecruit=1
controller=human
[/side]
[side]
side=5
enemy=1,2,3,4
canrecruit=1
controller=human
[/side]
[item]
x=107
y=4
image=terrain/temple.png
[/item]
# [event]
# name=moveto
# [filter]
# x=107
# y=4
# [/filter]
# [command]
# [unit]
# side=0
# x=107
# y=4
# description=Kno'nack
# type=Orcish Warlord
# [/unit]
# [/command]
# [/event]
[item]
x=61
y=49
image=terrain/temple.png
[/item]
# [event]
# name=moveto
# [filter]
# x=61
# y=49
# [/filter]
# [command]
# [unit]
# side=0
# x=61
# y=49
# description=Slivard
# type=Lich
# [/unit]
# [/command]
# [/event]
#define ROAM X Y NAME TYPE
[unit]
x={X}
y={Y}
type=Dwarvish {TYPE}
decription={NAME}
side=0
[/unit]
[event]
name=die
[filter]
description={NAME}
[/filter]
[command]
[unit]
x={X}
y={Y}
type=Dwarvish {TYPE}
decription={NAME}
side=0
[/unit]
[/command]
[/event]
#enddef
#{ROAM 60 60 Dwarn Fighter}
[/multiplayer]

View file

@ -1,3 +1,5 @@
{utils.cfg}
{schedules.cfg}
{multiplayer.cfg}

62
data/maps/battleworld Normal file
View file

@ -0,0 +1,62 @@
mmmmmmmhfffffffffffffffffffffffffffffffffffffffffffffffffffffffgggggghhmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
mgggmmmmhffffffffffffffffffffffffffffffffffffdfffffffffffffffffgtgggghmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmrmrrrmmmmmmmm
mgtgmmmmhffffffffffffffffffffffffffffdddfdfdddddddddfffffffgfgggghhhhmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmrrmrmmrrrmmmmmm
mmgmmmmhhfffffffffffffffffffffffffffggdddddcccccddddddfgggggggghhmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmrmmmmmrrrmmmmmm
mmmhhhhffffffffffffffffgggggfgfffgfgggdccccsssssccdcdgggggghhhhmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmrmrmmmmmmrmmmmmmm
mmhffffffffffffffffffggggggggggggggggccssssssssssscscgggtghmmmmmmmmmmmmmmmmmmmmmmmmrmmmmmmmrmmmrrmrmmmmmmmrmmmmmmm
mhhffffffffffffffffgggggtggggggcgccctcsssssssssssssscgggghhmmmmmmmmmmmmmmmmmmmmmmrrmrrmmmrrmrrrmmmmmmmmmmmrrmmmmmm
mhfffffffffffffffffggggggggggggccssscssssssssssssssccggghmmmmmmmmmmmmmmmmmmmmmmmrmmmmrmmmrmmmmmmmmmmmmmmmmmmrmmmmm
hgfffffffffffffffggggggggggcgccsssssssssssssssssssscggghhmmmmmmmmmmmmSmSSSSSmmmrrmmmmrmmmrmmmmmmmmmmmmmmmmmmrmmmmm
gggffffffffffffggggggggggccscssssssssssssssssssssccgghhmmmmmmmmmmmmSSSSSSVSSmmmrmmmmmmrrmmrmmmmmmmmmmrmmmmmrrmmmmm
ggggfffffffffffggggggggggcssssssssssssssssssssssscgggrmmmmmmmmmmmSSVSSSSSSSSSmrmmmmmmmmmrrrmmmmmmmmrrmrmmmmrmmmmmm
ggggggfgfffffffggggtggggdcsssssssssctssssssssssccgggghrrmrrrmmmrrSSSSSSSSSSSSrrmmmmmmmmmmmmmmmmmmmmrmmrrmrrmmmmmcc
gggtggggggfgfgggggggggggddccscsstcc6ccsssssssccgggggghmmrmmmrrmrmSSSSSSSSSSSSmmmmmmmmmmmmmmmmmmmmhhghmmmrmmmmmmccg
gggggggggggggtggggggggggggddcdcccCCCCcssssssscggggtgghmmmmmmmmrmmSSSVSSSVSSSmmmmmmmmmmmmmmmmmmmmmhgghhmmmmmmmmmccg
gggggggggggggggggggggggggggddddddCCcctsssssscgggggggghmmmmmmmmmmmmSSSSSmSmSmmmmmmmmmmmmmmmmmmmmhhggggghhmhmmmcccgg
gggggggg1CCCgggggggggggtggdcdccccccssssssssscggggggggghmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmhmhhggggggggghghccccggg
ggggggggggCCCggtgggfgggggccscssstsssssssssssccgggggggghhmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmhhhhghggggggtgggggccccggggg
ffgggggggggggggggffffggggcssssssssssssssssssssccgcgggggghhmmmmmmmmmmmmmmmmmmmmmmmmmmmmmhgggggggggggggggggccggggggg
ffffggtggggggggfffffffgggcssssssssssssssssssssscccccgggggghhhhmmmmmmmmmmmmmmmmmmmmmmmmhggggggggggggggggccccggggggg
ffffgfgggggggffffffffffggcssssssssssssssssssssssccccgggtgggggghmmmmmmmmmmmmmmmmmmmmhmhhgggggtggggggggccccggggggvgg
ffffffffgfgffffffffffffgggccssscssssssssssssssssccc//cgggggggghhmmmmmmmmmmmmmmmmmhhghgggggggggggggggcccggggggggggg
fffffffffffffffffffffffgggcgcccgccssscccccscssscc//cccgggggggggghmmmmmmmmmmmmmmmhggggggggCC2gggggtggccgggggggggggg
fffffffffffffffffffffffggggggggggcsccgggggccccc//ccccccggggggggghmmmmmmmmmmmmmmhhgggggggggCCgggggggcccgggggggggggg
fffffffffffffffffffffffgggggggggggcgggggggggc//ccsssssccggggggtghhmmmmmmmmmmmmmhggggtggggggCggggggcccggggggggggggg
ffffffffffffffffffffffggggggggggggggggvggggggccsssssssscgggggggggghhhhmmmmmmmmhhgggggggggggggggggcccggggggvggggggg
ffffffffffffffffffffffggggggggvggggggggggggggccsssssssscggggggggggggghmmmmmmmhhhhgggggggggggggggcccggggggggggggggg
fffffffffffffffffffffgggggggggggggggggggggvggccsssssssscggtgggggggggghmmmmmmmhhhhhggggggggggggggc/gggggggggggggggg
fffffffffffffffffffffgggggggggggggggggggggggccssssssssscgggggggggggggghhmhhhmhmmhhggggtgggggtggg/cgggggggggggggggg
fffffffffffffffffffffggggggggggggggggggggcgccsssssssssscgggggggggggggggghhhhhmmhhhhhgggggggggggcccgggggggggggggggg
fffffffffffffffffffffggggvgggggggggggggccscssssssssssscggggggggggggggggggghhhhmhmmhhhggggggggccccggggggggggggggggg
ffffffffffffffffffffffgggggggggggvggggcssssssssssssssscggggggggggggggggggggghhhhmmmmhhhhgggggccggggggggggvgggggggg
ffffffffffffffffffffffffgfgfgggggggggccsssssssssssscsscggtggggggggtggggggggggghhhmmmmmhhgggggccgvggggggggggggggggg
ffffffffffffffffffffffffffffffgggggggcsssssssssssccgcccgggggggggggggggtggggggtghhmmmmmhhgggggcccgcggggggggggggggvg
fffffffffffgggffffffffffffffffffgggggcsssssssssscggggccgggggggggggggggggggggggghhhmmmhhgggggggccccccgggggggggggggg
fffffffffgggggggffffffffffffffffgggggcsssssssssccggvgcccggggggtggggggggggggggggghhhhhhhgggggggggcgccccgggggggggggg
fffffffffggggggggffffffffffffffffgggggccsssssccgggggggccccgggggggggggggggggggggggghghgggggggggggggggcccggvgggggggg
ffffffffggggvggggffffffffffffffffggggvggcccccgggggggggggcccggggggggggggggggggggggggtgggggggtgggggggggcccgggggggggg
ffffffffggggggggfffffffffffffffffggggggggggggggggggggggggccggggggggggggggggggc|cggggggggggggggggggggggccgggggggggg
ffffffffffgggggfffffffffffffffffgggggggggggggggggggggggggccgggggtgggggggtggccc|cccgcgggggggggggggggtggccgggggggvgg
ffffffffffffffffffffffffffffffffgggggggggggggggggggggggggcccgggggggggggggggccgggccccccgggggggggggggggcccgggggggggg
ffffffffffffffffffffffffffffffffggggggg4ggggvggggggggvggggccccgggggcgcccgggccggvggcgcccggtgggggggcgccccggggggggggg
fffffffffffffffffffffffffffffffgggvgggCCCCggggggggggggggggggccccgccccccccccccggggggggccgggggggg\cccccggggggggggggg
fffffffffffffffffffffffffffgggggggggggCgggggggggggggggggggggggcccccgcgggcccggggggggggcccgcgccccc\gcgggggggvggggggg
fffffffffffffffffffffffffffgggggggggggggggggggggggggggggggggggggcgggggggggggggggggggggcccccccgcggggggggggggggggggg
fffffffffffffffffffffffffffgggggvggggggvgggggggggggggggggggggggvgggggggvggggggggggggggggcgcggggggggggggggggggggggg
ffffffffffffffffffffffffffggggggggggggggggggggggggggggggvgggggggggggggggggggggggggggggggggggggvgggggggg3gCgggggggg
fgfffffffffffffffffffffffgggggggggggggggggggggggvgggggggggggggggggggggggggggggggggggvggggggggggggggggggCCCgggggggg
ggggffffffffffffffffffffgggggggggggggggggggggggggggggggggggggggggggggggggggwgwggggggggggggggggggggggggCCgggggggggg
ggggffffffffffffffffffffgggggggggggggggggggwgwgggggggggggggggggggggggwwwwwwwwwwggggggggggggggggggggggggggggggggvgg
ggvgggffffffffffffffffffgggggggggggggggggwwwwwwwwwgggggggggggggvgggggwwwwfwwwwwwgggggggggggggggggggggggggggggggggg
ggggggfffffffffffffffffggggggggggggvgggggwwwwwfwwwwwgggggggggggggggwwwwwwwwwwwwwwggwwwwwgwgggggggggggggggggggggggg
ggggggfffffffffffffffffgggvggggggggggggwwfwwwwwwwfwwggvggggggggggwwwwwwdddddwwfwwwwwwwwwwwwwwwwgvggggggggggggggggg
ggggggggfffffffffffffggggggggggggggggggwwwwwtwwwwwwwgggggggggggwwfwwwddddtrrdwwwwwwwwwwwwfwwwwwwggggggggvggggggggg
ggggggggfffffffffffgggggggggggggggggggwwwwwwwwwwwwwggggggggggggwwwwwddrrrrrrddwwwwfwwwfwwwwwwwwwwwgggggggggggggggg
ggvgggggggfffffffgggggggggggggggggggggwwwwwwwwwwwggggggggggggggwwwwddrrrrCCCrdwwwwwwwwwwwwwwwfwwwwgggggggggggggggg
ggggggggvgggfffgggggggggggggggvgggggggwwwwfwwwfwggggvggggggwwwwwwwwddr7CCCrCrtdwwwwwwwfwwtwwwwwwwwwwgwgggggggggggg
ggggg5CCggggggggggggvggggggggggggggggvgwwwwwwwwwwwgggggggwwwwwwfwwwdtrrrrrrrrddwwwwwwwwwwwwwwwwwfwwwwwwwwwgwwwwwwg
gggggCffCggggggggggggggggggggggggggggggwwwwwwwwwwfwwgwgwgwwwwwwwwwwwddrdrtrddwwwfwwwfwwfwwwwwfwwwwwwfwwwfwwwwfwwww
gggggCfCCggggggggggggggggggggggggwwwwwwwwwwwtwwwwwwwwwwwwwwtwwwwwwwwwwdwdddwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww
gvggggCggggggvgggggggggggvggggggwwwfwwwwwwwwwwwwwwwwwwwwwwwwwwwwwfwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww
gggggggggggggggggggggggggggggggwwwwwwwwwfwwwwwfwwwwwwwfwwwwwwfwwwwwwwwfwwwwwwwfwwwwwfwwwwwwwwwwwwwtwwwwwwwwwwwwwww
gggggggggggggggggggggggggggggggwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww

View file

@ -194,39 +194,7 @@
[/side]
[/multiplayer]
[multiplayer]
name="A Choice Must Be Made"
map=choice
turns=90
id=multiplayer6
{DAWN}
{MORNING}
{AFTERNOON}
{DUSK}
{FIRST_WATCH}
{SECOND_WATCH}
[side]
side=1
enemy=2,3
canrecruit=1
controller=human
[/side]
[side]
side=2
enemy=1,3
canrecruit=1
controller=human
[/side]
[side]
side=3
enemy=1,2
canrecruit=1
controller=human
[/side]
[/multiplayer]
{battleworld.cfg}
[multiplayer_side]
name=Elves
@ -247,7 +215,7 @@
[multiplayer_side]
name=Humans
type=General
recruit=Scout,Mage,Spearman,Fencer,Heavy Infantry,Horseman,Merman
recruit=Cavalry,Mage,Spearman,Fencer,Heavy Infantry,Horseman,Merman
recruitment_pattern=scout,fighter,fighter,fighter
music="wesnoth-2.ogg"
[/multiplayer_side]

View file

@ -142,8 +142,8 @@ When a unit is adjacent to a mage of Light, it will fight as if it were day when
Rogue_description="Rogues are masters of agility, they can move past an enemy, ignoring zones of control. They also possess the backstab ability, which allows them to do double damage if an ally of the rogue is on the opposite side of an enemy they are attacking"
RoyalGuard="Royal Guard"
RoyalGuard_description="Members of the Royal Guard are hand picked among the strongest and sturdiest of the army. The loyalty deploys them whenever only on critical situations and, so far, they have always succeeded in the job at hand."
Scout="Scout"
Scout_description="Using the lightest of armour and the fastest of horses, scouts are employed by most human armies to find out what dangers lie ahead."
Cavalry="Cavalry"
Cavalry_description="Using the lightest of armour and the fastest of horses, scouts are employed by most human armies to find out what dangers lie ahead."
SeaOrc="Sea Orc"
SeaOrc_description="Bugg: Control of the seas! A small step for me, a great leap for all goblinoids! *Glub*"
SeaSerpent="Sea Serpent"

View file

@ -25,27 +25,14 @@ Defeat:
[bigmap]
image=misc/map.png
[dot]
x=81
y=240
[/dot]
[dot]
x=90
y=250
[/dot]
[dot]
x=107
y=256
[/dot]
[dot]
x=115
y=264
[/dot]
[dot]
type=cross
x=115
y=264
[/dot]
{DOT 188 414}
{DOT 181 418}
{DOT 172 413}
{DOT 164 402}
{DOT 155 392}
{DOT 159 382}
{DOT 164 370}
{CROSS 168 359}
[/bigmap]
[side]

View file

@ -27,10 +27,13 @@ Defeat:
[bigmap]
image=misc/map.png
[dot]
x=188
y=251
[/dot]
{DOT 250 341}
{DOT 242 337}
{DOT 234 341}
{DOT 226 345}
{DOT 221 354}
{DOT 219 364}
{CROSS 219 377}
[/bigmap]
[side]
@ -125,9 +128,9 @@ We heard the news that the orcs were attacking the elvish woods and some of them
message="We will help you fight them off."
[/message]
[message]
id=msg1b_5
id=msg1b_5a
description=Seimus
message="I shall send one of my mages to aid you. Recruit more if you need them. I need a few days to summon aid."
message="I shall send one of my mages to aid you. Recruit more mages, and perhaps some horsemen, who have fought very well for us against the crown. I need a few days to summon aid."
[/message]
[/event]
[event]

View file

@ -68,32 +68,32 @@ Defeat:
name=start
[message]
id=msg1_1
id=und1_1
speaker=narrator
message="As the sun set over a land far removed from the war that was happening in Wesnoth, a new war was brewing, between brothers..."
[/message]
[message]
id=msg1_2
id=und1_2
description=Gwiti Ha'atel
message="Ah, hated brother mine. Look well upon the setting sun, for you shall not live to see another."
[/message]
[message]
id=msg1_3
id=und1_3
description=Nati Ha'atel
message="I did not live to see this one either. I gave up my life for necromancy, same as you, do you remember?"
[/message]
[message]
id=msg1_4
id=und1_4
description=Gwiti Ha'atel
message="How well I do. But either way, prepare to die... again."
[/message]
[message]
id=msg1_5
id=und1_5
description=Nati Ha'atel
message="I will fight you with all my strength to prevent that, and I was always the stronger of us. Flee now and save your miserable hide before I make it a carpet."
[/message]
[message]
id=msg1_6
id=und1_6
description=Gwiti Ha'atel
message="Don't be silly! I'm not hairy enough to be a carpet! But your scalp would make a good pillow."
[/message]
@ -106,17 +106,17 @@ Defeat:
description=Gwiti Ha'atel
[/filter]
[message]
id=msg1_7
id=und1_7
speaker=unit
message="What? I can't die! I've done so already! Noooo!"
[/message]
[message]
id=msg1_8
id=und1_8
description=Nati Ha'atel
message="Ha ha ha, did I not tell you it would be so? Perhaps I shall summon your shade to serve me one day... Until then, farewell!"
[/message]
[message]
id=msg1_9
id=und1_9
speaker=unit
message="It is over, I am doomed...."
[/message]
@ -131,17 +131,18 @@ Defeat:
description=Nati Ha'atel
[/filter]
[message]
id=msg1_10
id=und1_10
speaker=unit
message="I... have failed to win this battle, I am defeated. I will not believe it."
[/message]
[message]
id=msg1_11
id=und1_11
description=Gwiti Ha'atel
message="Die, yes die, and go to the Land of the Dead. Perhaps one day you will be back under my command!"
[/message]
[endlevel]
result=victory
bonus=yes
[/endlevel]
[/event]
@ -153,7 +154,7 @@ Defeat:
description=Gwiti Ha'atel
[/filter_second]
[message]
id=msg1_12
id=und1_12
speaker=second_unit
message="Didn't I tell you so?!"
[/message]
@ -165,7 +166,7 @@ Defeat:
description=Nati Ha'atel
[/filter_second]
[message]
id=msg1_13
id=und1_13
speaker=second_unit
message="And by my own hands you died!"
[/message]
@ -179,7 +180,7 @@ Defeat:
description=Gwiti Ha'atel
[/filter]
[message]
id=msg1_14
id=und1_14
description=Gwiti Ha'atel
message="I am Gwiti the Mighty, prepare to die!"
[/message]
@ -191,7 +192,7 @@ Defeat:
description=Nati Ha'atel
[/filter]
[message]
id=msg1_15
id=und1_15
description=Nati Ha'atel
message="Now you shall die!"
[/message]

View file

@ -26,47 +26,16 @@ Defeat:
[bigmap]
image=misc/map.png
[dot]
x=344
y=266
[/dot]
[dot]
x=324
y=264
[/dot]
[dot]
x=302
y=258
[/dot]
[dot]
x=280
y=258
[/dot]
[dot]
x=262
y=257
[/dot]
[dot]
x=240
y=258
[/dot]
[dot]
x=219
y=254
[/dot]
[dot]
x=201
y=255
[/dot]
[dot]
x=193
y=256
[/dot]
[dot]
x=189
y=255
type=cross
[/dot]
{DOT 406 311}
{DOT 387 313}
{DOT 369 318}
{DOT 353 320}
{DOT 340 322}
{DOT 326 322}
{DOT 309 326}
{DOT 291 328}
{DOT 272 338}
{CROSS 259 352}
[/bigmap]
[side]
@ -75,7 +44,7 @@ Defeat:
side=1
canrecruit=1
controller=human
recruit=Elvish Scout,Elvish Fighter,Elvish Archer,Horseman,Elvish Shaman
recruit=Elvish Scout,Elvish Fighter,Elvish Archer,Elvish Shaman
enemy=2,3,4
gold=100
[unit]

View file

@ -47,7 +47,7 @@ Defeat:
description=Li'sar
side=2
canrecruit=1
recruit=Scout,Swordsman,Spearman,Red Mage,Ogre,Duelist
recruit=Cavalry,Swordsman,Spearman,Red Mage,Ogre,Duelist
recruitment_pattern=scout,fighter,fighter,fighter,mixed fighter
gold=200
income=50

View file

@ -72,7 +72,7 @@ Defeat:
description=Robert
side=2
canrecruit=1
recruit=Scout, Swordsman, Mage, Ogre, Duelist
recruit=Cavalry, Swordsman, Mage, Ogre, Duelist
gold=500
enemy=1
[/side]

View file

@ -33,47 +33,11 @@ Defeat:
[bigmap]
image=misc/map.png
[dot]
x=188
y=251
[/dot]
[dot]
x=183
y=240
[/dot]
[dot]
x=172
y=225
[/dot]
[dot]
x=154
y=222
[/dot]
[dot]
x=136
y=223
[/dot]
[dot]
x=117
y=227
[/dot]
[dot]
x=105
y=230
[/dot]
[dot]
x=94
y=232
[/dot]
[dot]
x=80
y=238
[/dot]
[dot]
type=cross
x=77
y=235
[/dot]
{DOT 219 377}
{DOT 217 385}
{DOT 211 390}
{DOT 205 395}
{CROSS 198 401}
[/bigmap]
[side]

View file

@ -25,27 +25,11 @@ Defeat:
[bigmap]
image=misc/map.png
[dot]
x=115
y=264
[/dot]
[dot]
x=117
y=248
[/dot]
[dot]
x=120
y=230
[/dot]
[dot]
x=129
y=228
[/dot]
[dot]
type=cross
x=127
y=226
[/dot]
{DOT 164 348}
{DOT 158 340}
{DOT 142 355}
{DOT 127 340}
{CROSS 122 331}
[/bigmap]
[item]

View file

@ -34,11 +34,16 @@ Defeat:
[bigmap]
image=misc/map.png
[dot]
type=cross
x=202
y=170
[/dot]
{DOT 128 297}
{DOT 144 292}
{DOT 154 284}
{DOT 173 283}
{DOT 189 282}
{DOT 205 282}
{DOT 219 280}
{DOT 231 274}
{DOT 240 270}
{CROSS 250 264}
[/bigmap]
[side]
@ -60,21 +65,21 @@ Defeat:
#ifdef EASY
gold=250
income=5
recruit=Scout,Spearman,Swordsman,Mage,Ogre
recruit=Cavalry,Spearman,Swordsman,Mage,Ogre
recruitment_pattern=scout,mixed fighter,fighter,fighter
#endif
#ifdef NORMAL
gold=500
income=12
recruit=Scout,Swordsman,Spearman,Mage,Ogre
recruit=Cavalry,Swordsman,Spearman,Mage,Ogre
recruitment_pattern=scout,mixed fighter,fighter,fighter
#endif
#ifdef HARD
gold=900
income=20
recruit=Scout,Swordsman,Red Mage,Ogre,Lieutenant,Pikeman
recruit=Cavalry,Swordsman,Red Mage,Ogre,Lieutenant,Pikeman
recruitment_pattern=scout,mixed fighter,fighter,fighter,fighter
#endif

View file

@ -24,11 +24,10 @@ Defeat:
[bigmap]
image=misc/map.png
[dot]
type=cross
x=133
y=185
[/dot]
{DOT 131 332}
{DOT 127 320}
{DOT 123 309}
{CROSS 118 299}
[/bigmap]
[side]

View file

@ -184,6 +184,7 @@ position_taken="Filled"
multiplayer_save_name="multiplayer save"
position_vacant="Available"
observer="Observer"
generic_player="player"
host_game="Host Multiplayer Game"
join_game="Join Game"

View file

@ -4,6 +4,9 @@ race=human
image=arch-mage.png
hitpoints=58
movement_type=smallfoot
[resistance]
fire=80
[/resistance]
movement=5
experience=220
level=3

View file

@ -11,7 +11,7 @@ alignment=chaotic
advanceto=null
cost=24
usage=scout
unit_description="The fur of this undead flying beast is tainted red by the blood of its victims. The Blood Bat is fast, and can drain the blood of those it attacks, thus healing itself."
unit_description="The fur of this undead flying beast is tainted red by the blood of its victims. The Blood Bat is fast, and can drain the blood of those it attacks, thus healing itself. Through its draining, it can even end up stronger than it began the battle!"
get_hit_sound=groan.wav
[attack]
name=fangs

55
data/units/Cavalry.cfg Normal file
View file

@ -0,0 +1,55 @@
[unit]
name=Cavalry
race=human
image=human-scout.png
hitpoints=38
movement_type=mounted
movement=8
experience=34
level=1
alignment=lawful
advanceto=Dragoon
cost=17
usage=scout
unit_description="The best riders in Wesnoth are recruited into the military to become members of the cavalry. This strictly disciplined force is especially suited to capturing and holding villages."
get_hit_sound=groan.wav
[attack]
name=sword
type=blade
range=short
damage=5
number=3
[sound]
time=-200
sound=horse-canter.wav
[/sound]
[/attack]
[/unit]
[unit]
name=Scout
race=human
image=human-scout.png
hitpoints=38
movement_type=mounted
movement=8
experience=34
level=1
alignment=lawful
advanceto=Dragoon
cost=17
usage=scout
unit_description="Using the lightest of armour and the fastest of horses, scouts are employed by most human armies to find out what dangers lie ahead."
get_hit_sound=groan.wav
[attack]
name=sword
type=blade
range=short
damage=5
number=3
[sound]
time=-200
sound=horse-canter.wav
[/sound]
[/attack]
[/unit]

View file

@ -9,7 +9,7 @@ movement=4
experience=38
level=1
alignment=neutral
advanceto=Dwarvish Lord,Dwarvish Berserker
advanceto=Dwarvish Steelclad,Dwarvish Berserker
cost=15
usage=fighter
unit_description="The Dwarvish Fighters are excellent underground and in mountainous terrain. Skilled at close range combat, the sheer power of their battle axe makes them a feared opponent. Their power and endurance makes up for their slow speed."

View file

@ -0,0 +1,33 @@
[unit]
name=Dwarvish Steelclad
race=dwarf
image=dwarf-fighter.png
image_defensive=dwarf-fighter-defend.png
hitpoints=48
movement_type=mountainfoot
[resistance]
blade=80
[/resistance]
[resistance]
pierce=80
[/resistance]
[resistance]
impact=80
[/resistance]
movement=4
experience=58
level=2
alignment=neutral
advanceto=Dwarvish Lord
cost=25
usage=fighter
unit_description="More experienced Dwarven fighters wear heavy chain mail and plate armours, these warriors are named Steelclad."
get_hit_sound=groan.wav
[attack]
name=battle axe
type=blade
range=short
damage=10
number=3
[/attack]
[/unit]

View file

@ -6,6 +6,9 @@ image_defensive=elder-mage-defend.png
profile=misc/delfador.png
hitpoints=55
movement_type=smallfoot
[resistance]
fire=80
[/resistance]
movement=6
experience=500
level=5

View file

@ -2,7 +2,7 @@
name=Elvish Scout
image=elvish-scout.png
race=elf
hitpoints=28
hitpoints=32
movement_type=woodland
#mostly like a foot Elf, but they

View file

@ -4,6 +4,9 @@ race=human
image=great-mage.png
hitpoints=70
movement_type=smallfoot
[resistance]
fire=70
[/resistance]
movement=5
experience=500
level=4

View file

@ -11,7 +11,7 @@ alignment=lawful
advanceto=Knight
cost=23
usage=fighter
unit_description="Trained from childhood to ride, Horsemen are both fast and powerful at attacking. Charging at their enemies, their attacks do double damage, but also cause the horsemen to receive double damage when struck."
unit_description="Trained from childhood to ride, and to follow a strict code of honor, Horsemen are both fast and powerful at attacking. Charging at their enemies, their attacks do double damage, but also cause the horsemen to receive double damage when struck. Rebels against Asheviere's tyranny often use horsemen against her."
get_hit_sound=groan.wav
[attack]
name=spear

View file

@ -6,6 +6,9 @@ ability=illuminates,cures
hitpoints=42
movement_type=smallfoot
movement=5
[resistance]
holy=70
[/resistance]
experience=500
level=3
alignment=lawful

View file

@ -5,6 +5,9 @@ image=paladin.png
hitpoints=75
movement_type=mounted
movement=8
[resistance]
holy=80
[/resistance]
experience=500
level=3
alignment=lawful

View file

@ -4,6 +4,9 @@ race=human
image=red-mage.png
hitpoints=42
movement_type=smallfoot
[resistance]
fire=90
[/resistance]
movement=5
experience=100
level=2

View file

@ -1,27 +0,0 @@
[unit]
name=Scout
race=human
image=human-scout.png
hitpoints=38
movement_type=mounted
movement=9
experience=34
level=1
alignment=lawful
advanceto=Dragoon
cost=17
usage=scout
unit_description="Using the lightest of armour and the fastest of horses, scouts are employed by most human armies to find out what dangers lie ahead."
get_hit_sound=groan.wav
[attack]
name=sword
type=blade
range=short
damage=5
number=3
[sound]
time=-200
sound=horse-canter.wav
[/sound]
[/attack]
[/unit]

View file

@ -9,7 +9,7 @@ movement=5
experience=42
level=1
alignment=lawful
advanceto=Swordsman,Halbardier
advanceto=Swordsman,Pikeman
cost=14
usage=fighter
unit_description="The spearman is the base of the human armies. These young soldiers are given basic training and put in the front lines to face the bulk of the battle."

View file

@ -6,6 +6,9 @@ ability=cures
hitpoints=32
movement_type=smallfoot
movement=5
[resistance]
holy=80
[/resistance]
experience=150
level=2
alignment=lawful

47
data/utils.cfg Normal file
View file

@ -0,0 +1,47 @@
#this file contains utility macros
#macro which will let you go {GOLD x y z} to set
#the gold depending on easy/medium/hard - x/y/z
#define GOLD ON_EASY ON_MEDIUM ON_HARD
#ifdef EASY
gold={ON_EASY}
#endif
#ifdef MEDIUM
gold={ON_MEDIUM}
#endif
#ifdef HARD
gold={ON_HARD}
#endif
#enddef
#define INCOME ON_EASY ON_MEDIUM ON_HARD
#ifdef EASY
income={ON_EASY}
#endif
#ifdef MEDIUM
income={ON_MEDIUM}
#endif
#ifdef HARD
income={ON_HARD}
#endif
#enddef
#define DOT X Y
[dot]
x={X}
y={Y}
[/dot]
#enddef
#define CROSS X Y
[dot]
x={X}
y={Y}
type=cross
[/dot]
#enddef

View file

@ -143,6 +143,10 @@ battle_stats evaluate_battle_stats(
gamemap::TERRAIN attacker_terrain_override,
bool include_strings)
{
//if these are both genuine positions, work out the range
//combat is taking place at
const int combat_range = attacker_terrain_override == 0 ? distance_between(attacker,defender) : 1;
battle_stats res;
res.attack_with = attack_with;
@ -220,7 +224,8 @@ battle_stats evaluate_battle_stats(
int defend;
res.ndefends = 0;
for(defend = 0; defend != int(defender_attacks.size()); ++defend) {
if(defender_attacks[defend].range() == attack.range())
if(defender_attacks[defend].range() == attack.range() &&
defender_attacks[defend].hexes() >= combat_range)
break;
}

View file

@ -102,34 +102,14 @@ namespace {
void internal_preprocess_file(const std::string& fname,
preproc_map& defines_map,
int depth, std::vector<char>& res,
std::vector<line_source>* lines_src, int& line)
std::vector<line_source>* lines_src, int& line);
void internal_preprocess_data(const std::string& data,
preproc_map& defines_map,
int depth, std::vector<char>& res,
std::vector<line_source>* lines_src, int& line,
const std::string& fname, int srcline)
{
//if it's a directory, we process all files in the directory
//that end in .cfg
if(is_directory(fname)) {
std::vector<std::string> files;
get_files_in_dir(fname,&files,NULL,ENTIRE_FILE_PATH);
for(std::vector<std::string>::const_iterator f = files.begin();
f != files.end(); ++f) {
if(f->size() > 4 && std::equal(f->end()-4,f->end(),".cfg")) {
internal_preprocess_file(*f,defines_map,depth,res,
lines_src,line);
}
}
return;
}
int srcline = 1;
if(lines_src != NULL) {
lines_src->push_back(line_source(line,fname,srcline));
}
const std::string data = read_file(fname);
bool in_quotes = false;
for(std::string::const_iterator i = data.begin(); i != data.end(); ++i) {
@ -187,8 +167,7 @@ void internal_preprocess_file(const std::string& fname,
}
}
res.insert(res.end(),str.begin(),str.end());
line += std::count(str.begin(),str.end(),'\n');
internal_preprocess_data(str,defines_map,depth,res,NULL,line,fname,srcline);
} else if(depth < 20) {
internal_preprocess_file("data/" + newfilename,
defines_map, depth+1,res,
@ -313,8 +292,36 @@ void internal_preprocess_file(const std::string& fname,
res.push_back(c);
}
}
}
return;
void internal_preprocess_file(const std::string& fname,
preproc_map& defines_map,
int depth, std::vector<char>& res,
std::vector<line_source>* lines_src, int& line)
{
//if it's a directory, we process all files in the directory
//that end in .cfg
if(is_directory(fname)) {
std::vector<std::string> files;
get_files_in_dir(fname,&files,NULL,ENTIRE_FILE_PATH);
for(std::vector<std::string>::const_iterator f = files.begin();
f != files.end(); ++f) {
if(f->size() > 4 && std::equal(f->end()-4,f->end(),".cfg")) {
internal_preprocess_file(*f,defines_map,depth,res,
lines_src,line);
}
}
return;
}
if(lines_src != NULL) {
lines_src->push_back(line_source(line,fname,1));
}
internal_preprocess_data(read_file(fname),defines_map,depth,res,lines_src,line,fname,1);
}
} //end anonymous namespace

View file

@ -732,8 +732,14 @@ void display::draw_unit_details(int x, int y, const gamemap::location& loc,
<< at_it->damage() << "-" << at_it->num_attacks() << " -- "
<< (at_it->range() == attack_type::SHORT_RANGE ?
string_table["short_range"] :
string_table["long_range"]) << "\n\n";
}
string_table["long_range"]);
if(at_it->hexes() > 1) {
details << " (" << at_it->hexes() << ")";
}
details << "\n\n";
}
description_rect =
font::draw_text(this,clipRect,13,font::NORMAL_COLOUR,

View file

@ -22,7 +22,7 @@ namespace game_config
const int cure_amount = 8;
const int curer_heals_per_turn = 18;
const int recall_cost = 20;
const std::string version = "0.6RC1";
const std::string version = "0.6RC2";
bool debug = false;
#ifdef WESNOTH_PATH

View file

@ -247,23 +247,6 @@ paths::paths(const gamemap& map, const game_data& gamedata,
find_routes(map,gamedata,units,i->second,loc,
i->second.movement_left(),routes,teams,
ignore_zocs,allow_teleport,additional_turns);
if(i->second.can_attack()) {
gamemap::location adjacent[6];
get_adjacent_tiles(loc,adjacent);
for(int j = 0; j != 6; ++j) {
const std::map<gamemap::location,unit>::const_iterator enemy =
units.find(adjacent[j]);
if(enemy != units.end() &&
enemy->second.side() != i->second.side() &&
teams[i->second.side()-1].is_enemy(enemy->second.side())) {
route new_route;
new_route.move_left = -1;
routes.insert(std::pair<gamemap::location,route>(
adjacent[j],new_route));
}
}
}
}
int route_turns_to_complete(const unit& u, const gamemap& map,

View file

@ -383,7 +383,15 @@ void turn_info::left_click(const SDL_MouseButtonEvent& event)
std::vector<unit> units_list;
const int range = distance_between(u->first,enemy->first);
std::vector<int> attacks_in_range;
for(size_t a = 0; a != attacks.size(); ++a) {
if(attacks[a].hexes() < range)
continue;
attacks_in_range.push_back(a);
const battle_stats stats = evaluate_battle_stats(
map_,selected_hex_,hex,
a,units_,status_,gameinfo_);
@ -437,11 +445,13 @@ void turn_info::left_click(const SDL_MouseButtonEvent& event)
gui_.highlight_hex(gamemap::location());
gui_.draw(true,true);
const int res = gui::show_dialog(gui_,NULL,"",
int res = gui::show_dialog(gui_,NULL,"",
string_table["choose_weapon"]+":\n",
gui::OK_CANCEL,&items,&units_list);
if(size_t(res) < attacks.size()) {
if(size_t(res) < attacks_in_range.size()) {
res = attacks_in_range[res];
u->second.set_goto(gamemap::location());
undo_stack_.clear();
redo_stack_.clear();
@ -457,7 +467,7 @@ void turn_info::left_click(const SDL_MouseButtonEvent& event)
enemy = units_.find(hex);
if(u == units_.end() || enemy == units_.end() ||
size_t(res) >= u->second.attacks().size()) {
size_t(res) >= attacks.size()) {
return;
}
@ -510,22 +520,14 @@ void turn_info::left_click(const SDL_MouseButtonEvent& event)
assert(moves <= current_route_.steps.size());
const gamemap::location& dst = current_route_.steps[moves-1];
const unit_map::const_iterator u = units_.find(dst);
assert(u != units_.end());
const int range = u->second.longest_range();
current_route_.steps.clear();
//if there is an enemy in a surrounding hex, then
//highlight attack options
gamemap::location adj[6];
get_adjacent_tiles(dst,adj);
int n;
for(n = 0; n != 6; ++n) {
const unit_map::const_iterator u_it = units_.find(adj[n]);
if(u_it != units_.end() && u_it->second.side() != team_num_
&& current_team.is_enemy(u_it->second.side())){
current_paths_.routes[adj[n]] = paths::route();
}
}
show_attack_options(u);
if(current_paths_.routes.empty() == false) {
current_paths_.routes[dst] = paths::route();
@ -552,6 +554,9 @@ void turn_info::left_click(const SDL_MouseButtonEvent& event)
const bool teleport = it->second.type().teleports();
current_paths_ = paths(map_,gameinfo_,units_,hex,teams_,
ignore_zocs,teleport,path_turns_);
show_attack_options(it);
gui_.set_paths(&current_paths_);
unit u = it->second;
@ -573,6 +578,22 @@ void turn_info::left_click(const SDL_MouseButtonEvent& event)
}
}
void turn_info::show_attack_options(unit_map::const_iterator u)
{
team& current_team = teams_[team_num_-1];
if(u == units_.end() || u->second.can_attack() == false)
return;
const int range = u->second.longest_range();
for(unit_map::const_iterator target = units_.begin(); target != units_.end(); ++target) {
if(current_team.is_enemy(target->second.side()) &&
distance_between(target->first,u->first) <= range) {
current_paths_.routes[target->first] = paths::route();
}
}
}
void turn_info::show_menu()
{
const unit_map::const_iterator un = units_.find(last_hex_);

View file

@ -97,6 +97,8 @@ private:
void left_click(const SDL_MouseButtonEvent& event);
void show_menu();
void show_attack_options(unit_map::const_iterator u);
unit_map::iterator current_unit();
game_data& gameinfo_;

View file

@ -256,6 +256,10 @@ const std::string& login()
if(login != NULL) {
res = login;
}
if(res.empty()) {
res = translate_string("generic_player");
}
}
return res;

View file

@ -534,8 +534,7 @@ bool do_replay(display& disp, const gamemap& map, const game_data& gameinfo,
throw replay::error();
}
std::map<gamemap::location,unit>::const_iterator tgt =
units.find(dst);
std::map<gamemap::location,unit>::const_iterator tgt = units.find(dst);
if(tgt == units.end()) {
std::cerr << "unfound defender for attack\n";

View file

@ -351,7 +351,7 @@ bool unit::matches_filter(const config& cfg) const
if(weapon.empty() == false) {
bool has_weapon = false;
const std::vector<attack_type>& attacks = this->type().attacks();
const std::vector<attack_type>& attacks = this->attacks();
for(std::vector<attack_type>::const_iterator i = attacks.begin();
i != attacks.end(); ++i) {
if(i->name() == weapon) {
@ -456,6 +456,19 @@ void unit::read(game_data& data, const config& cfg)
if(ai_special == "guardian") {
guardian_ = true;
}
role_ = cfg["role"];
statusFlags_.clear();
const config* const status_flags = cfg.child("status");
if(status_flags != NULL) {
for(string_map::const_iterator i = status_flags->values.begin(); i != status_flags->values.end(); ++i) {
statusFlags_.insert(i->first);
}
}
goto_.x = atoi(cfg["goto_x"].c_str()) - 1;
goto_.y = atoi(cfg["goto_y"].c_str()) - 1;
}
void unit::write(config& cfg) const
@ -474,6 +487,15 @@ void unit::write(config& cfg) const
sd << side_;
cfg["side"] = sd.str();
cfg["role"] = role_;
config status_flags;
for(std::set<std::string>::const_iterator st = statusFlags_.begin(); st != statusFlags_.end(); ++st) {
status_flags[*st] = "on";
}
cfg.children["status"].push_back(new config(status_flags));
cfg["user_description"] = description_;
cfg["description"] = underlying_description_;
@ -491,6 +513,16 @@ void unit::write(config& cfg) const
case UPKEEP_LOYAL: cfg["upkeep"] = "loyal"; break;
case UPKEEP_FREE: cfg["upkeep"] = "free"; break;
}
if(guardian_) {
cfg["ai_special"] = "guardian";
}
char buf[50];
sprintf(buf,"%d",goto_.x+1);
cfg["goto_x"] = buf;
sprintf(buf,"%d",goto_.y+1);
cfg["goto_y"] = buf;
}
void unit::assign_role(const std::string& role)
@ -503,6 +535,28 @@ const std::vector<attack_type>& unit::attacks() const
return attacks_;
}
int unit::longest_range() const
{
int res = 0;
for(std::vector<attack_type>::const_iterator i = attacks_.begin(); i != attacks_.end(); ++i) {
if(i->hexes() >= res)
res = i->hexes();
}
return res;
}
std::vector<attack_type> unit::attacks_at_range(int range) const
{
std::vector<attack_type> res;
for(std::vector<attack_type>::const_iterator i = attacks_.begin(); i != attacks_.end(); ++i) {
if(i->hexes() >= range)
res.push_back(*i);
}
return res;
}
int unit::movement_cost(const gamemap& map, gamemap::TERRAIN terrain) const
{
//don't allow level 0 units to take villages - removed until AI

View file

@ -78,6 +78,8 @@ public:
void assign_role(const std::string& role);
const std::vector<attack_type>& attacks() const;
int longest_range() const;
std::vector<attack_type> attacks_at_range(int range) const;
int movement_cost(const gamemap& map, gamemap::TERRAIN terrain) const;
int defense_modifier(const gamemap& map, gamemap::TERRAIN terrain) const;

View file

@ -34,6 +34,7 @@ attack_type::attack_type(const config& cfg)
type_ = cfg["type"];
special_ = cfg["special"];
range_ = cfg["range"] == "long" ? LONG_RANGE : SHORT_RANGE;
hexes_ = maximum<int>(1,atoi(cfg["hexes"].c_str()));
damage_ = atol(cfg["damage"].c_str());
num_attacks_ = atol(cfg["number"].c_str());
@ -97,6 +98,11 @@ attack_type::RANGE attack_type::range() const
return range_;
}
int attack_type::hexes() const
{
return hexes_;
}
int attack_type::damage() const
{
return damage_;
@ -315,8 +321,10 @@ int unit_movement_type::damage_against(const attack_type& attack) const
const config* const resistance = cfg_.child("resistance");
if(resistance != NULL) {
const std::string& val = (*resistance)[attack.type()];
const int resist = atoi(val.c_str());
res = (resist*attack.damage())/100;
if(val != "") {
const int resist = atoi(val.c_str());
res = (resist*attack.damage())/100;
}
}
if(res == -1 && parent_ != NULL) {
@ -329,15 +337,20 @@ int unit_movement_type::damage_against(const attack_type& attack) const
return res;
}
const string_map& unit_movement_type::damage_table() const
string_map unit_movement_type::damage_table() const
{
string_map res;
if(parent_ != NULL)
res = parent_->damage_table();
const config* const resistance = cfg_.child("resistance");
if(resistance == NULL) {
static const std::map<std::string,std::string> default_val;
return default_val;
} else {
return resistance->values;
if(resistance != NULL) {
for(string_map::const_iterator i = resistance->values.begin(); i != resistance->values.end(); ++i) {
res[i->first] = i->second;
}
}
return res;
}
void unit_movement_type::set_parent(const unit_movement_type* parent)

View file

@ -33,6 +33,7 @@ public:
const std::string& type() const;
const std::string& special() const;
RANGE range() const;
int hexes() const;
int damage() const;
int num_attacks() const;
@ -63,6 +64,7 @@ private:
std::string type_;
std::string special_;
RANGE range_;
int hexes_;
int damage_;
int num_attacks_;
@ -105,7 +107,7 @@ public:
int defense_modifier(const gamemap& map, gamemap::TERRAIN terrain) const;
int damage_against(const attack_type& attack) const;
const string_map& damage_table() const;
string_map damage_table() const;
void set_parent(const unit_movement_type* parent);