1
0
forked from 0ad/0ad

Use per 100 meters spread values. Fix a bit the related help. Change and use simpler template values. Units will be a bit more accurate. Reviewed by wraitii.

Differential Revision: https://code.wildfiregames.com/D361
This was SVN commit r19438.
This commit is contained in:
fatherbushido 2017-04-20 17:01:47 +00:00
parent 6401203116
commit 234513ae51
25 changed files with 28 additions and 44 deletions

View File

@ -134,7 +134,7 @@ Attack.prototype.Schema =
"<element name='ProjectileSpeed' a:help='Speed of projectiles (in metres per second)'>" +
"<ref name='positiveDecimal'/>" +
"</element>" +
"<element name='Spread' a:help='Radius over which missiles will tend to land (when shooting to the MaxRange). Roughly 2/3 will land inside this radius (in metres). Spread is linearly diminished as the target gets closer.'><ref name='nonNegativeDecimal'/></element>" +
"<element name='Spread' a:help='Standard deviation of the bivariate normal distribution of hits at 100 meters. A disk at 100 meters from the attacker with this radius (2x this radius, 3x this radius) is expected to include the landing points of 39.3% (86.5%, 98.9%) of the rounds.'><ref name='nonNegativeDecimal'/></element>" +
Attack.prototype.bonusesSchema +
Attack.prototype.preferredClassesSchema +
Attack.prototype.restrictedClassesSchema +
@ -477,7 +477,7 @@ Attack.prototype.PerformAttack = function(type, target)
// Add inaccuracy based on spread.
let distanceModifiedSpread = ApplyValueModificationsToEntity("Attack/Ranged/Spread", +this.template.Ranged.Spread, this.entity) *
targetPosition.horizDistanceTo(selfPosition) / this.GetRange(type).max;
targetPosition.horizDistanceTo(selfPosition) / 100;
let randNorm = randomNormal2D();
let offsetX = randNorm[0] * distanceModifiedSpread;

View File

@ -10,7 +10,7 @@
<ProjectileSpeed>75.0</ProjectileSpeed>
<PrepareTime>0</PrepareTime>
<RepeatTime>10000</RepeatTime>
<Spread>1.5</Spread>
<Spread>1.0</Spread>
</Ranged>
</Attack>
<BuildingAI>

View File

@ -20,7 +20,7 @@
<ProjectileSpeed>75.0</ProjectileSpeed>
<PrepareTime>1200</PrepareTime>
<RepeatTime>2000</RepeatTime>
<Spread>2.0</Spread>
<Spread>1.5</Spread>
<PreferredClasses datatype="tokens">Human</PreferredClasses>
</Ranged>
</Attack>

View File

@ -2,16 +2,7 @@
<Entity parent="template_unit_cavalry">
<Attack>
<Ranged>
<Hack>0.0</Hack>
<Pierce>9.0</Pierce>
<Crush>0.0</Crush>
<MaxRange>16.0</MaxRange>
<MinRange>0.0</MinRange>
<ProjectileSpeed>75.0</ProjectileSpeed>
<PrepareTime>1000</PrepareTime>
<RepeatTime>1500</RepeatTime>
<PreferredClasses datatype="tokens">Human</PreferredClasses>
<Spread>1.6</Spread>
</Ranged>
</Attack>
<Health>

View File

@ -6,10 +6,11 @@
<Pierce>7.0</Pierce>
<Crush>0</Crush>
<MaxRange>72.0</MaxRange>
<MinRange>0.0</MinRange>
<ProjectileSpeed>75.0</ProjectileSpeed>
<PrepareTime>500</PrepareTime>
<RepeatTime>1000</RepeatTime>
<Spread>2.2</Spread>
<Spread>3.0</Spread>
</Ranged>
</Attack>
<Cost>

View File

@ -6,10 +6,11 @@
<Pierce>20.0</Pierce>
<Crush>0</Crush>
<MaxRange>28.0</MaxRange>
<MinRange>0.0</MinRange>
<ProjectileSpeed>62.5</ProjectileSpeed>
<PrepareTime>750</PrepareTime>
<RepeatTime>1250</RepeatTime>
<Spread>1.8</Spread>
<Spread>3.0</Spread>
</Ranged>
</Attack>
<Cost>

