Ticket #1908: exponential-armor.patch
File exponential-armor.patch, 9.4 KB (added by , 11 years ago) |
---|
-
binaries/data/mods/public/simulation/components/Armour.js
47 47 if (this.invulnerable) 48 48 return { "killed": false }; 49 49 50 // Adjust damage values based on armour 50 // Adjust damage values based on armour; exponential armour: damage = attack * 0.9^armour 51 51 var armourStrengths = this.GetArmourStrengths(); 52 var adjHack = Math.max(0, hack -armourStrengths.hack);53 var adjPierce = Math.max(0, pierce -armourStrengths.pierce);54 var adjCrush = Math.max(0, crush -armourStrengths.crush);52 var adjHack = hack * Math.pow(0.9, armourStrengths.hack); 53 var adjPierce = pierce * Math.pow(0.9, armourStrengths.pierce); 54 var adjCrush = crush * Math.pow(0.9, armourStrengths.crush); 55 55 56 56 // Total is sum of individual damages, with minimum damage 1 57 57 // Round to nearest integer, since HP is integral -
binaries/data/mods/public/gui/session/selection_details.js
192 192 // Show max attack range if ranged attack, also convert to tiles (4m per tile) 193 193 if (entState.attack && entState.attack.type == "Ranged") 194 194 attack += ", [font=\"serif-bold-13\"]Range:[/font] " + Math.round(entState.attack.maxRange/4); 195 getGUIObjectByName("attackAndArmorStats").tooltip = attack + "\n[font=\"serif-bold-13\"]Armor:[/font] " + damageTypeDetails(entState.armour);195 getGUIObjectByName("attackAndArmorStats").tooltip = attack + "\n[font=\"serif-bold-13\"]Armor:[/font] " + armorTypeDetails(entState.armour); 196 196 197 197 // Icon Tooltip 198 198 var iconTooltip = ""; -
binaries/data/mods/public/gui/session/utility_functions.js
176 176 } 177 177 } 178 178 179 // Converts an armor level into the actual reduction percentage 180 function armorLevelToPercentage(level) 181 { 182 return 100 - Math.round(Math.pow(0.9, level) * 100); 183 } 184 185 // Also for the unit details panel 186 function armorTypeDetails(dmg) 187 { 188 if (dmg) 189 { 190 var dmgArray = []; 191 if (dmg.hack) 192 { 193 dmgArray.push(dmg.hack + "[font=\"sans-10\"][color=\"orange\"] Hack[/color][/font] " + 194 " [font=\"sans-10\"](" + armorLevelToPercentage(dmg.hack) + "%)[/font]"); 195 } 196 if (dmg.pierce) 197 { 198 dmgArray.push(dmg.pierce + "[font=\"sans-10\"][color=\"orange\"] Pierce[/color][/font] " + 199 " [font=\"sans-10\"](" + armorLevelToPercentage(dmg.pierce) + "%)[/font]"); 200 } 201 if (dmg.crush) 202 { 203 dmgArray.push(dmg.crush + "[font=\"sans-10\"][color=\"orange\"] Crush[/color][/font] " + 204 " [font=\"sans-10\"](" + armorLevelToPercentage(dmg.crush) + "%)[/font]"); 205 } 206 207 return dmgArray.join(", "); 208 } 209 else 210 { 211 return "[font=\"serif-12\"](None)[/font]"; 212 } 213 } 214 179 215 // For the training tooltip 180 216 function damageTypesToText(dmg) 181 217 { … … 197 233 return dmgArray.join("[font=\"serif-12\"], [/font]"); 198 234 } 199 235 236 // Also for the training tooltip 237 function armorTypesToText(dmg) 238 { 239 if (!dmg) 240 return "[font=\"serif-12\"](None)[/font]"; 241 242 var hackDamage = dmg.hack; 243 var pierceDamage = dmg.pierce; 244 var crushDamage = dmg.crush; 245 var hackLabel = "[font=\"serif-12\"] Hack (" + armorLevelToPercentage(hackDamage) + "%)[/font]"; 246 var pierceLabel = "[font=\"serif-12\"] Pierce (" + armorLevelToPercentage(pierceDamage) + "%)[/font]"; 247 var crushLabel = "[font=\"serif-12\"] Crush (" + armorLevelToPercentage(crushDamage) + "%)[/font]"; 248 249 var dmgArray = []; 250 if (hackDamage) dmgArray.push(hackDamage + hackLabel); 251 if (pierceDamage) dmgArray.push(pierceDamage + pierceLabel); 252 if (crushDamage) dmgArray.push(crushDamage + crushLabel); 253 254 return dmgArray.join("[font=\"serif-12\"], [/font]"); 255 } 256 200 257 function getEntityCommandsList(entState) 201 258 { 202 259 var commands = []; -
binaries/data/mods/public/gui/session/unit_commands.js
455 455 if (template.health) 456 456 tooltip += "\n[font=\"serif-bold-13\"]Health:[/font] " + template.health; 457 457 if (template.armour) 458 tooltip += "\n[font=\"serif-bold-13\"]Armour:[/font] " + damageTypesToText(template.armour);458 tooltip += "\n[font=\"serif-bold-13\"]Armour:[/font] " + armorTypesToText(template.armour); 459 459 if (template.attack) 460 460 tooltip += "\n" + getEntityAttack(template); 461 461 if (template.speed) -
binaries/data/mods/public/simulation/data/technologies/armor_ship_hullsheathing.json
7 7 "supersedes": "armor_ship_hypozomata", 8 8 "icon": "armor_ship_gold.png", 9 9 "researchTime": 20, 10 "tooltip": "Lead sheathing protects ship hulls. Adds +2to all ship armor types.",10 "tooltip": "Lead sheathing protects ship hulls. +2 levels to all ship armor types.", 11 11 "modifications": [ 12 12 {"value": "Armour/Hack", "add": 2.0}, 13 13 {"value": "Armour/Pierce", "add": 2.0}, -
binaries/data/mods/public/simulation/data/technologies/armor_cav_chamfron.json
13 13 "requirementsTooltip": "Unlocked in City Phase.", 14 14 "icon": "armor_plates_cavalry.png", 15 15 "researchTime": 20, 16 "tooltip": "Equip your cavalry mounts with armo ur. All Cavalry +1 Hack Armour.",16 "tooltip": "Equip your cavalry mounts with armor. All Cavalry +1 Hack armor level.", 17 17 "modifications": [{"value": "Armour/Hack", "add": 1.0}], 18 18 "affects": ["Cavalry"] 19 19 } 20 No newline at end of file -
binaries/data/mods/public/simulation/data/technologies/armor_ship_reinforcedhull.json
6 6 "requirementsTooltip": "Unlocked in Village Phase.", 7 7 "icon": "armor_ship_bronze.png", 8 8 "researchTime": 20, 9 "tooltip": "Wooden reinforcement beams for hulls. Adds +2to all ship armor types.",9 "tooltip": "Wooden reinforcement beams for hulls. +2 levels to all ship armor types.", 10 10 "modifications": [ 11 11 {"value": "Armour/Hack", "add": 2.0}, 12 12 {"value": "Armour/Pierce", "add": 2.0}, -
binaries/data/mods/public/simulation/data/technologies/armor_ship_hypozomata.json
7 7 "supersedes": "armor_ship_reinforcedhull", 8 8 "icon": "armor_ship_silver.png", 9 9 "researchTime": 20, 10 "tooltip": "The hypozomata braces the ship's structure. Adds +2to all ship armor types.",10 "tooltip": "The hypozomata braces the ship's structure. +2 levels to all ship armor types.", 11 11 "modifications": [ 12 12 {"value": "Armour/Hack", "add": 2.0}, 13 13 {"value": "Armour/Pierce", "add": 2.0}, -
binaries/data/mods/public/simulation/data/technologies/armor_trade_convoys.json
6 6 "requirementsTooltip": "Unlocked in City Phase.", 7 7 "icon": "wheel.png", 8 8 "researchTime": 20, 9 "tooltip": "Traders +2 Hack and Pierce Armour",9 "tooltip": "Traders +2 Hack and Pierce armor levels.", 10 10 "modifications": [ 11 11 {"value": "Armour/Hack", "add": 2.0}, 12 12 {"value": "Armour/Pierce", "add": 2.0}], -
binaries/data/mods/public/simulation/data/technologies/siege_armor.json
6 6 "requirementsTooltip": "Unlocked in City Phase.", 7 7 "icon": "armor_plates_gold.png", 8 8 "researchTime": 30, 9 "tooltip": "All Siege weapons +2 Hack Armour",9 "tooltip": "All Siege weapons +2 Hack armor levels.", 10 10 "modifications": [{"value": "Armour/Hack", "add": 5.0}], 11 11 "affects": ["Siege"] 12 12 } 13 No newline at end of file