mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-25 03:29:51 +01:00
feat: armor gradient
This commit is contained in:
1 parent
232fc3140c
commit
dd8875e951
2 files changed
+25
-11
No files matched your search
+9
-9
@@ -4,18 +4,18 @@ const withVanillaExtract = createVanillaExtractPlugin({ tests: /\.css$/ });
|
|||||||
|
|
||||||
/** @type {import('next').NextConfig} */
|
/** @type {import('next').NextConfig} */
|
||||||
const nextConfig = {
|
const nextConfig = {
|
||||||
...withVanillaExtract(),
|
...withVanillaExtract({
|
||||||
|
webpack: (config) => {
|
||||||
|
config.module.rules.push({
|
||||||
|
test: /\.glsl$/,
|
||||||
|
type: 'asset/source',
|
||||||
|
});
|
||||||
|
return config;
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
|
||||||
distDir: 'dist/website',
|
distDir: 'dist/website',
|
||||||
reactStrictMode: false,
|
reactStrictMode: false,
|
||||||
|
|
||||||
webpack: (config) => {
|
|
||||||
config.module.rules.push({
|
|
||||||
test: /\.glsl$/,
|
|
||||||
type: 'asset/source',
|
|
||||||
});
|
|
||||||
return config;
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default nextConfig;
|
export default nextConfig;
|
||||||
@@ -15,13 +15,27 @@ void main() {
|
|||||||
bool twoCaliberRule = caliber > 2.0 * thickness;
|
bool twoCaliberRule = caliber > 2.0 * thickness;
|
||||||
bool threeCaliberRule = caliber > 3.0 * thickness;
|
bool threeCaliberRule = caliber > 3.0 * thickness;
|
||||||
float finalNormalization = twoCaliberRule ? (normalization * 1.4 * caliber) / (2.0 * thickness) : normalization;
|
float finalNormalization = twoCaliberRule ? (normalization * 1.4 * caliber) / (2.0 * thickness) : normalization;
|
||||||
|
float finalPenetration = penetration;
|
||||||
float effectiveArmor = thickness / cos(angle - finalNormalization);
|
float effectiveArmor = thickness / cos(angle - finalNormalization);
|
||||||
|
|
||||||
if(angle < ricochet) {
|
if(angle < ricochet) {
|
||||||
// no auto-ricochet, resume checks
|
// no auto-ricochet, resume checks
|
||||||
if(effectiveArmor <= penetration || threeCaliberRule) {
|
if(threeCaliberRule) {
|
||||||
penetrationChance = 1.0;
|
penetrationChance = 1.0;
|
||||||
|
} else {
|
||||||
|
float maxRandomPenetrationBuff = finalPenetration * 0.05;
|
||||||
|
float penetrationDifference = effectiveArmor - finalPenetration;
|
||||||
|
|
||||||
|
if(penetrationDifference > maxRandomPenetrationBuff) {
|
||||||
|
// even with a +5% buff, can't penetrate
|
||||||
|
penetrationChance = 0.0;
|
||||||
|
} else if(penetrationDifference < -maxRandomPenetrationBuff) {
|
||||||
|
// event with a -5% nerf, can penetrate
|
||||||
|
penetrationChance = 1.0;
|
||||||
|
} else {
|
||||||
|
// penetration gradiant
|
||||||
|
penetrationChance = 1.0 - (penetrationDifference + maxRandomPenetrationBuff) / (2.0 * maxRandomPenetrationBuff);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user