View File

@ -10,7 +10,7 @@
<ProjectileSpeed>75.0</ProjectileSpeed>
<PrepareTime>500</PrepareTime>
<RepeatTime>1000</RepeatTime>
<Spread>1.8</Spread>
<Spread>1.0</Spread>
<PreferredClasses datatype="tokens">Human</PreferredClasses>
</Ranged>
</Attack>

View File

@ -10,7 +10,7 @@
<ProjectileSpeed>62.5</ProjectileSpeed>
<PrepareTime>750</PrepareTime>
<RepeatTime>1250</RepeatTime>
<Spread>1.5</Spread>
<Spread>1.0</Spread>
<PreferredClasses datatype="tokens">Human</PreferredClasses>
</Ranged>
</Attack>

View File

@ -10,7 +10,7 @@
<ProjectileSpeed>75.0</ProjectileSpeed>
<PrepareTime>300</PrepareTime>
<RepeatTime>500</RepeatTime>
<Spread>1.2</Spread>
<Spread>1.0</Spread>
<PreferredClasses datatype="tokens">Human</PreferredClasses>
</Ranged>
</Attack>

View File

@ -10,7 +10,7 @@
<ProjectileSpeed>62.5</ProjectileSpeed>
<PrepareTime>500</PrepareTime>
<RepeatTime>1000</RepeatTime>
<Spread>1.1</Spread>
<Spread>1.0</Spread>
<PreferredClasses datatype="tokens">Human</PreferredClasses>
</Ranged>
</Attack>

View File

@ -10,7 +10,7 @@
<ProjectileSpeed>75.0</ProjectileSpeed>
<PrepareTime>1200</PrepareTime>
<RepeatTime>2000</RepeatTime>
<Spread>1.5</Spread>
<Spread>0.5</Spread>
<PreferredClasses datatype="tokens">Human</PreferredClasses>
</Ranged>
</Attack>

View File

@ -10,7 +10,7 @@
<ProjectileSpeed>62.5</ProjectileSpeed>
<PrepareTime>750</PrepareTime>
<RepeatTime>1250</RepeatTime>
<Spread>1.3</Spread>
<Spread>0.5</Spread>
<PreferredClasses datatype="tokens">Human</PreferredClasses>
</Ranged>
</Attack>

View File

@ -10,7 +10,7 @@
<ProjectileSpeed>75.0</ProjectileSpeed>
<PrepareTime>200</PrepareTime>
<RepeatTime>300</RepeatTime>
<Spread>1.0</Spread>
<Spread>0.5</Spread>
<PreferredClasses datatype="tokens">Human</PreferredClasses>
</Ranged>
</Attack>

View File

@ -10,7 +10,7 @@
<ProjectileSpeed>62.5</ProjectileSpeed>
<PrepareTime>600</PrepareTime>
<RepeatTime>1000</RepeatTime>
<Spread>1.0</Spread>
<Spread>0.5</Spread>
<PreferredClasses datatype="tokens">Human</PreferredClasses>
</Ranged>
</Attack>

View File

@ -7,15 +7,6 @@
</Armour>
<Attack>
<Ranged>
<Hack>0</Hack>
<Pierce>1.5</Pierce>
<Crush>0</Crush>
<MaxRange>1.0</MaxRange>
<MinRange>0.0</MinRange>
<ProjectileSpeed>75.0</ProjectileSpeed>
<PrepareTime>750</PrepareTime>
<RepeatTime>1250</RepeatTime>
<Spread>1.6</Spread>
<PreferredClasses datatype="tokens">Human</PreferredClasses>
</Ranged>
</Attack>

View File

@ -14,7 +14,7 @@
<ProjectileSpeed>75.0</ProjectileSpeed>
<PrepareTime>600</PrepareTime>
<RepeatTime>1000</RepeatTime>
<Spread>2.0</Spread>
<Spread>3.0</Spread>
</Ranged>
</Attack>
<Cost>

