new AttackLoyalty, range and stay alive option for Capture

AttackLoyalty for d2k Deviator which captures units
also shooting a fake missile (see issue #2251)

CaptureActor now supports Generals styles gameplay
but is disabled by default (see issue #2274)
fixes the annoyance that engineers will not take
the shortest root to the building by the way

removing ProvidesCustomPrerequisite because it's
tooltip messages relies on hardcoded hacks
This commit is contained in:
Matthias Mailänder
2012-06-30 17:06:29 +02:00
committed by Chris Forbes
parent c2321e3eea
commit e89ee2c131
13 changed files with 286 additions and 92 deletions

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2012 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
@@ -10,6 +10,7 @@
using System.Linq;
using OpenRA.Traits;
using OpenRA.Mods.RA.Move;
namespace OpenRA.Mods.RA.Activities
{
@@ -25,9 +26,6 @@ namespace OpenRA.Mods.RA.Activities
if (target == null || !target.IsInWorld || target.IsDead()) return NextActivity;
if (target.Owner == self.Owner) return NextActivity;
if( !target.OccupiesSpace.OccupiedCells().Any( x => x.First == self.Location ) )
return NextActivity;
var capturable = target.TraitOrDefault<Capturable>();
if (capturable != null && capturable.CaptureInProgress && capturable.Captor.Owner.Stances[self.Owner] == Stance.Ally)
return NextActivity;
@@ -36,8 +34,14 @@ namespace OpenRA.Mods.RA.Activities
if (sellable != null && sellable.Selling)
return NextActivity;
target.Trait<Capturable>().BeginCapture(target, self);
self.World.AddFrameEndTask(w => self.Destroy());
var captures = self.TraitOrDefault<Captures>();
var capturesInfo = self.Info.Traits.Get<CapturesInfo>();
if (captures != null && Combat.IsInRange(self.CenterLocation, capturesInfo.Range, target))
target.Trait<Capturable>().BeginCapture(target, self);
else
return Util.SequenceActivities(self.Trait<Mobile>().MoveWithinRange(Target.FromActor(target), capturesInfo.Range), this);
if (capturesInfo != null && capturesInfo.wastedAfterwards)
self.World.AddFrameEndTask(w => self.Destroy());
return this;
}

View File

@@ -0,0 +1,43 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
*/
#endregion
using System;
using OpenRA.Traits;
using OpenRA.Mods.RA.Activities;
namespace OpenRA.Mods.RA
{
public class AttackLoyaltyInfo : AttackFrontalInfo
{
public override object Create(ActorInitializer init) { return new AttackLoyalty(init.self, this); }
}
public class AttackLoyalty : AttackFrontal
{
public AttackLoyalty(Actor self, AttackLoyaltyInfo info)
: base( self, info ) {}
public override void DoAttack(Actor self, Target target)
{
if (!CanAttack (self, target)) return;
var weapon = Weapons[0].Info;
if (!Combat.IsInRange(self.CenterLocation, weapon.Range, target)) return;
var move = self.TraitOrDefault<IMove>();
var facing = self.TraitOrDefault<IFacing>();
foreach (var w in Weapons)
w.CheckFire(self, this, move, facing, target);
if (target.Actor != null)
target.Actor.ChangeOwner(self.Owner);
}
}
}

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2012 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
@@ -22,6 +22,8 @@ namespace OpenRA.Mods.RA
class CapturesInfo : ITraitInfo
{
public string[] CaptureTypes = {"building"};
public int Range = 3;
public bool wastedAfterwards = true;
public object Create(ActorInitializer init) { return new Captures(init.self, this); }
}
@@ -40,7 +42,7 @@ namespace OpenRA.Mods.RA
{
get
{
yield return new CaptureOrderTargeter(Info.CaptureTypes, target => CanEnter(target));
yield return new CaptureOrderTargeter(Info.CaptureTypes, target => CanCapture(target));
}
}
@@ -55,24 +57,23 @@ namespace OpenRA.Mods.RA
public string VoicePhraseForOrder(Actor self, Order order)
{
return (order.OrderString == "CaptureActor"
&& CanEnter(order.TargetActor)) ? "Attack" : null;
&& CanCapture(order.TargetActor)) ? "Attack" : null;
}
public void ResolveOrder(Actor self, Order order)
{
if (order.OrderString == "CaptureActor")
{
if (!CanEnter(order.TargetActor)) return;
if (!CanCapture(order.TargetActor)) return;
self.SetTargetLine(Target.FromOrder(order), Color.Red);
self.CancelActivity();
self.QueueActivity(new Enter(order.TargetActor));
self.QueueActivity(new CaptureActor(order.TargetActor));
}
}
bool CanEnter(Actor target)
bool CanCapture(Actor target)
{
var c = target.TraitOrDefault<Capturable>();
return c != null && ( !c.CaptureInProgress || c.Captor.Owner.Stances[self.Owner] != Stance.Ally );
@@ -104,9 +105,11 @@ namespace OpenRA.Mods.RA
IsQueued = forceQueued;
var Info = self.Info.Traits.Get<CapturesInfo>();
if (captureTypes.Contains(ci.Type))
{
cursor = useEnterCursor(target) ? "enter" : "enter-blocked";
cursor = (Info.wastedAfterwards) ? (useEnterCursor(target) ? "enter" : "enter-blocked") : "attack";
return true;
}

View File

@@ -127,6 +127,7 @@
<Compile Include="Attack\AttackBase.cs" />
<Compile Include="Attack\AttackFrontal.cs" />
<Compile Include="Attack\AttackLeap.cs" />
<Compile Include="Attack\AttackLoyalty.cs" />
<Compile Include="Attack\AttackMedic.cs" />
<Compile Include="Attack\AttackOmni.cs" />
<Compile Include="Attack\AttackPopupTurreted.cs" />

View File

@@ -23,12 +23,10 @@
# create a shellmap (currently just a blank placeholder)
# rework chrome UI, dialoges, tabs
# add sonic tank weapon (currently uses tesla)
# make deviator change the allegiance of ememy units (currently shoots rockets)
# starport prices should vary
# black spots on buildings should be fading team colors
# gamefile extraction (setup/setup.z) from CD fails
# support patch 1.06 gamefiles: DATA.R8 has more frames and currently fails to extract, also featuring new terrain with white houses and new unit: grenade thrower
# infantry-only areas (Rough) do not show the dark-green mouse cursor
# put TilesetBuilder.Export into OpenRA.Utility to call the functions directly when extracting game-files (instead of opening a GUI)
# group number metrics are off
# add bibs

View File

@@ -1,16 +1,14 @@
CARRYALL:
^CARRYALL:
Inherits: ^Helicopter
Buildable:
Queue: Plane
BuildPaletteOrder: 110
Prerequisites: anyhightech
BuiltAt: hightecha
Owner: atreides,harkonnen,ordos
Valued:
Cost: 1200
Tooltip:
Name: Carryall
Description: Fast drop ship.\n Unarmed
Icon: carryallicon
Health:
HP: 500
Armor:

View File

@@ -50,6 +50,60 @@ REFA:
Owner: atreides
RenderBuildingWarFactory:
Image: REFA
FreeActor:
Actor: HARVESTERA
InitialActivity: FindResources
SpawnOffset: 1,2
Facing: 64
HARVESTERA:
Inherits: ^HARVESTER
Buildable:
Prerequisites: heavya,refa
Owner: atreides
RenderUnit:
Image: HARVESTER
TRIKEA:
Inherits: ^TRIKE
Buildable:
Prerequisites: lighta
Owner: atreides
RenderUnit:
Image: TRIKE
QUADA:
Inherits: ^QUAD
Buildable:
Prerequisites: lighta
Owner: atreides
RenderUnit:
Image: QUAD
SIEGETANKA:
Inherits: ^SIEGETANK
Buildable:
Prerequisites: heavya, radara
Owner: atreides
RenderUnit:
Image: SIEGETANK
MISSILETANKA:
Inherits: ^MISSILETANK
Buildable:
Prerequisites: heavya
Owner: atreides
RenderUnit:
Image: MISSILETANK
CARRYALLA:
Inherits: ^CARRYALL
Buildable:
Prerequisites: hightecha
BuiltAt: hightecha
Owner: atreides
RenderUnit:
Image: CARRYALL
BARRA:
Inherits: ^BARRACKS

View File

@@ -32,6 +32,60 @@ REFH:
Owner: harkonnen
RenderBuildingWarFactory:
Image: REFH
FreeActor:
Actor: HARVESTERH
InitialActivity: FindResources
SpawnOffset: 1,2
Facing: 64
HARVESTERH:
Inherits: ^HARVESTER
Buildable:
Prerequisites: heavyh,refh
Owner: harkonnen
RenderUnit:
Image: HARVESTER
TRIKEH:
Inherits: ^TRIKE
Buildable:
Prerequisites: lighth
Owner: harkonnen
RenderUnit:
Image: TRIKE
QUADH:
Inherits: ^QUAD
Buildable:
Prerequisites: lighth
Owner: harkonnen
RenderUnit:
Image: QUAD
SIEGETANKH:
Inherits: ^SIEGETANK
Buildable:
Prerequisites: heavyh, radarh
Owner: harkonnen
RenderUnit:
Image: SIEGETANK
MISSILETANKH:
Inherits: ^MISSILETANK
Buildable:
Prerequisites: heavyh
Owner: harkonnen
RenderUnit:
Image: MISSILETANK
CARRYALLH:
Inherits: ^CARRYALL
Buildable:
Prerequisites: hightechh
BuiltAt: hightechh
Owner: harkonnen
RenderUnit:
Image: CARRYALL
BARRH:
Inherits: ^BARRACKS

View File

@@ -32,6 +32,11 @@ REFO:
Owner: ordos
RenderBuildingWarFactory:
Image: REFO
FreeActor:
Actor: HARVESTERO
InitialActivity: FindResources
SpawnOffset: 1,2
Facing: 64
BARRO:
Inherits: ^BARRACKS
@@ -160,6 +165,14 @@ MCVO:
RenderUnit:
Image: DMCV
HARVESTERO:
Inherits: ^HARVESTER
Buildable:
Prerequisites: heavyo,refo
Owner: ordos
RenderUnit:
Image: HARVESTER
COMBATO:
Inherits: ^COMBAT
Buildable:
@@ -171,7 +184,7 @@ RAIDER:
Buildable:
Queue: Vehicle
BuildPaletteOrder: 15
Prerequisites: anylight
Prerequisites: lighto
Owner: ordos
Valued:
Cost: 200
@@ -197,17 +210,50 @@ RAIDER:
SecondaryOffset: 0,0,0,-4
AutoTarget:
QUADO:
Inherits: ^QUAD
Buildable:
Prerequisites: lighto
Owner: ordos
RenderUnit:
Image: QUAD
SIEGETANKO:
Inherits: ^SIEGETANK
Buildable:
Prerequisites: heavyo, radaro
Owner: ordos
RenderUnit:
Image: SIEGETANK
MISSILETANKO:
Inherits: ^MISSILETANK
Buildable:
Prerequisites: heavyo
Owner: ordos
RenderUnit:
Image: MISSILETANK
CARRYALLO:
Inherits: ^CARRYALL
Buildable:
Prerequisites: hightecho
BuiltAt: hightecho
Owner: ordos
RenderUnit:
Image: CARRYALL
DEVIATORTANK:
Inherits: ^Tank
Valued:
Cost: 800
Tooltip:
Name: Deviator
Description: Long range artillery.\n Strong vs Infantry, Tanks, Air\n Weak vs Buildings
Description: Will cause no actual damage.\nFires a warhead which changes allegiances\n but does not effect buildings or tanks.
Buildable:
Queue: Vehicle
BuildPaletteOrder: 50
Prerequisites: anyheavy
Prerequisites: heavyo
Owner: ordos
Mobile:
Speed: 6
@@ -218,8 +264,12 @@ DEVIATORTANK:
RevealsShroud:
Range: 6
RenderUnit:
AttackFrontal:
PrimaryWeapon: MammothTusk
# Captures:
# CaptureTypes:
# Range: 5
# wastedAfterwards: false
AttackLoyalty:
PrimaryWeapon: FakeMissile
PrimaryLocalOffset: -7,2,0,0,25, 7,2,0,0,-25
PrimaryRecoil: 1
AutoTarget:

View File

@@ -41,8 +41,6 @@
Tooltip:
Name: Windtrap
Description: Provides power for other structures
ProvidesCustomPrerequisite:
Prerequisite: anypower
Building:
Power: 100
Footprint: xx xx xx
@@ -60,7 +58,6 @@
Buildable:
Queue: Building
BuildPaletteOrder: 30
Prerequisites: anypower
Hotkey: b
Valued:
Cost: 400
@@ -104,8 +101,6 @@
Tooltip:
Name: High Tech Factory
Description: Produces Carryalls
ProvidesCustomPrerequisite:
Prerequisite: anyhightech
Building:
Power: -30
Footprint: _x_ xxx xxx
@@ -180,9 +175,6 @@
Buildable:
Queue: Building
BuildPaletteOrder: 10
Prerequisites: anypower
ProvidesCustomPrerequisite:
Prerequisite: anyref
Valued:
Cost: 1400
Tooltip:
@@ -207,11 +199,6 @@
Capacity: 2000
CustomSellValue:
Value: 600
FreeActor:
Actor: HARVESTER
InitialActivity: FindResources
SpawnOffset: 1,2
Facing: 64
^SILO:
Inherits: ^Building
@@ -245,8 +232,6 @@
Buildable:
Queue: Building
BuildPaletteOrder: 50
ProvidesCustomPrerequisite:
Prerequisite: anylight
Valued:
Cost: 1000
Tooltip:
@@ -282,8 +267,6 @@
Buildable:
Queue: Building
BuildPaletteOrder: 50
ProvidesCustomPrerequisite:
Prerequisite: anyheavy
Valued:
Cost: 2000
Tooltip:
@@ -322,8 +305,6 @@
Buildable:
Queue: Building
BuildPaletteOrder: 60
ProvidesCustomPrerequisite:
Prerequisite: anyradar
Valued:
Cost: 1400
Tooltip:
@@ -349,8 +330,6 @@
Tooltip:
Name: Starport
Description: Provides a dropzone for vehicle reinforcements
ProvidesCustomPrerequisite:
Prerequisite: anystarport
Buildable:
Queue: Building
BuildPaletteOrder: 60

View File

@@ -207,21 +207,42 @@ CRATE:
SelectionShares: 2
NoBaseSelectionShares: 9001
Unit: mcvo
GiveUnitCrateAction@Trike:
GiveUnitCrateAction@TrikeA:
SelectionShares: 7
Unit: trike
GiveUnitCrateAction@Quad:
Unit: trikea
GiveUnitCrateAction@TrikeH:
SelectionShares: 7
Unit: trikeh
GiveUnitCrateAction@QuadA:
SelectionShares: 6
Unit: quad
Unit: quada
GiveUnitCrateAction@QuadH:
SelectionShares: 6
Unit: quadh
GiveUnitCrateAction@QuadO:
SelectionShares: 6
Unit: quado
GiveUnitCrateAction@Raider:
SelectionShares: 6
Unit: raider
GiveUnitCrateAction@SiegeTank:
GiveUnitCrateAction@SiegeTankA:
SelectionShares: 6
Unit: siegetank
GiveUnitCrateAction@MissileTank:
Unit: siegetanka
GiveUnitCrateAction@SiegeTankH:
SelectionShares: 6
Unit: missiletank
Unit: siegetankh
GiveUnitCrateAction@SiegeTankO:
SelectionShares: 6
Unit: siegetanko
GiveUnitCrateAction@MissileTankA:
SelectionShares: 6
Unit: missiletanka
GiveUnitCrateAction@MissileTankH:
SelectionShares: 6
Unit: missiletankh
GiveUnitCrateAction@MissileTankO:
SelectionShares: 6
Unit: missiletanko
GiveUnitCrateAction@CombatA:
SelectionShares: 5
Unit: combata

View File

@@ -27,18 +27,17 @@
Transforms:
TransformSounds: BUILD1.aud
HARVESTER:
^HARVESTER:
Inherits: ^Vehicle
Buildable:
Queue: Vehicle
BuildPaletteOrder: 10
Prerequisites: anyref,anyheavy
Owner: atreides,harkonnen,ordos
Valued:
Cost: 1100
Tooltip:
Name: Spice Harvester
Description: Collects Spice for processing.\n Unarmed
Icon: harvestericon
Selectable:
Priority: 7
Bounds: 42,42
@@ -62,18 +61,17 @@ HARVESTER:
Range: 4
-AttackMove:
TRIKE:
^TRIKE:
Inherits: ^Vehicle
Buildable:
Queue: Vehicle
BuildPaletteOrder: 15
Prerequisites: anylight
Owner: atreides,harkonnen
Valued:
Cost: 200
Tooltip:
Name: Scout Trike
Description: Weak Scout.\n Decent vs. Infantry
Icon: trikeicon
Selectable:
Bounds: 24,24
Health:
@@ -91,18 +89,17 @@ TRIKE:
PrimaryOffset: 0,0,0,-4
AutoTarget:
QUAD:
^QUAD:
Inherits: ^Vehicle
Buildable:
Queue: Vehicle
BuildPaletteOrder: 30
Prerequisites: anylight
Owner: atreides,harkonnen,ordos
Valued:
Cost: 400
Tooltip:
Name: Quad
Description: Fast scout vehicle, armed with \nrockets.\n Strong vs Vehicles\n Weak vs Infantry
Icon: quadicon
Health:
HP: 120
Armor:
@@ -154,18 +151,17 @@ QUAD:
Selectable:
Bounds: 30,30
SIEGETANK:
^SIEGETANK:
Inherits: ^Tank
Buildable:
Queue: Vehicle
BuildPaletteOrder: 80
Prerequisites: anyradar
Owner: atreides,harkonnen,ordos
Valued:
Cost: 600
Tooltip:
Name: Siege Tank
Description: Long-range artillery.\n Strong vs Infantry, Buildings\n Weak vs Tanks, Aircraft
Icon: siegetankicon
Health:
HP: 75
Armor:
@@ -189,18 +185,17 @@ SIEGETANK:
Selectable:
Bounds: 30,30
MISSILETANK:
^MISSILETANK:
Inherits: ^Tank
Valued:
Cost: 800
Tooltip:
Name: Missile Tank
Description: Long range artillery.\n Strong vs Infantry, Buildings\n Weak vs Tanks, Aircraft
Icon: missiletankicon
Buildable:
Queue: Vehicle
BuildPaletteOrder: 50
Prerequisites: anyheavy
Owner: atreides,harkonnen,ordos
Mobile:
Speed: 6
Health:

View File

@@ -239,36 +239,30 @@ TowerMissle:
SmudgeType: SandCrater, RockCrater
Damage: 25
MammothTusk:
ROF: 60
FakeMissile:
ROF: 90
Range: 8
Burst: 1
Report: MISSLE1
Burst: 2
ValidTargets: Ground, Air
Projectile: Missile
Speed: 30
Arm: 2
Projectile: Bullet
Speed: 35
High: true
Shadow: false
Proximity: true
# Trail: smokey
ContrailLength: 10
Inaccuracy: 3
Image: DRAGON
ROT: 5
RangeLimit: 40
Angle: .2
Inaccuracy: 70
Image: MISSILE
Trail: smokey
ContrailLength: 30
Warhead:
Spread: 6
Spread: 10
Versus:
None: 90%
Wood: 75%
Light: 60%
Heavy: 25%
Explosion: med_explosion
WaterExplosion: med_splash
InfDeath: 2
Wood: 0%
Heavy: 0%
Concrete: 0%
Explosion: large_explosion
WaterExplosion: large_splash
SmudgeType: SandCrater, RockCrater
Damage: 45
Damage: 0
ImpactSound: kaboom12
155mm:
ROF: 85