forked from 0ad/0ad
Limit arrows on certain buildings and ships. Patch by sanderd17, fixes #3196.
Balancing by elexis, reverts fcf7344537
in favor of the new total arrow
limit.
This was SVN commit r17882.
This commit is contained in:
parent
042c9a9334
commit
d84ad7799a
@ -1,8 +1,11 @@
|
||||
CELTIC WAR BARGE
|
||||
- A medium "trireme"-class warship.
|
||||
|
||||
- The only ship of its kind.
|
||||
- Available to the Celtic Factions (Birtons, Gauls), Mauryans and Iberians.
|
||||
|
||||
- Can transport up to 40 units across the waters.
|
||||
|
||||
- Increases firepower with garrissoned infantry.
|
||||
|
||||
- Cannot ram, like other triremes, but has greater health and armour.
|
||||
|
||||
- Can transport up to 40 units across the waters.
|
@ -1,8 +1,10 @@
|
||||
FISHING
|
||||
- Fish the seas for a bountiful harvest.
|
||||
|
||||
- Fishing boats carry a large amount of Food per trip.
|
||||
- Fishing boats carry a large amount of food per trip.
|
||||
|
||||
- Garrison a Support Unit aboard to double the Fishing Boat's gathering rate.
|
||||
- Fishing is faster than gathering food on fields.
|
||||
|
||||
- Careful! Fish are not an infinite resource!
|
||||
- Garrison a support unit aboard to double the fishing boat's gathering rate.
|
||||
|
||||
- Careful! Fish are not an infinite resource!
|
||||
|
@ -1,6 +1,8 @@
|
||||
HEAVY WARSHIP
|
||||
- The heaviest standard warship. Available to: Rome, Carthage, Ptolemies, and Seleucids.
|
||||
|
||||
- Garrison ballistas to increase fire power.
|
||||
- Transports up to 50 units.
|
||||
|
||||
- Increases firepower with garrissoned catapults.
|
||||
|
||||
- Has a ramming attack that sinks enemy ships (NOT IMPLEMENTED YET).
|
||||
|
@ -8,10 +8,15 @@ BuildingAI.prototype.Schema =
|
||||
"<element name='DefaultArrowCount'>" +
|
||||
"<data type='nonNegativeInteger'/>" +
|
||||
"</element>" +
|
||||
"<optional>" +
|
||||
"<element name='MaxArrowCount' a:help='Limit the number of arrows to a certain amount'>" +
|
||||
"<data type='nonNegativeInteger'/>" +
|
||||
"</element>" +
|
||||
"</optional>" +
|
||||
"<element name='GarrisonArrowMultiplier'>" +
|
||||
"<ref name='nonNegativeDecimal'/>" +
|
||||
"</element>" +
|
||||
"<element name='GarrisonArrowClasses'>" +
|
||||
"<element name='GarrisonArrowClasses' a:help='Add extra arrows for this class list'>" +
|
||||
"<text/>" +
|
||||
"</element>";
|
||||
|
||||
@ -20,10 +25,34 @@ BuildingAI.prototype.MAX_PREFERENCE_BONUS = 2;
|
||||
BuildingAI.prototype.Init = function()
|
||||
{
|
||||
this.currentRound = 0;
|
||||
this.archersGarrisoned = 0;
|
||||
this.arrowsLeft = 0;
|
||||
this.targetUnits = [];
|
||||
};
|
||||
|
||||
BuildingAI.prototype.OnGarrisonedUnitsChanged = function(msg)
|
||||
{
|
||||
let classes = this.template.GarrisonArrowClasses;
|
||||
|
||||
for (let ent of msg.added)
|
||||
{
|
||||
let cmpIdentity = Engine.QueryInterface(ent, IID_Identity);
|
||||
if (!cmpIdentity)
|
||||
continue;
|
||||
if (MatchesClassList(cmpIdentity.GetClassesList(), classes))
|
||||
++this.archersGarrisoned;
|
||||
}
|
||||
|
||||
for (let ent of msg.removed)
|
||||
{
|
||||
let cmpIdentity = Engine.QueryInterface(ent, IID_Identity);
|
||||
if (!cmpIdentity)
|
||||
continue;
|
||||
if (MatchesClassList(cmpIdentity.GetClassesList(), classes))
|
||||
--this.archersGarrisoned;
|
||||
}
|
||||
};
|
||||
|
||||
BuildingAI.prototype.OnOwnershipChanged = function(msg)
|
||||
{
|
||||
this.targetUnits = [];
|
||||
@ -198,6 +227,15 @@ BuildingAI.prototype.GetDefaultArrowCount = function()
|
||||
return ApplyValueModificationsToEntity("BuildingAI/DefaultArrowCount", arrowCount, this.entity);
|
||||
};
|
||||
|
||||
BuildingAI.prototype.GetMaxArrowCount = function()
|
||||
{
|
||||
if (!this.template.MaxArrowCount)
|
||||
return undefined;
|
||||
|
||||
let maxArrowCount = +this.template.MaxArrowCount;
|
||||
return Math.round(ApplyValueModificationsToEntity("BuildingAI/MaxArrowCount", maxArrowCount, this.entity));
|
||||
};
|
||||
|
||||
BuildingAI.prototype.GetGarrisonArrowMultiplier = function()
|
||||
{
|
||||
var arrowMult = +this.template.GarrisonArrowMultiplier;
|
||||
@ -223,8 +261,10 @@ BuildingAI.prototype.GetArrowCount = function()
|
||||
|
||||
let cmpGarrisonHolder = Engine.QueryInterface(this.entity, IID_GarrisonHolder);
|
||||
if (cmpGarrisonHolder)
|
||||
count += Math.round(cmpGarrisonHolder.GetGarrisonedArcherCount(this.GetGarrisonArrowClasses()) * this.GetGarrisonArrowMultiplier());
|
||||
count += Math.round(this.archersGarrisoned * this.GetGarrisonArrowMultiplier());
|
||||
|
||||
if (this.GetMaxArrowCount() < count)
|
||||
return this.GetMaxArrowCount();
|
||||
return count;
|
||||
};
|
||||
|
||||
|
@ -187,23 +187,6 @@ GarrisonHolder.prototype.GetGarrisonedEntitiesCount = function()
|
||||
return count;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get number of garrisoned units capable of shooting arrows
|
||||
* Not necessarily archers
|
||||
*/
|
||||
GarrisonHolder.prototype.GetGarrisonedArcherCount = function(garrisonArrowClasses)
|
||||
{
|
||||
var count = 0;
|
||||
for each (var entity in this.entities)
|
||||
{
|
||||
var cmpIdentity = Engine.QueryInterface(entity, IID_Identity);
|
||||
var classes = cmpIdentity.GetClassesList();
|
||||
if (classes.some(c => garrisonArrowClasses.indexOf(c) > -1))
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks if an entity can be allowed to garrison in the building
|
||||
* based on its class
|
||||
|
@ -15,6 +15,7 @@
|
||||
</Attack>
|
||||
<BuildingAI>
|
||||
<DefaultArrowCount>1</DefaultArrowCount>
|
||||
<MaxArrowCount>15</MaxArrowCount>
|
||||
<GarrisonArrowMultiplier>1</GarrisonArrowMultiplier>
|
||||
</BuildingAI>
|
||||
<BuildRestrictions>
|
||||
|
@ -24,8 +24,9 @@
|
||||
</Ranged>
|
||||
</Attack>
|
||||
<BuildingAI>
|
||||
<DefaultArrowCount>3</DefaultArrowCount>
|
||||
<GarrisonArrowMultiplier>0.5</GarrisonArrowMultiplier>
|
||||
<DefaultArrowCount>1</DefaultArrowCount>
|
||||
<MaxArrowCount>15</MaxArrowCount>
|
||||
<GarrisonArrowMultiplier>1</GarrisonArrowMultiplier>
|
||||
</BuildingAI>
|
||||
<BuildRestrictions>
|
||||
<Territory>own neutral enemy</Territory>
|
||||
|
@ -15,6 +15,7 @@
|
||||
</Attack>
|
||||
<BuildingAI>
|
||||
<DefaultArrowCount>1</DefaultArrowCount>
|
||||
<MaxArrowCount>15</MaxArrowCount>
|
||||
<GarrisonArrowMultiplier>1</GarrisonArrowMultiplier>
|
||||
</BuildingAI>
|
||||
<BuildRestrictions>
|
||||
|
@ -15,7 +15,8 @@
|
||||
</Attack>
|
||||
<BuildingAI>
|
||||
<DefaultArrowCount>2</DefaultArrowCount>
|
||||
<GarrisonArrowMultiplier>0.5</GarrisonArrowMultiplier>
|
||||
<MaxArrowCount>10</MaxArrowCount>
|
||||
<GarrisonArrowMultiplier>1</GarrisonArrowMultiplier>
|
||||
<GarrisonArrowClasses>Infantry Ranged</GarrisonArrowClasses>
|
||||
</BuildingAI>
|
||||
<Cost>
|
||||
@ -45,7 +46,8 @@
|
||||
<Identity>
|
||||
<GenericName>Light Warship</GenericName>
|
||||
<Classes datatype="tokens">Warship Light Bow Ranged</Classes>
|
||||
<RequiredTechnology>phase_town</RequiredTechnology>
|
||||
<RequiredTechnology>phase_town</RequiredTechnology>
|
||||
<Tooltip>Garrison up to 20 units for transport. Garrison increases the firepower up to 10 arrows.</Tooltip>
|
||||
</Identity>
|
||||
<ResourceGatherer disable=""/>
|
||||
<Sound>
|
||||
|
@ -23,6 +23,7 @@
|
||||
</Attack>
|
||||
<BuildingAI>
|
||||
<DefaultArrowCount>1</DefaultArrowCount>
|
||||
<MaxArrowCount>10</MaxArrowCount>
|
||||
<GarrisonArrowMultiplier>1</GarrisonArrowMultiplier>
|
||||
<GarrisonArrowClasses>Catapult</GarrisonArrowClasses>
|
||||
</BuildingAI>
|
||||
@ -52,7 +53,7 @@
|
||||
</Health>
|
||||
<Identity>
|
||||
<GenericName>Heavy Warship</GenericName>
|
||||
<Tooltip>Garrison with catapults to increase ranged fire power.</Tooltip>
|
||||
<Tooltip>Garrison up to 10 catapults to increase fire power.</Tooltip>
|
||||
<Classes datatype="tokens">Warship Heavy Ranged</Classes>
|
||||
<RequiredTechnology>phase_city</RequiredTechnology>
|
||||
</Identity>
|
||||
|
@ -15,7 +15,8 @@
|
||||
</Attack>
|
||||
<BuildingAI>
|
||||
<DefaultArrowCount>3</DefaultArrowCount>
|
||||
<GarrisonArrowMultiplier>0.5</GarrisonArrowMultiplier>
|
||||
<MaxArrowCount>13</MaxArrowCount>
|
||||
<GarrisonArrowMultiplier>1</GarrisonArrowMultiplier>
|
||||
<GarrisonArrowClasses>Infantry Ranged</GarrisonArrowClasses>
|
||||
</BuildingAI>
|
||||
<Cost>
|
||||
@ -46,6 +47,7 @@
|
||||
<GenericName>Medium Warship</GenericName>
|
||||
<VisibleClasses datatype="tokens">Warship Medium Ranged</VisibleClasses>
|
||||
<RequiredTechnology>phase_town</RequiredTechnology>
|
||||
<Tooltip>Garrison up to 30 units for transport. Garrison increases the firepower up to 13 arrows.</Tooltip>
|
||||
</Identity>
|
||||
<ResourceGatherer disable=""/>
|
||||
<Sound>
|
||||
|
Loading…
Reference in New Issue
Block a user