View File

@ -14,7 +14,7 @@
<ProjectileSpeed>62.5</ProjectileSpeed>
<PrepareTime>750</PrepareTime>
<RepeatTime>1250</RepeatTime>
<Spread>1.3</Spread>
<Spread>3.0</Spread>
</Ranged>
</Attack>
<Cost>

View File

@ -14,7 +14,7 @@
<ProjectileSpeed>62.5</ProjectileSpeed>
<PrepareTime>500</PrepareTime>
<RepeatTime>1000</RepeatTime>
<Spread>1.4</Spread>
<Spread>3.0</Spread>
</Ranged>
</Attack>
<Cost>

View File

@ -10,7 +10,7 @@
<ProjectileSpeed>75.0</ProjectileSpeed>
<PrepareTime>1000</PrepareTime>
<RepeatTime>2000</RepeatTime>
<Spread>1.5</Spread>
<Spread>2.0</Spread>
<PreferredClasses datatype="tokens">Ship Human</PreferredClasses>
</Ranged>
</Attack>

View File

@ -10,7 +10,7 @@
<ProjectileSpeed>37.5</ProjectileSpeed>
<PrepareTime>2000</PrepareTime>
<RepeatTime>5000</RepeatTime>
<Spread>6.0</Spread>
<Spread>4.0</Spread>
<Splash>
<Shape>Circular</Shape>
<Range>10</Range>

View File

@ -10,7 +10,7 @@
<ProjectileSpeed>75.0</ProjectileSpeed>
<PrepareTime>1000</PrepareTime>
<RepeatTime>2000</RepeatTime>
<Spread>1.5</Spread>
<Spread>2.0</Spread>
<PreferredClasses datatype="tokens">Ship Human</PreferredClasses>
</Ranged>
</Attack>

View File

@ -7,7 +7,7 @@
<Crush>25.0</Crush>
<MaxRange>80.0</MaxRange>
<MinRange>8.0</MinRange>
<Spread>2.5</Spread>
<Spread>2.0</Spread>
<ProjectileSpeed>150.0</ProjectileSpeed>
<PrepareTime>3000</PrepareTime>
<RepeatTime>4000</RepeatTime>

View File

@ -10,7 +10,7 @@
<ProjectileSpeed>37.5</ProjectileSpeed>
<PrepareTime>4000</PrepareTime>
<RepeatTime>5000</RepeatTime>
<Spread>6.0</Spread>
<Spread>4.0</Spread>
<Splash>
<Shape>Circular</Shape>
<Range>10</Range>

View File

@ -10,7 +10,7 @@
<ProjectileSpeed>10.0</ProjectileSpeed>
<PrepareTime>2000</PrepareTime>
<RepeatTime>2000</RepeatTime>
<Spread>1.5</Spread>
<Spread>2.0</Spread>
</Ranged>
</Attack>
<Footprint replace="">

View File

@ -244,7 +244,7 @@ def WriteUnit(Name, UnitDict):
if UnitDict["Ranged"] == True and UnitDict["Range"] > 0:
ret += "<td>" + str("%.1f" % float(UnitDict["Range"])) + "</td>"
spread = (float(UnitDict["Spread"]) / float(UnitDict["Range"]))*100.0
spread = float(UnitDict["Spread"])
ret += "<td>" + str("%.1f" % spread) + "</td>"
else:
ret += "<td> - </td><td> - </td>"
@ -425,8 +425,8 @@ for parent in TemplatesByParent:
# range and spread
if tp[1]["Ranged"] == True:
WriteColouredDiff(f, float(tp[1]["Range"]) - float(templates[parent]["Range"]), "negative")
mySpread = (float(tp[1]["Spread"]) / (float(tp[1]["Range"]))*100.0)
parentSpread = (float(templates[parent]["Spread"]) / (float(templates[parent]["Range"]))*100.0)
mySpread = float(tp[1]["Spread"])
parentSpread = float(templates[parent]["Spread"])
WriteColouredDiff(f, mySpread - parentSpread, "positive")
else:
f.write("<td></td><td></td>")