some changes to scenarios and AI in Heir to the Throne
This commit is contained in:
parent
75122b8ea3
commit
05ce6863a1
13 changed files with 235 additions and 167 deletions
|
@ -3,19 +3,19 @@ hhhhhggggggggggggggggggggdctcd1
|
|||
hhhgggtggggggggtgggggtgggdcccdC
|
||||
hhggggggggggggggggggggdddccccdg
|
||||
hhgggggggggggggggggddddcccsssdd
|
||||
hggggggggggtggggddddcccctcssssd
|
||||
hggggggggggtggggddddccccZcssssd
|
||||
hgggggggggggggdddcccccscccsssss
|
||||
ggggggggggggdddcccsctcsssssssss
|
||||
ggggggggggggdddcccscZcsssssssss
|
||||
ggggggggggdddccssssssssssssssss
|
||||
gtggggtgdddccccssssssssssssssss
|
||||
gggggggddcccccccsssssssssssssss
|
||||
ggggggddccccctcssssssssssssssss
|
||||
ggggggddcccccZcssssssssssssssss
|
||||
ggggggdcccccccccsssssssssssssss
|
||||
ggggtddcccccccccsssssssssssssss
|
||||
gggggdccctdcccccsssssssssssssss
|
||||
gggggdcccZdcccccsssssssssssssss
|
||||
ggggddcsccccccccsssssssssssssss
|
||||
ggggdccscccccccccssssssssssssss
|
||||
ggggdcsssccctcccccsssssssssssss
|
||||
ggggdcssscccZcccccsssssssssssss
|
||||
ggtgdcssssccccccccsssssssssssss
|
||||
gggdccsssssccccccccssssssssssss
|
||||
ccgdcsssssscccdddccssssssssssss
|
||||
|
|
|
@ -112,6 +112,9 @@ Defeat:
|
|||
team_name=orcs
|
||||
[/side]
|
||||
|
||||
{STARTING_VILLAGES 3 20}
|
||||
{STARTING_VILLAGES 2 10}
|
||||
|
||||
[event]
|
||||
name=start
|
||||
[recall]
|
||||
|
|
|
@ -23,7 +23,7 @@ Victory:
|
|||
Defeat:
|
||||
#Death of Konrad
|
||||
#Death of Delfador
|
||||
#Death of Seimus"
|
||||
#Death of Sir Kaylan"
|
||||
|
||||
[bigmap]
|
||||
image=misc/map.png
|
||||
|
@ -36,29 +36,33 @@ Defeat:
|
|||
{CROSS 219 377}
|
||||
[/bigmap]
|
||||
|
||||
[label]
|
||||
x,y=26,8
|
||||
id=blackwater_label
|
||||
text="Blackwater Port"
|
||||
[/label]
|
||||
|
||||
[side]
|
||||
race=Elves
|
||||
type=Commander
|
||||
description=Konrad
|
||||
hitpoints=45
|
||||
experience=0
|
||||
side=1
|
||||
canrecruit=1
|
||||
recruit=Elvish Scout,Elvish Fighter,Elvish Archer,Horseman,Mage,Elvish Shaman
|
||||
recruit=Elvish Scout,Elvish Fighter,Elvish Archer,Horseman,Elvish Shaman
|
||||
team_name=elves
|
||||
controller=human
|
||||
[/side]
|
||||
|
||||
[side]
|
||||
race=Humans
|
||||
type=Arch Mage
|
||||
description=Seimus
|
||||
experience=0
|
||||
type=Grand Knight
|
||||
description=Sir Kaylan
|
||||
side=2
|
||||
canrecruit=1
|
||||
team_name=elves
|
||||
recruit=Mage,Red Mage,White Mage
|
||||
recruitment_pattern=mixed fighter,mixed fighter,healer
|
||||
recruit=Horseman,Knight
|
||||
recruitment_pattern=fighter
|
||||
villages_per_scout=0
|
||||
#ifdef EASY
|
||||
gold=250
|
||||
#else
|
||||
|
@ -100,9 +104,9 @@ Defeat:
|
|||
description=Delfador
|
||||
[/recall]
|
||||
[message]
|
||||
id=msg1b_1
|
||||
id=msg1b_1a
|
||||
description=Delfador
|
||||
message="We should be able to board a ship at Blackwater Port, but it seems the Orcs are heading there too. One of my old apprentices has settled in these lands - I am sure he will help us!"
|
||||
message="We should be able to board a ship at Blackwater Port, but it seems the Orcs are heading there too. Rebels who hate Asheviere and are loyal to the memory of the king desperately hold the port, as it is one of the only places where they can ship supplies and weapons."
|
||||
[/message]
|
||||
[message]
|
||||
id=msg1b_2
|
||||
|
@ -110,23 +114,58 @@ Defeat:
|
|||
message="Defaldor, some Orcs are following us! We must make haste!"
|
||||
[/message]
|
||||
[message]
|
||||
id=msg1b_3
|
||||
description=Seimus
|
||||
message="Delfador, my old master, your arrival brings us the light of hope.
|
||||
We heard the news that the orcs were attacking the elvish woods and some of them were headed here to attack us also, but our defenses are still weak."
|
||||
id=msg1b_3a
|
||||
description=Sir Kaylan
|
||||
message="Delfador, my old friend! We had heard of your coming, and of the attacks on the Elves. It is good to see you again, although I would prefer it were not in such sad times."
|
||||
[/message]
|
||||
[message]
|
||||
id=msg1b_3b
|
||||
description=Delfador
|
||||
message="Konrad, this is Kaylan, one of the mightiest of the horse lords, and one of the few who is willing to oppose the dark crown. Rumor has it that his lance has slain fifty men and a hundred orcs."
|
||||
[/message]
|
||||
[message]
|
||||
id=msg1b_3c
|
||||
description=Sir Kaylan
|
||||
message="It seems the orcs have come here too, to try to wrest this port from our hands. Our defenses are still weak, but reinforcements will arrive soon!"
|
||||
[/message]
|
||||
|
||||
[message]
|
||||
id=msg1b_4
|
||||
description=Konrad
|
||||
message="We will help you fight them off."
|
||||
message="We will help you fight them off until the reinforcements arrive."
|
||||
[/message]
|
||||
[message]
|
||||
id=msg1b_5a
|
||||
description=Seimus
|
||||
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."
|
||||
id=msg1b_5c
|
||||
description=Sir Kaylan
|
||||
message="Hopefully with your help we can ward them off. But you must not tarry here long, for your survival is even more important to our cause than the strength of the port. A ship is due here in two days, surely it will be able to take you to safety."
|
||||
[/message]
|
||||
[message]
|
||||
id=msg1b_5b
|
||||
id=msg1b_5d
|
||||
description=Konrad
|
||||
message="And the ship will take us to Anduin?"
|
||||
[/message]
|
||||
[message]
|
||||
id=msg1b_5e
|
||||
description=Delfador
|
||||
message="Yes, we will sail to the Isle of Anduin, my home Konrad, and the home of many mages."
|
||||
[/message]
|
||||
[message]
|
||||
id=msg1b_5f
|
||||
description=Sir Kaylan
|
||||
message="I will send one of my horsemen to serveunder you. I offer you my support Konrad, and the support of my men - from now on you will be able to recruit horsemen."
|
||||
[/message]
|
||||
[message]
|
||||
id=msg1b_5g_a
|
||||
description=Konrad
|
||||
message="Thank you, sir. But how shall I best use these horsemen? How do they differ from Elves?"
|
||||
[/message]
|
||||
[message]
|
||||
id=msg1b_5h
|
||||
description=Sir Kaylan
|
||||
message="Elves are a powerful race, Konrad, more powerful than my own people usually acknowledge. But horsemen are powerful in a different way. They have no long range attack, but can charge into combat, inflicting double normal damage, though taking double damage in return. They are also lawful, meaning they are better at day, and worse at night. Horsemen are unmatched on open land, though Elves will serve you better in rugged terrain."
|
||||
[/message]
|
||||
[message]
|
||||
id=msg1b_5i
|
||||
description=Delfador
|
||||
message="Recruit troops wisely, Konrad, and remember that you can recall experienced units from past battles to help you fight again."
|
||||
[/message]
|
||||
|
@ -135,7 +174,7 @@ We heard the news that the orcs were attacking the elvish woods and some of them
|
|||
name=start
|
||||
[unit]
|
||||
description=Haldiel
|
||||
type=Mage
|
||||
type=Horseman
|
||||
x=21
|
||||
y=24
|
||||
side=1
|
||||
|
@ -144,51 +183,51 @@ We heard the news that the orcs were attacking the elvish woods and some of them
|
|||
[event]
|
||||
name=time over
|
||||
[message]
|
||||
id=msg1b_6
|
||||
description=Seimus
|
||||
message="The defenses are now summoned."
|
||||
id=msg1b_6a
|
||||
description=Sir Kaylan
|
||||
message="Reinforcements have arrived! Forward men! I expect each of you to bring me back the head of an orc!"
|
||||
[/message]
|
||||
[message]
|
||||
id=msg1b_7
|
||||
id=msg1b_7a
|
||||
description=Mokolo Qimur
|
||||
message="Geeee!! Too many mages, we had better retreat now!"
|
||||
message="So many foul humans riding on horses! There is no way we can defeat them. Quick, we must make our escape!"
|
||||
[/message]
|
||||
[unit]
|
||||
type=Red Mage
|
||||
type=Horseman
|
||||
x=23
|
||||
y=8
|
||||
side=2
|
||||
[/unit]
|
||||
[unit]
|
||||
type=Red Mage
|
||||
type=Horseman
|
||||
x=23
|
||||
y=8
|
||||
ai_special=guardian
|
||||
side=2
|
||||
[/unit]
|
||||
[unit]
|
||||
type=Red Mage
|
||||
type=Horseman
|
||||
x=23
|
||||
y=8
|
||||
ai_special=guardian
|
||||
side=2
|
||||
[/unit]
|
||||
[unit]
|
||||
type=White Mage
|
||||
type=Knight
|
||||
x=23
|
||||
y=8
|
||||
ai_special=guardian
|
||||
side=2
|
||||
[/unit]
|
||||
[unit]
|
||||
type=White Mage
|
||||
type=Knight
|
||||
x=23
|
||||
y=8
|
||||
ai_special=guardian
|
||||
side=2
|
||||
[/unit]
|
||||
[unit]
|
||||
type=White Mage
|
||||
type=Knight
|
||||
x=23
|
||||
y=8
|
||||
ai_special=guardian
|
||||
|
@ -200,38 +239,11 @@ We heard the news that the orcs were attacking the elvish woods and some of them
|
|||
[/event]
|
||||
[event]
|
||||
name=victory
|
||||
[command]
|
||||
[message]
|
||||
id=msg1b_8
|
||||
description=Seimus
|
||||
message="Thank you for the help, friends."
|
||||
id=msg1b_8a
|
||||
description=Sir Kaylan
|
||||
message="Thank you for the help, friends. The ship should arrive soon, it will take you to Anduin."
|
||||
[/message]
|
||||
|
||||
[message]
|
||||
id=msg1b_9
|
||||
description=Delfador
|
||||
message="We are seeking transport to the isle of Anduin."
|
||||
[/message]
|
||||
|
||||
[message]
|
||||
id=msg1b_10
|
||||
description=Seimus
|
||||
message="I could offer you a ship - I sent it to the open sea with the elderly, the women, and the children, but it should return to port soon."
|
||||
[/message]
|
||||
|
||||
[message]
|
||||
id=msg1b_11
|
||||
description=Konrad
|
||||
message="Thank you, sir."
|
||||
[/message]
|
||||
|
||||
[message]
|
||||
id=msg1b_11b
|
||||
description=Seimus
|
||||
message="I only hope that we will do as well the next time the evil Orcs attack us."
|
||||
[/message]
|
||||
[/command]
|
||||
[command]
|
||||
[move_unit_fake]
|
||||
type=Galleon
|
||||
x=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25
|
||||
|
@ -242,24 +254,26 @@ We heard the news that the orcs were attacking the elvish woods and some of them
|
|||
y=3
|
||||
image=galleon.png
|
||||
[/item]
|
||||
[/command]
|
||||
[command]
|
||||
[message]
|
||||
id=msg1b_12
|
||||
description=Delfador
|
||||
message="We should embark now."
|
||||
[/message]
|
||||
[/command]
|
||||
[message]
|
||||
id=msg1b_13
|
||||
description=Sir Kaylan
|
||||
message="Safe voyage to you, friends. Rest assured that we will never surrender to the forces of the Dark Queen."
|
||||
[/message]
|
||||
[/event]
|
||||
[event]
|
||||
name=die
|
||||
[filter]
|
||||
description=Seimus
|
||||
description=Sir Kaylan
|
||||
[/filter]
|
||||
[message]
|
||||
id=msg1b_13
|
||||
speaker=unit
|
||||
message="I failed to save the Blackwater port people..."
|
||||
message="I have failed in my duty to protect the Rightful Heir and the port"
|
||||
[/message]
|
||||
[message]
|
||||
id=msg1b_14
|
||||
|
|
|
@ -49,7 +49,7 @@ Defeat:
|
|||
side=1
|
||||
gold=100
|
||||
canrecruit=1
|
||||
recruit=Elvish Scout,Elvish Fighter,Elvish Archer,Horseman,Mage,Elvish Shaman
|
||||
recruit=Elvish Scout,Elvish Fighter,Elvish Archer,Horseman,Elvish Shaman
|
||||
enemy=2
|
||||
controller=human
|
||||
[/side]
|
||||
|
@ -67,6 +67,9 @@ Defeat:
|
|||
enemy=1
|
||||
[/side]
|
||||
|
||||
#make the orcs start with a whole slew of villages
|
||||
{STARTING_VILLAGES 2 20}
|
||||
|
||||
#if anyone moves next to the ship, they get a rebuke from Konrad
|
||||
[event]
|
||||
name=moveto
|
||||
|
@ -151,33 +154,69 @@ Defeat:
|
|||
[redraw]
|
||||
[/redraw]
|
||||
|
||||
[command]
|
||||
[message]
|
||||
id=msg2_1
|
||||
speaker=narrator
|
||||
message="And so the party landed on the Isle of Anduin."
|
||||
[/message]
|
||||
[message]
|
||||
id=msg2_2
|
||||
description=Konrad
|
||||
message="So this is Anduin. It looks a little...desolate"
|
||||
[/message]
|
||||
[message]
|
||||
id=msg2_3a
|
||||
description=Delfador
|
||||
message="I fear so, Konrad. It seems that the Orcs have come even here. Here to the place where I was born, where I was trained."
|
||||
[/message]
|
||||
[message]
|
||||
id=msg2_4
|
||||
description=Usadar Q'kai
|
||||
message="Who is that? Oh, a party of elves has landed. We shall drive them back into the sea!"
|
||||
[/message]
|
||||
[message]
|
||||
id=msg2_5
|
||||
description=Delfador
|
||||
message="I did not think the Orcs would have come here. This island used to be so beautiful. We must recapture it! To arms!"
|
||||
[/message]
|
||||
[/event]
|
||||
|
||||
[event]
|
||||
name=moveto
|
||||
[filter]
|
||||
x,y=20,9
|
||||
side=1
|
||||
[/filter]
|
||||
[unit]
|
||||
type=Mage
|
||||
side=1
|
||||
description=Elrian
|
||||
x,y=20,9
|
||||
[/unit]
|
||||
[message]
|
||||
id=msg2_mage_1
|
||||
speaker=unit
|
||||
message="I found someone hiding in the village!"
|
||||
[/message]
|
||||
[message]
|
||||
id=msg2_mage_2
|
||||
description=Elrian
|
||||
message="My lords, I have been hiding in the village from the orcs, like many of the other mages here. Perhaps we can work together to recapture the island!"
|
||||
[/message]
|
||||
[message]
|
||||
id=msg2_mage_3
|
||||
description=Delfador
|
||||
message="Certainly, let us join together to fight the evil ones"
|
||||
[/message]
|
||||
[message]
|
||||
id=msg2_1
|
||||
speaker=narrator
|
||||
message="And so the party landed on the Isle of Anduin."
|
||||
id=msg2_mage_4
|
||||
message="You can now recruit mages"
|
||||
[/message]
|
||||
[message]
|
||||
id=msg2_2
|
||||
description=Konrad
|
||||
message="So this is Anduin. It looks a little...desolate"
|
||||
[/message]
|
||||
[message]
|
||||
id=msg2_3
|
||||
description=Delfador
|
||||
message="I fear so, Konrad. It seems that the Orcs have come even here."
|
||||
[/message]
|
||||
[message]
|
||||
id=msg2_4
|
||||
description=Usadar Q'kai
|
||||
message="Who is that? Oh, a party of elves has landed. We shall drive them back into the sea!"
|
||||
[/message]
|
||||
[message]
|
||||
id=msg2_5
|
||||
description=Delfador
|
||||
message="I did not think the Orcs would have come here. This island used to be so beautiful. We must recapture it! To arms!"
|
||||
[/message]
|
||||
[/command]
|
||||
[allow_recruit]
|
||||
side=1
|
||||
type=Mage
|
||||
[/allow_recruit]
|
||||
[/event]
|
||||
|
||||
[event]
|
||||
|
@ -185,67 +224,55 @@ Defeat:
|
|||
[unit]
|
||||
x=5
|
||||
y=34
|
||||
type=Elvish Fighter
|
||||
description=Glordorf
|
||||
type=Arch Mage
|
||||
description=Seimus
|
||||
side=1
|
||||
[/unit]
|
||||
|
||||
[message]
|
||||
id=msg2_6
|
||||
description=Glordorf
|
||||
message="Greetings, friends, and thank you for rescuing my island from the Orcs!"
|
||||
id=msg2_6a
|
||||
description=Seimus
|
||||
message="Delfador, my old master! You have saved the island from the Orcs!"
|
||||
[/message]
|
||||
|
||||
[message]
|
||||
id=msg2_7
|
||||
description=Konrad
|
||||
message="It was our duty, friend. I hope you will grant us refuge here in return."
|
||||
[/message]
|
||||
|
||||
[message]
|
||||
id=msg2_8
|
||||
description=Glordorf
|
||||
message="Of course. The Orcs are brutal, very brutal. Especially in what they are doing to the poor mermen."
|
||||
[/message]
|
||||
|
||||
[message]
|
||||
id=msg2_9
|
||||
description=Konrad
|
||||
message="Oh, what are they doing to the mermen?"
|
||||
[/message]
|
||||
|
||||
[message]
|
||||
id=msg2_10
|
||||
description=Glordorf
|
||||
message="Have you not heard? Many mermen have been captured, and are being forced to labor as pearl harvesters at the Bay of Pearls. If only someone would rescue them!"
|
||||
[/message]
|
||||
|
||||
[message]
|
||||
id=msg2_11
|
||||
description=Konrad
|
||||
message="Let us go and rescue them then!"
|
||||
[/message]
|
||||
|
||||
[message]
|
||||
id=msg2_12
|
||||
description=Glordorf
|
||||
message="My lord, it would be very dangerous..."
|
||||
[/message]
|
||||
|
||||
[message]
|
||||
id=msg2_13
|
||||
id=msg2_6b
|
||||
description=Delfador
|
||||
message="I believe we could do it. We need to strike back at Asheviere somehow anyway."
|
||||
message="My apprentice. How did the island fall to such as these?"
|
||||
[/message]
|
||||
|
||||
[message]
|
||||
id=msg2_14
|
||||
id=msg2_6c
|
||||
description=Seimus
|
||||
message="You have not heard, master Delfador? Asheviere is trying to control the entire western coast. She hired many Orcs and sent them here. The Orcs were holding me here until a ship arrived to take me to Weldyn to stand trial for treason for training mages!"
|
||||
[/message]
|
||||
|
||||
[message]
|
||||
id=msg2_6d
|
||||
description=Delfador
|
||||
message="We have come from fighting her forces at Blackwater. Where else has she attacked?"
|
||||
[/message]
|
||||
|
||||
[message]
|
||||
id=msg2_6e
|
||||
description=Seimus
|
||||
message="She has taken control of the Bay of Pearls, long held by the mermen, and has enslaved the mermen, making them dive for pearls for her. With the pearls she grows richer every day. There are even rumors that she may break the ancient treaty and attack Elensefar!"
|
||||
[/message]
|
||||
|
||||
[message]
|
||||
id=msg2_6f
|
||||
description=Konrad
|
||||
message="Let us leave after we have rested then."
|
||||
message="Can't we strike back at her? How many forces does she have at the Bay of Pearls? Can we take it back from her?"
|
||||
[/message]
|
||||
|
||||
[message]
|
||||
id=msg2_6g
|
||||
description=Delfador
|
||||
message="Go there, we must. Let us rest here a little, and then we shall set sail for the Bay. Hopefully we will be able to defeat her forces there!"
|
||||
[/message]
|
||||
|
||||
[kill]
|
||||
description=Glordorf
|
||||
description=Seimus
|
||||
[/kill]
|
||||
[/event]
|
||||
|
||||
|
|
|
@ -25,15 +25,6 @@ submerge=0.4
|
|||
unit_height_adjust=-4
|
||||
[/terrain]
|
||||
|
||||
[terrain]
|
||||
image=ice
|
||||
name=ice
|
||||
char=i
|
||||
unit_height_adjust=-2
|
||||
aliasof=S
|
||||
light=true
|
||||
[/terrain]
|
||||
|
||||
[terrain]
|
||||
image=flag-coast-neutral
|
||||
adjacent_image=coast
|
||||
|
@ -58,6 +49,15 @@ aliasof=gc
|
|||
no_overlay=true
|
||||
[/terrain]
|
||||
|
||||
[terrain]
|
||||
image=ice
|
||||
name=ice
|
||||
char=i
|
||||
unit_height_adjust=-2
|
||||
aliasof=S
|
||||
light=true
|
||||
[/terrain]
|
||||
|
||||
[terrain]
|
||||
image=swampwater,swampwater2,swampwater3
|
||||
name=swamp water
|
||||
|
@ -148,7 +148,6 @@ char=v
|
|||
aliasof=t
|
||||
no_overlay=true
|
||||
adjacent_image=grassland
|
||||
light=true
|
||||
heals=true
|
||||
gives_income=true
|
||||
[/terrain]
|
||||
|
|
|
@ -947,7 +947,7 @@ bool will_heal(const gamemap::location& loc, int side, const std::vector<team>&
|
|||
|
||||
}
|
||||
|
||||
void calculate_healing(display& disp, const gamemap& map,
|
||||
void calculate_healing(display& disp, const gamestatus& status, const gamemap& map,
|
||||
std::map<gamemap::location,unit>& units, int side,
|
||||
const std::vector<team>& teams)
|
||||
{
|
||||
|
@ -1075,13 +1075,16 @@ void calculate_healing(display& disp, const gamemap& map,
|
|||
|
||||
const gamemap::location& loc = h->first;
|
||||
|
||||
const bool show_healing = !disp.turbo() && !recorder.skipping() &&
|
||||
!disp.fogged(loc.x,loc.y);
|
||||
|
||||
assert(units.count(loc) == 1);
|
||||
|
||||
unit& u = units.find(loc)->second;
|
||||
|
||||
const bool show_healing = !disp.turbo() && !recorder.skipping() &&
|
||||
!disp.fogged(loc.x,loc.y) &&
|
||||
(!u.invisible(map.underlying_terrain(map[h->first.x][h->first.y]),
|
||||
status.get_time_of_day().lawful_bonus,h->first,units,teams) ||
|
||||
teams[disp.viewing_team()].is_enemy(side) == false);
|
||||
|
||||
typedef std::multimap<gamemap::location,gamemap::location>::const_iterator healer_itor;
|
||||
const std::pair<healer_itor,healer_itor> healer_itors = healers.equal_range(loc);
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ unit_map::const_iterator find_leader(const unit_map& units, int side);
|
|||
|
||||
//calculates healing for all units for the given side. Should be called
|
||||
//at the beginning of a side's turn.
|
||||
void calculate_healing(display& disp, const gamemap& map,
|
||||
void calculate_healing(display& disp, const gamestatus& status, const gamemap& map,
|
||||
std::map<gamemap::location,unit>& units, int side,
|
||||
const std::vector<team>& teams);
|
||||
|
||||
|
|
12
src/ai.cpp
12
src/ai.cpp
|
@ -646,7 +646,7 @@ std::vector<std::pair<gamemap::location,gamemap::location> > ai::get_village_com
|
|||
const std::vector<std::pair<gamemap::location,gamemap::location> >& village_moves,
|
||||
std::vector<std::pair<gamemap::location,gamemap::location> >::const_iterator start_at)
|
||||
{
|
||||
const int leader_distance_from_keep = 10000;
|
||||
int leader_distance_from_keep = -1;
|
||||
|
||||
std::vector<std::pair<location,location> > result;
|
||||
|
||||
|
@ -674,6 +674,10 @@ std::vector<std::pair<gamemap::location,gamemap::location> > ai::get_village_com
|
|||
if(result_better) {
|
||||
result.swap(res);
|
||||
result.push_back(*i);
|
||||
|
||||
if(distance != -1) {
|
||||
leader_distance_from_keep = distance;
|
||||
}
|
||||
}
|
||||
|
||||
taken_villages.erase(i->first);
|
||||
|
@ -686,6 +690,7 @@ std::vector<std::pair<gamemap::location,gamemap::location> > ai::get_village_com
|
|||
|
||||
bool ai::get_villages(std::map<gamemap::location,paths>& possible_moves, const move_map& srcdst, const move_map& dstsrc, const move_map& enemy_srcdst, const move_map& enemy_dstsrc, unit_map::const_iterator leader)
|
||||
{
|
||||
std::cerr << "deciding which villages we want...\n";
|
||||
//we want to build up a list of possible moves we can make that will capture villages.
|
||||
//limit the moves to 'max_village_moves' to make sure things don't get out of hand.
|
||||
const size_t max_village_moves = 50;
|
||||
|
@ -714,6 +719,7 @@ bool ai::get_villages(std::map<gamemap::location,paths>& possible_moves, const m
|
|||
}
|
||||
|
||||
if(want_village) {
|
||||
std::cerr << "want village at " << (j->first.x+1) << "," << (j->first.y+1) << "\n";
|
||||
village_moves.push_back(*j);
|
||||
}
|
||||
}
|
||||
|
@ -743,7 +749,7 @@ bool ai::get_healing(std::map<gamemap::location,paths>& possible_moves, const mo
|
|||
//worth of healing, and doesn't regenerate itself, then try to
|
||||
//find a vacant village for it to rest in
|
||||
if(u.side() == team_num_ &&
|
||||
u.type().hitpoints() - u.hitpoints() >= game_config::cure_amount/2 &&
|
||||
u.max_hitpoints() - u.hitpoints() >= game_config::cure_amount/2 &&
|
||||
!u.type().regenerates()) {
|
||||
|
||||
//look for the village which is the least vulnerable to enemy attack
|
||||
|
@ -1265,7 +1271,7 @@ void ai::leader_attack()
|
|||
{
|
||||
std::cerr << "leader attack analysis...\n";
|
||||
const unit_map::iterator leader = find_leader(units_,team_num_);
|
||||
if(leader == units_.end() || leader->second.stone())
|
||||
if(leader == units_.end() || leader->second.stone() || leader->second.can_attack() == false)
|
||||
return;
|
||||
|
||||
gamemap::location choice;
|
||||
|
|
13
src/game.cpp
13
src/game.cpp
|
@ -64,7 +64,10 @@ LEVEL_RESULT play_game(display& disp, game_state& state, config& game_config,
|
|||
|
||||
config* scenario = NULL;
|
||||
|
||||
config starting_pos;
|
||||
//'starting_pos' will contain the position we start the game from.
|
||||
//'replay_starting_pos' will contain the position as at the start of the scenario
|
||||
//which is useful for saving replays
|
||||
config starting_pos, replay_starting_pos;
|
||||
|
||||
//see if we load the scenario from the scenario data -- if there is
|
||||
//no snapshot data available from a save, or if the user has selected
|
||||
|
@ -76,15 +79,19 @@ LEVEL_RESULT play_game(display& disp, game_state& state, config& game_config,
|
|||
std::cerr << "loading starting position: '" << state.starting_pos.write() << "'\n";
|
||||
starting_pos = state.starting_pos;
|
||||
scenario = &starting_pos;
|
||||
replay_starting_pos = state.starting_pos;
|
||||
} else {
|
||||
scenario = game_config.find_child(type,"id",state.scenario);
|
||||
}
|
||||
|
||||
statistics::clear_current_scenario();
|
||||
if(!recorder.at_end()) {
|
||||
statistics::clear_current_scenario();
|
||||
}
|
||||
} else {
|
||||
std::cerr << "loading snapshot...\n";
|
||||
//load from a save-snapshot.
|
||||
starting_pos = state.snapshot;
|
||||
replay_starting_pos = state.starting_pos;
|
||||
scenario = &starting_pos;
|
||||
state = read_game(units_data,&state.snapshot);
|
||||
}
|
||||
|
@ -130,7 +137,7 @@ LEVEL_RESULT play_game(display& disp, game_state& state, config& game_config,
|
|||
try {
|
||||
config snapshot;
|
||||
|
||||
recorder.save_game(units_data,label,snapshot,starting_pos);
|
||||
recorder.save_game(units_data,label,snapshot,replay_starting_pos);
|
||||
} catch(gamestatus::save_game_failed& e) {
|
||||
gui::show_dialog(disp,NULL,"",string_table["save_game_failed"],gui::MESSAGE);
|
||||
retry = true;
|
||||
|
|
|
@ -727,11 +727,13 @@ bool event_handler::handle_event_command(const queued_event& event_info, const s
|
|||
std::string text;
|
||||
|
||||
gamemap::location loc;
|
||||
bool remove_overlay = false;
|
||||
if(filter != NULL) {
|
||||
loc = gamemap::location(*filter);
|
||||
}
|
||||
|
||||
if(loc.valid() == false) {
|
||||
remove_overlay = true;
|
||||
loc = event_info.loc1;
|
||||
}
|
||||
|
||||
|
@ -749,7 +751,7 @@ bool event_handler::handle_event_command(const queued_event& event_info, const s
|
|||
|
||||
u->second.add_modification("object",cfg);
|
||||
|
||||
if(!loc.valid()) {
|
||||
if(remove_overlay) {
|
||||
screen->remove_overlay(event_info.loc1);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "display.hpp"
|
||||
#include "font.hpp"
|
||||
#include "language.hpp"
|
||||
#include "map_label.hpp"
|
||||
|
||||
map_labels::map_labels(const display& disp, const gamemap& map) : disp_(disp), map_(map)
|
||||
|
@ -32,8 +33,9 @@ void map_labels::read(const config& cfg)
|
|||
const config::child_list& items = cfg.get_children("label");
|
||||
for(config::child_list::const_iterator i = items.begin(); i != items.end(); ++i) {
|
||||
const gamemap::location loc(**i);
|
||||
const std::string& id = (**i)["id"];
|
||||
const std::string& text = (**i)["text"];
|
||||
set_label(loc,text);
|
||||
set_label(loc,translate_string_default(id,text));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -441,7 +441,7 @@ LEVEL_RESULT play_level(game_data& gameinfo, const config& game_config,
|
|||
team_it->spend_gold(expense);
|
||||
}
|
||||
|
||||
calculate_healing(gui,map,units,player_number,teams);
|
||||
calculate_healing(gui,status,map,units,player_number,teams);
|
||||
}
|
||||
|
||||
gui.set_playing_team(size_t(player_number-1));
|
||||
|
|
|
@ -355,6 +355,11 @@ bool team::is_enemy(int n) const
|
|||
return false;
|
||||
}
|
||||
|
||||
//we're not enemies of ourselves
|
||||
if(&(*teams)[index] == this) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//if we have a team name, we are friends with anyone who has the same team name
|
||||
if(info_.team_name.empty() == false) {
|
||||
return (*teams)[index].info_.team_name != info_.team_name;
|
||||
|
|
Loading…
Add table
Reference in a new issue