added 'berserk' attack ability and gave it to the dwarvish berserker

This commit is contained in:
Dave White 2004-04-08 15:02:48 +00:00
parent 8f6b3ebe62
commit fbbd7766b0
6 changed files with 36 additions and 33 deletions

View file

@ -538,6 +538,9 @@ This attack slows the target. Slowed units move at half normal speed and receive
weapon_special_stone_description="Stone:
This attack turns the target to stone. Units that have been turned to stone may not move or attack."
weapon_special_berserk_description="Berserk:
Whether used offensively or defensively, this attack presses the engagement until one of the combatants is slain."
#Multiplayer lobby/dialogs
game_lobby="Game Lobby"
shroud="Shroud"

View file

@ -10,9 +10,8 @@ level=2
alignment=neutral
advanceto=null
cost=100
ability=leadership
usage=fighter
unit_description="Dwarves are an ancient race of powerful fighters. Their Berserkers are a triple threat who can wield a deadly battle axe, throw knives to hit their enemies from a distance, or throw themselves into a mad frenzy, forgoing all defense to double their attack power. In addition, the mighty presence of the Dwarvish Berserker inspires adjacent troops of lower level, giving them a boost in their attacks."
unit_description="Dwarves are an ancient race of powerful fighters. Their Berserkers forgo all defense in exchange for massive damage against their enemies. Once a battle is entered, Dwarvish Berserkers attack ferociously, continuing to push the attack until either they or their enemy lies dead."
get_hit_sound=groan.wav
[resistance]
blade=70
@ -21,38 +20,20 @@ get_hit_sound=groan.wav
fire=90
cold=80
[/resistance]
[attack]
name=battle axe
type=blade
icon=misc/battleaxe.png
range=short
damage=8
number=4
[/attack]
[defense]
hills=60
mountains=50
village=60
cave=60
castle=60
[/defense]
[attack]
name=berserker frenzy
icon=misc/frenzy.png
type=blade
special=charge
special=berserk
range=short
damage=8
damage=7
number=4
[/attack]
[attack]
name=knife
type=blade
range=long
damage=6
number=2
[missile_frame]
begin=-100
end=0
image=missiledagger-n.png
image_diagonal=missiledagger-ne.png
[/missile_frame]
[sound]
time=-100
sound=knife.wav
[/sound]
[/attack]
[/unit]

View file

@ -202,6 +202,9 @@ battle_stats evaluate_battle_stats(
bool backstab = false;
static const std::string to_the_death_string("berserk");
res.to_the_death = attack.special() == to_the_death_string;
static const std::string backstab_string("backstab");
if(attack.special() == backstab_string) {
gamemap::location adj[6];
@ -264,9 +267,14 @@ battle_stats evaluate_battle_stats(
res.damage_attacker_takes = 0;
if(counterattack) {
if(defender_attacks[defend].special() == to_the_death_string) {
res.to_the_death = true;
}
//magical attacks always have a 70% chance to hit
if(defender_attacks[defend].special() == magical_string)
if(defender_attacks[defend].special() == magical_string) {
res.chance_to_hit_attacker = 70;
}
int percent = 0;
@ -525,6 +533,10 @@ void attack(display& gui, const gamemap& map,
statistics::attack_context attack_stats(a->second,d->second,stats);
const int orig_attacks = stats.nattacks;
const int orig_defends = stats.ndefends;
int to_the_death = stats.to_the_death ? 10 : 0;
static const std::string poison_string("poison");
while(stats.nattacks > 0 || stats.ndefends > 0) {
@ -795,6 +807,12 @@ void attack(display& gui, const gamemap& map,
--stats.ndefends;
}
if(to_the_death > 0 && stats.ndefends == 0 && stats.nattacks == 0) {
stats.nattacks = orig_attacks;
stats.ndefends = orig_defends;
--to_the_death;
}
}
if(attackerxp) {

View file

@ -59,6 +59,7 @@ struct battle_stats
int attack_with, defend_with;
bool attacker_plague, defender_plague;
std::vector<std::string> attack_calculations, defend_calculations;
bool to_the_death;
};
//evaluate_battle_stats: a function which, if given an attacker

View file

@ -37,7 +37,7 @@ config prefs;
display* disp = NULL;
bool muted_ = false;
bool colour_cursors = true;
bool colour_cursors = false;
}
@ -50,7 +50,7 @@ manager::manager()
set_music_volume(music_volume());
set_sound_volume(sound_volume());
set_colour_cursors(prefs["colour_cursors"] != "no");
set_colour_cursors(prefs["colour_cursors"] == "yes");
}
manager::~manager()

View file

@ -671,7 +671,7 @@ int show_dialog(display& disp, SDL_Surface* image,
}
disp.video().flip();
SDL_Delay(20);
SDL_Delay(10);
}
return -1;