Ticket #1652: skittish.patch
File skittish.patch, 2.0 KB (added by , 12 years ago) |
---|
-
data/mods/public/simulation/components/Attack.js
276 276 const isPreferred = function (value, i, a) { return attack.GetPreferredClasses(value).some(isTargetClass); } 277 277 const byPreference = function (a, b) { return (types.indexOf(a) + (isPreferred(a) ? types.length : 0) ) - (types.indexOf(b) + (isPreferred(b) ? types.length : 0) ); } 278 278 279 return types.filter(isAllowed).sort(byPreference).pop(); 279 const bestAttackAgainst = types.filter(isAllowed).sort(byPreference).pop(); 280 281 //Have ranged attacker use a melee attack on nonskittish animals. Otherwise it is too difficult for ranged attackers to kill. 282 const targetNotSkittish = cmpIdentity.HasClass("Animal") && (Engine.QueryInterface(target, IID_UnitAI).template.NaturalBehaviour!="skittish"); 283 if (bestAttackAgainst == "Ranged" && targetNotSkittish) 284 return "Melee"; 285 286 return bestAttackAgainst; 280 287 }; 281 288 282 289 Attack.prototype.CompareEntitiesByPreference = function(a, b) … … 642 649 // Remove the projectile 643 650 var cmpProjectileManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_ProjectileManager); 644 651 cmpProjectileManager.RemoveProjectile(data.projectileId); 652 645 653 } 646 654 } 647 655 } -
data/mods/public/simulation/templates/template_unit_cavalry_ranged.xml
14 14 <RestrictedClasses datatype="tokens">StoneWall</RestrictedClasses> 15 15 <Spread>1.6</Spread> 16 16 </Ranged> 17 <Melee> 18 <Hack>5.0</Hack> 19 <Pierce>15.0</Pierce> 20 <Crush>0.0</Crush> 21 <MaxRange>6.0</MaxRange> 22 <RepeatTime>1000</RepeatTime> 23 </Melee> 17 24 </Attack> 18 25 <Identity> 19 26 <GenericName>Ranged Cavalry</GenericName>