Add a bonus to units on walls + disable placing units on palisades (which was enabled by accident due to inheritance)

This was SVN commit r15249.
This commit is contained in:
sanderd17 2014-05-31 11:02:58 +00:00
parent f5c5bbe26d
commit 8ef7278306
7 changed files with 53 additions and 0 deletions

View file

@ -14,6 +14,7 @@ Auras.prototype.Schema =
"<value a:help='Affects units in the same formation'>formation</value>" +
"<value a:help='Affects units in a certain range'>range</value>" +
"<value a:help='Affects the structure or unit this unit is garrisoned in'>garrison</value>" +
"<value a:help='Affects the units that are garrisoned on a certain structure'>garrisonedUnits</value>" +
"<value a:help='Affects all units while this unit is alive'>global</value>" +
"</choice>" +
"</element>" +
@ -96,6 +97,11 @@ Auras.prototype.HasGarrisonAura = function()
return this.GetAuraNames().some(this.IsGarrisonAura.bind(this));
};
Auras.prototype.HasGarrisonedUnitsAura = function()
{
return this.GetAuraNames().some(this.IsGarrisonedUnitsAura.bind(this));
};
Auras.prototype.GetType = function(name)
{
return this.template[name].Type;
@ -111,6 +117,11 @@ Auras.prototype.IsGarrisonAura = function(name)
return this.GetType(name) == "garrison";
};
Auras.prototype.IsGarrisonedUnitsAura = function(name)
{
return this.GetType(name) == "garrisonedUnits";
};
Auras.prototype.IsRangeAura = function(name)
{
// A global aura is also treated as a range aura with infinite range.
@ -237,6 +248,20 @@ Auras.prototype.OnRangeUpdate = function(msg)
};
Auras.prototype.OnGarrisonedUnitsChanged = function(msg)
{
var auraNames = this.GetAuraNames();
for each (var name in auraNames)
{
if (!this.IsGarrisonedUnitsAura(name))
continue;
for each (var ent in msg.added)
this.ApplyBonus(name, ent);
for each (var ent in msg.removed)
this.RemoveBonus(name, ent);
}
};
Auras.prototype.ApplyFormationBonus = function(memberList)
{
var auraNames = this.GetAuraNames();

View file

@ -0,0 +1,5 @@
{
"affects":["Unit"],
"affectedPlayers":["Player", "Ally"],
"modifications":[{"value":"Armour/Pierce","add":3},{"value":"Armour/Hack","add":3},{"value":"Armour/Crush","add":3}]
}

View file

@ -0,0 +1,5 @@
{
"affects":["Unit"],
"affectedPlayers":["Player","Ally"],
"modifications":[{"value":"Vision/Range","add":20}]
}

View file

@ -11,6 +11,7 @@
<Square width="15" depth="3.0"/>
<Height>9.0</Height>
</Footprint>
<GarrisonHolder disable=""/>
<Health>
<Max>1000</Max>
<SpawnEntityOnDeath>rubble/rubble_1x3pal</SpawnEntityOnDeath>

View file

@ -11,6 +11,7 @@
<Square width="11" depth="3.0"/>
<Height>9.0</Height>
</Footprint>
<GarrisonHolder disable=""/>
<Health>
<Max>1000</Max>
<SpawnEntityOnDeath>rubble/rubble_1x3pal</SpawnEntityOnDeath>

View file

@ -1,5 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_structure_defense_wall">
<Auras>
<unit_armor_3>
<Type>garrisonedUnits</Type>
</unit_armor_3>
<unit_vision_20>
<Type>garrisonedUnits</Type>
</unit_vision_20>
</Auras>
<Cost>
<BuildTime>30</BuildTime>
<Resources>

View file

@ -1,5 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_structure_defense_wall">
<Auras>
<unit_armor_3>
<Type>garrisonedUnits</Type>
</unit_armor_3>
<unit_vision_20>
<Type>garrisonedUnits</Type>
</unit_vision_20>
</Auras>
<Cost>
<BuildTime>20</BuildTime>
<Resources>