update king of the hill to new ai and small improvements

alut-include-path
Maikel de Vries 2017-01-27 14:07:25 +01:00
parent 21f82e6c41
commit 957d74bbae
7 changed files with 65 additions and 46 deletions

View File

@ -6,4 +6,5 @@ Ziel: Überlebe möglichst viele Angriffswellen.
Tipps:
- This round is cooperative, so work together and divide tasks.
- Build up a settlement and defense during the earlier rounds of attack.
- Build up a settlement and defense during the earlier rounds of attack.
- Resources and liquids reappear at certain locations.

View File

@ -6,4 +6,5 @@ Goal: Survive as many attack waves as possible.
Hints:
- This round is cooperative, so work together and divide tasks.
- Build up a settlement and defense during the earlier rounds of attack.
- Build up a settlement and defense during the earlier rounds of attack.
- Resources and liquids reappear at certain locations.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -148,7 +148,7 @@ func InitializeObjects()
var Elevator001 = CreateObjectAbove(Elevator, 104, 487);
Elevator001->SetDir(DIR_Right);
Elevator001->CreateShaft(0);
Elevator001->CreateShaft(230);
Elevator001->SetCasePosition(476);
var Basement005 = CreateObject(Basement, 115, 492);

View File

@ -10,13 +10,15 @@ static init_defenders;
protected func Initialize()
{
// Defense goal.
CreateObject(Goal_Defense);
// Rules.
CreateObject(Rule_BuyAtFlagpole);
CreateObject(Rule_BaseRespawn);
CreateObject(Rule_TeamAccount);
CreateObject(Rule_NoFriendlyFire);
CreateObject(Rule_Gravestones);
CreateObject(Rule_Gravestones)->SetFadeOut(3 * 36);
return;
}
@ -76,53 +78,64 @@ public func GetAttackWave(int nr)
Name = "$MsgWave$",
// Waves last shorter as the number increases.
Duration = BoundBy(120 - nr / 3, 20, 120),
Bounty = 100,
Score = 100,
Bounty = 50,
Score = 50,
Enemies = []
};
// Add enemy ground troups: swordsman, archer or spearman.
if (nr % 3 == 0)
{
PushBack(wave.Enemies, new DefenseEnemy.Swordsman {
Amount = BoundBy(nr - 1, 1, 20),
Energy = BoundBy(20 + nr, 30, 100),
Position = pos_land
});
}
if (nr % 3 == 1)
{
PushBack(wave.Enemies, new DefenseEnemy.Archer {
Amount = BoundBy(nr - 1, 1, 20),
Energy = BoundBy(10 + nr, 20, 50),
Position = pos_land
});
}
if (nr % 3 == 2)
{
PushBack(wave.Enemies, new DefenseEnemy.Spearman {
Amount = BoundBy(nr - 1, 1, 20),
Energy = BoundBy(10 + nr, 20, 50),
Position = pos_land
});
}
PushBack(wave.Enemies, new DefenseEnemy.Swordsman {
Amount = BoundBy((nr + 2) / 4, 0, 20),
Energy = BoundBy(20 + nr, 30, 100),
Position = pos_land
});
PushBack(wave.Enemies, new DefenseEnemy.Archer {
Amount = BoundBy((nr + 1) / 4, 0, 20),
Energy = BoundBy(10 + nr, 20, 50),
Position = pos_land
});
PushBack(wave.Enemies, new DefenseEnemy.Spearman {
Amount = BoundBy(nr / 4, 0, 20),
Energy = BoundBy(10 + nr, 20, 50),
Position = pos_land
});
PushBack(wave.Enemies, new DefenseEnemy.Grenadier {
Amount = BoundBy((nr - 1) / 4, 0, 20),
Energy = BoundBy(25 + nr, 30, 80),
Position = pos_land
});
// Add enemy: boom attack.
PushBack(wave.Enemies, new DefenseEnemy.BoomAttack {
Amount = BoundBy(nr - 1, 1, 20),
Amount = BoundBy(nr / 2 + 1, 1, 20),
Speed = BoundBy(80 + nr * 5, 100, 250),
Position = pos_sky
});
// Add enemy: rocketeer.
// Add enemy: rocketeer with bow.
PushBack(wave.Enemies, new DefenseEnemy.Rocketeer {
Amount = BoundBy(nr - 1, 1, 20),
Amount = BoundBy(nr / 2, 1, 20),
Inventory = [Bow, RandomElement([Arrow, FireArrow, BombArrow])],
Position = pos_sky
});
// Add enemy: rocketeer with blunderbuss.
if (nr > 4)
{
PushBack(wave.Enemies, new DefenseEnemy.Rocketeer {
Amount = BoundBy(nr / 2 - 2, 1, 20),
Inventory = [Blunderbuss, LeadBullet],
Position = pos_sky
});
}
return wave;
}
// The attackers should go for flagpoles.
public func GiveRandomAttackTarget(object attacker)
{
return FindObject(Find_Category(C4D_Structure), Find_Func("IsFlagpole"), Find_Hostile(attacker->GetController()), Sort_Random());
var target = FindObject(Find_Category(C4D_Structure), Find_Func("IsFlagpole"), Find_Hostile(attacker->GetController()), Sort_Random());
if (target)
return target;
target = FindObject(Find_OCF(OCF_CrewMember), Find_Hostile(attacker->GetController()), Sort_Distance());
if (target)
return target;
return;
}

View File

@ -4,16 +4,19 @@ global func GivePlayerBaseMaterial(int plr)
{
var base_mats = [
// Clonks & health.
[Clonk, 20, 10],
[Bread, 20, 10],
[Clonk, 20, 20],
[Bread, 20, 20],
// Materials & mining.
[Wood, 16, 8],
[Metal, 16, 8],
[Rock, 16, 8],
[Wood, 16, 12],
[Metal, 16, 12],
[Rock, 16, 12],
[Ore, 16, 12],
[Coal, 16, 12],
[Loam, 12, 8],
[Firestone, 12, 8],
[Cloth, 8, 4],
[Loam, 8, 4],
[Firestone, 8, 4],
[Dynamite, 8, 4],
[DynamiteBox, 8, 4],
// Essential tools.
[Shovel, 4, 4],
[Hammer, 2, 2],
@ -35,18 +38,19 @@ global func GivePlayerBaseMaterial(int plr)
[Boompack, 1, 1],
// Weapons.
[Bow, 2, 1],
[Arrow, 8, 8],
[Arrow, 12, 8],
[Shield, 2, 1],
[Javelin, 2, 1],
[Club, 2, 1],
[Sword, 2, 1],
[Helmet, 2, 1],
// Advanced weapons.
[FireArrow, 2, 2],
[BombArrow, 2, 2],
[FireArrow, 6, 4],
[BombArrow, 6, 4],
[Blunderbuss, 2, 1],
[LeadBullet, 4, 4],
[LeadBullet, 8, 8],
[GrenadeLauncher, 1, 1],
[IronBomb, 4, 4],
[IronBomb, 6, 6],
[SmokeBomb, 2, 2],
[Lantern, 2, 2],
[Catapult, 1, 1],