Ticket #3196: limitArrows.diff
File limitArrows.diff, 11.0 KB (added by , 8 years ago) |
---|
-
binaries/data/mods/public/gui/text/tips/celtic_war_barge.txt
1 1 CELTIC WAR BARGE 2 2 - A medium "trireme"-class warship. 3 3 4 - The only ship of its kind.4 - Available to the Celtic Factions (Birtons, Gauls), Mauryans and Iberians. 5 5 6 - Can transport up to 40 units across the waters. 7 8 - Increases firepower with garrissoned infantry. 9 6 10 - Cannot ram, like other triremes, but has greater health and armour. 7 11 8 - Can transport up to 40 units across the waters.9 No newline at end of file -
binaries/data/mods/public/gui/text/tips/fishing.txt
1 1 FISHING 2 2 - Fish the seas for a bountiful harvest. 3 3 4 - Fishing boats carry a large amount of Food per trip.4 - Fishing boats carry a large amount of food per trip. 5 5 6 - Garrison a Support Unit aboard to double the Fishing Boat's gathering rate.6 - Fishing is faster than gathering food on fields. 7 7 8 - Careful! Fish are not an infinite resource! 9 No newline at end of file 8 - Garrison a support unit aboard to double the fishing boat's gathering rate. 9 10 - Careful! Fish are not an infinite resource! -
binaries/data/mods/public/gui/text/tips/quinquereme.txt
1 1 HEAVY WARSHIP 2 2 - The heaviest standard warship. Available to: Rome, Carthage, Ptolemies, and Seleucids. 3 3 4 - Garrison ballistas to increase fire power.4 - Transports up to 50 units. 5 5 6 - Increases firepower with garrissoned catapults. 7 6 8 - Has a ramming attack that sinks enemy ships (NOT IMPLEMENTED YET). -
binaries/data/mods/public/simulation/components/BuildingAI.js
8 8 "<element name='DefaultArrowCount'>" + 9 9 "<data type='nonNegativeInteger'/>" + 10 10 "</element>" + 11 "<optional>" + 12 "<element name='MaxArrowCount' a:help='Limit the number of arrows to a certain amount'>" + 13 "<data type='nonNegativeInteger'/>" + 14 "</element>" + 15 "</optional>" + 11 16 "<element name='GarrisonArrowMultiplier'>" + 12 17 "<ref name='nonNegativeDecimal'/>" + 13 18 "</element>" + 14 "<element name='GarrisonArrowClasses' >" +19 "<element name='GarrisonArrowClasses' a:help='Add extra arrows for this class list'>" + 15 20 "<text/>" + 16 21 "</element>"; 17 22 … … 20 25 BuildingAI.prototype.Init = function() 21 26 { 22 27 this.currentRound = 0; 28 this.archersGarrisoned = 0; 23 29 this.arrowsLeft = 0; 24 30 this.targetUnits = []; 25 31 }; 26 32 33 BuildingAI.prototype.OnGarrisonedUnitsChanged = function(msg) 34 { 35 let classes = this.GetGarrisonArrowClasses(); 36 for (let ent of msg.added) 37 { 38 let cmpIdentity = Engine.QueryInterface(ent, IID_Identity); 39 if (!cmpIdentity) 40 continue; 41 if (MatchesClassList(cmpIdentity.GetClassesList(), classes)) 42 ++this.archersGarrisoned; 43 } 44 45 for (let ent of msg.removed) 46 { 47 let cmpIdentity = Engine.QueryInterface(ent, IID_Identity); 48 if (!cmpIdentity) 49 continue; 50 if (MatchesClassList(cmpIdentity.GetClassesList(), classes)) 51 --this.archersGarrisoned; 52 } 53 }; 54 27 55 BuildingAI.prototype.OnOwnershipChanged = function(msg) 28 56 { 29 57 this.targetUnits = []; … … 198 226 return ApplyValueModificationsToEntity("BuildingAI/DefaultArrowCount", arrowCount, this.entity); 199 227 }; 200 228 229 BuildingAI.prototype.GetMaxArrowCount = function() 230 { 231 if (!this.template.MaxArrowCount) 232 return undefined; 233 234 let maxArrowCount = +this.template.MaxArrowCount; 235 return Math.round(ApplyValueModificationsToEntity("BuildingAI/MaxArrowCount", maxArrowCount, this.entity)); 236 }; 237 201 238 BuildingAI.prototype.GetGarrisonArrowMultiplier = function() 202 239 { 203 240 var arrowMult = +this.template.GarrisonArrowMultiplier; … … 206 243 207 244 BuildingAI.prototype.GetGarrisonArrowClasses = function() 208 245 { 209 var string = this.template.GarrisonArrowClasses; 210 if (string) 211 return string.split(/\s+/); 212 return []; 246 return this.template.GarrisonArrowClasses; 213 247 }; 214 248 215 249 /** … … 223 257 224 258 let cmpGarrisonHolder = Engine.QueryInterface(this.entity, IID_GarrisonHolder); 225 259 if (cmpGarrisonHolder) 226 count += Math.round( cmpGarrisonHolder.GetGarrisonedArcherCount(this.GetGarrisonArrowClasses())* this.GetGarrisonArrowMultiplier());260 count += Math.round(this.archersGarrisoned * this.GetGarrisonArrowMultiplier()); 227 261 262 if (this.GetMaxArrowCount() < count) 263 return this.GetMaxArrowCount(); 228 264 return count; 229 265 }; 230 266 -
binaries/data/mods/public/simulation/components/GarrisonHolder.js
188 188 }; 189 189 190 190 /** 191 * Get number of garrisoned units capable of shooting arrows192 * Not necessarily archers193 */194 GarrisonHolder.prototype.GetGarrisonedArcherCount = function(garrisonArrowClasses)195 {196 var count = 0;197 for each (var entity in this.entities)198 {199 var cmpIdentity = Engine.QueryInterface(entity, IID_Identity);200 var classes = cmpIdentity.GetClassesList();201 if (classes.some(c => garrisonArrowClasses.indexOf(c) > -1))202 count++;203 }204 return count;205 };206 207 /**208 191 * Checks if an entity can be allowed to garrison in the building 209 192 * based on its class 210 193 */ -
binaries/data/mods/public/simulation/templates/structures/ptol_military_colony.xml
15 15 </Attack> 16 16 <BuildingAI> 17 17 <DefaultArrowCount>1</DefaultArrowCount> 18 <MaxArrowCount>11</MaxArrowCount> 18 19 <GarrisonArrowMultiplier>1</GarrisonArrowMultiplier> 19 20 </BuildingAI> 20 21 <BuildRestrictions> -
binaries/data/mods/public/simulation/templates/structures/rome_army_camp.xml
24 24 </Ranged> 25 25 </Attack> 26 26 <BuildingAI> 27 <DefaultArrowCount>3</DefaultArrowCount> 28 <GarrisonArrowMultiplier>0.5</GarrisonArrowMultiplier> 27 <DefaultArrowCount>1</DefaultArrowCount> 28 <MaxArrowCount>11</MaxArrowCount> 29 <GarrisonArrowMultiplier>1</GarrisonArrowMultiplier> 29 30 </BuildingAI> 30 31 <BuildRestrictions> 31 32 <Territory>own neutral enemy</Territory> -
binaries/data/mods/public/simulation/templates/structures/sele_military_colony.xml
15 15 </Attack> 16 16 <BuildingAI> 17 17 <DefaultArrowCount>1</DefaultArrowCount> 18 <MaxArrowCount>11</MaxArrowCount> 18 19 <GarrisonArrowMultiplier>1</GarrisonArrowMultiplier> 19 20 </BuildingAI> 20 21 <BuildRestrictions> -
binaries/data/mods/public/simulation/templates/template_unit_mechanical_ship_bireme.xml
15 15 </Attack> 16 16 <BuildingAI> 17 17 <DefaultArrowCount>2</DefaultArrowCount> 18 <GarrisonArrowMultiplier>0.5</GarrisonArrowMultiplier> 18 <MaxArrowCount>7</MaxArrowCount> 19 <GarrisonArrowMultiplier>1</GarrisonArrowMultiplier> 19 20 <GarrisonArrowClasses>Infantry Ranged</GarrisonArrowClasses> 20 21 </BuildingAI> 21 22 <Cost> … … 45 46 <Identity> 46 47 <GenericName>Light Warship</GenericName> 47 48 <Classes datatype="tokens">Warship Light Bow Ranged</Classes> 48 <RequiredTechnology>phase_town</RequiredTechnology> 49 <RequiredTechnology>phase_town</RequiredTechnology> 50 <Tooltip>Garrison up to 20 units for transport. Garrison increases the firepower up to 7 arrows.</Tooltip> 49 51 </Identity> 50 52 <ResourceGatherer disable=""/> 51 53 <Sound> -
binaries/data/mods/public/simulation/templates/template_unit_mechanical_ship_quinquereme.xml
23 23 </Attack> 24 24 <BuildingAI> 25 25 <DefaultArrowCount>1</DefaultArrowCount> 26 <MaxArrowCount>10</MaxArrowCount> 26 27 <GarrisonArrowMultiplier>1</GarrisonArrowMultiplier> 27 28 <GarrisonArrowClasses>Catapult</GarrisonArrowClasses> 28 29 </BuildingAI> … … 52 53 </Health> 53 54 <Identity> 54 55 <GenericName>Heavy Warship</GenericName> 55 <Tooltip>Garrison with catapults to increase rangedfire power.</Tooltip>56 <Tooltip>Garrison up to 10 catapults to increase fire power.</Tooltip> 56 57 <Classes datatype="tokens">Warship Heavy Ranged</Classes> 57 58 <RequiredTechnology>phase_city</RequiredTechnology> 58 59 </Identity> -
binaries/data/mods/public/simulation/templates/template_unit_mechanical_ship_trireme.xml
15 15 </Attack> 16 16 <BuildingAI> 17 17 <DefaultArrowCount>3</DefaultArrowCount> 18 <GarrisonArrowMultiplier>0.5</GarrisonArrowMultiplier> 18 <MaxArrowCount>13</MaxArrowCount> 19 <GarrisonArrowMultiplier>1</GarrisonArrowMultiplier> 19 20 <GarrisonArrowClasses>Infantry Ranged</GarrisonArrowClasses> 20 21 </BuildingAI> 21 22 <Cost> … … 46 47 <GenericName>Medium Warship</GenericName> 47 48 <VisibleClasses datatype="tokens">Warship Medium Ranged</VisibleClasses> 48 49 <RequiredTechnology>phase_town</RequiredTechnology> 50 <Tooltip>Garrison up to 30 units for transport. Garrison increases the firepower up to 13 arrows.</Tooltip> 49 51 </Identity> 50 52 <ResourceGatherer disable=""/> 51 53 <Sound>