enhance(drop-and-fusion): ゲームバランスの調整など
This commit is contained in:
parent
0283142d0e
commit
945d6a2b09
|
@ -63,8 +63,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
throw new ApiError(meta.errors.invalidSeed);
|
throw new ApiError(meta.errors.invalidSeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
// シードが古すぎる(1時間以上前)のも弾く
|
// シードが古すぎる(5時間以上前)のも弾く
|
||||||
if (seedDate.getTime() < now.getTime() - 1000 * 60 * 60) {
|
if (seedDate.getTime() < now.getTime() - 1000 * 60 * 60 * 5) {
|
||||||
throw new ApiError(meta.errors.invalidSeed);
|
throw new ApiError(meta.errors.invalidSeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -496,7 +496,7 @@ const SWEETS_MONOS: FrontendMonoDefinition[] = [{
|
||||||
}];
|
}];
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
gameMode: 'normal' | 'square' | 'yen' | 'sweets';
|
gameMode: 'normal' | 'square' | 'yen' | 'sweets' | 'space';
|
||||||
mute: boolean;
|
mute: boolean;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
@ -509,6 +509,7 @@ const monoDefinitions = computed(() => {
|
||||||
props.gameMode === 'square' ? SQUARE_MONOS :
|
props.gameMode === 'square' ? SQUARE_MONOS :
|
||||||
props.gameMode === 'yen' ? YEN_MONOS :
|
props.gameMode === 'yen' ? YEN_MONOS :
|
||||||
props.gameMode === 'sweets' ? SWEETS_MONOS :
|
props.gameMode === 'sweets' ? SWEETS_MONOS :
|
||||||
|
props.gameMode === 'space' ? NORAML_MONOS :
|
||||||
[] as never;
|
[] as never;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<option value="square">SQUARE</option>
|
<option value="square">SQUARE</option>
|
||||||
<option value="yen">YEN</option>
|
<option value="yen">YEN</option>
|
||||||
<option value="sweets">SWEETS</option>
|
<option value="sweets">SWEETS</option>
|
||||||
|
<!--<option value="space">SPACE</option>-->
|
||||||
</MkSelect>
|
</MkSelect>
|
||||||
<MkButton primary gradate large rounded inline @click="start">{{ i18n.ts.start }}</MkButton>
|
<MkButton primary gradate large rounded inline @click="start">{{ i18n.ts.start }}</MkButton>
|
||||||
</div>
|
</div>
|
||||||
|
@ -94,7 +95,7 @@ import MkSelect from '@/components/MkSelect.vue';
|
||||||
import MkSwitch from '@/components/MkSwitch.vue';
|
import MkSwitch from '@/components/MkSwitch.vue';
|
||||||
import { misskeyApiGet } from '@/scripts/misskey-api.js';
|
import { misskeyApiGet } from '@/scripts/misskey-api.js';
|
||||||
|
|
||||||
const gameMode = ref<'normal' | 'square' | 'yen' | 'sweets'>('normal');
|
const gameMode = ref<'normal' | 'square' | 'yen' | 'sweets' | 'space'>('normal');
|
||||||
const gameStarted = ref(false);
|
const gameStarted = ref(false);
|
||||||
const mute = ref(false);
|
const mute = ref(false);
|
||||||
const ranking = ref(null);
|
const ranking = ref(null);
|
||||||
|
@ -108,6 +109,7 @@ function getScoreUnit(gameMode: string) {
|
||||||
gameMode === 'square' ? 'pt' :
|
gameMode === 'square' ? 'pt' :
|
||||||
gameMode === 'yen' ? '円' :
|
gameMode === 'yen' ? '円' :
|
||||||
gameMode === 'sweets' ? 'kcal' :
|
gameMode === 'sweets' ? 'kcal' :
|
||||||
|
gameMode === 'space' ? 'pt' :
|
||||||
'' as never;
|
'' as never;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ type Log = {
|
||||||
operation: 'surrender';
|
operation: 'surrender';
|
||||||
};
|
};
|
||||||
|
|
||||||
const NORMAL_BASE_SIZE = 30;
|
const NORMAL_BASE_SIZE = 32;
|
||||||
const NORAML_MONOS: Mono[] = [{
|
const NORAML_MONOS: Mono[] = [{
|
||||||
id: '9377076d-c980-4d83-bdaf-175bc58275b7',
|
id: '9377076d-c980-4d83-bdaf-175bc58275b7',
|
||||||
level: 10,
|
level: 10,
|
||||||
|
@ -114,7 +114,7 @@ const NORAML_MONOS: Mono[] = [{
|
||||||
dropCandidate: true,
|
dropCandidate: true,
|
||||||
}];
|
}];
|
||||||
|
|
||||||
const YEN_BASE_SIZE = 30;
|
const YEN_BASE_SIZE = 32;
|
||||||
const YEN_SATSU_BASE_SIZE = 70;
|
const YEN_SATSU_BASE_SIZE = 70;
|
||||||
const YEN_MONOS: Mono[] = [{
|
const YEN_MONOS: Mono[] = [{
|
||||||
id: '880f9bd9-802f-4135-a7e1-fd0e0331f726',
|
id: '880f9bd9-802f-4135-a7e1-fd0e0331f726',
|
||||||
|
@ -1003,7 +1003,7 @@ export class DropAndFusionGame extends EventEmitter<{
|
||||||
private tickCallbackQueue: { frame: number; callback: () => void; }[] = [];
|
private tickCallbackQueue: { frame: number; callback: () => void; }[] = [];
|
||||||
private overflowCollider: Matter.Body;
|
private overflowCollider: Matter.Body;
|
||||||
private isGameOver = false;
|
private isGameOver = false;
|
||||||
private gameMode: 'normal' | 'yen' | 'square' | 'sweets';
|
private gameMode: 'normal' | 'yen' | 'square' | 'sweets' | 'space';
|
||||||
private rng: () => number;
|
private rng: () => number;
|
||||||
private logs: Log[] = [];
|
private logs: Log[] = [];
|
||||||
|
|
||||||
|
@ -1031,6 +1031,7 @@ export class DropAndFusionGame extends EventEmitter<{
|
||||||
case 'yen': return YEN_MONOS;
|
case 'yen': return YEN_MONOS;
|
||||||
case 'square': return SQUARE_MONOS;
|
case 'square': return SQUARE_MONOS;
|
||||||
case 'sweets': return SWEETS_MONOS;
|
case 'sweets': return SWEETS_MONOS;
|
||||||
|
case 'space': return NORAML_MONOS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1071,13 +1072,15 @@ export class DropAndFusionGame extends EventEmitter<{
|
||||||
this.getMonoRenderOptions = env.getMonoRenderOptions ?? null;
|
this.getMonoRenderOptions = env.getMonoRenderOptions ?? null;
|
||||||
this.rng = seedrandom(env.seed);
|
this.rng = seedrandom(env.seed);
|
||||||
|
|
||||||
|
// sweetsモードは重いため
|
||||||
|
const physicsQualityFactor = this.gameMode === 'sweets' ? 4 : this.PHYSICS_QUALITY_FACTOR;
|
||||||
this.engine = Matter.Engine.create({
|
this.engine = Matter.Engine.create({
|
||||||
constraintIterations: 2 * this.PHYSICS_QUALITY_FACTOR,
|
constraintIterations: 2 * physicsQualityFactor,
|
||||||
positionIterations: 6 * this.PHYSICS_QUALITY_FACTOR,
|
positionIterations: 6 * physicsQualityFactor,
|
||||||
velocityIterations: 4 * this.PHYSICS_QUALITY_FACTOR,
|
velocityIterations: 4 * physicsQualityFactor,
|
||||||
gravity: {
|
gravity: {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: 1,
|
y: this.gameMode === 'space' ? 0.0125 : 1,
|
||||||
},
|
},
|
||||||
timing: {
|
timing: {
|
||||||
timeScale: 2,
|
timeScale: 2,
|
||||||
|
@ -1092,7 +1095,7 @@ export class DropAndFusionGame extends EventEmitter<{
|
||||||
label: '_wall_',
|
label: '_wall_',
|
||||||
isStatic: true,
|
isStatic: true,
|
||||||
friction: 0.7,
|
friction: 0.7,
|
||||||
slop: 1.0,
|
slop: this.gameMode === 'space' ? 0.01 : 0.7,
|
||||||
render: {
|
render: {
|
||||||
strokeStyle: 'transparent',
|
strokeStyle: 'transparent',
|
||||||
fillStyle: 'transparent',
|
fillStyle: 'transparent',
|
||||||
|
@ -1130,13 +1133,12 @@ export class DropAndFusionGame extends EventEmitter<{
|
||||||
private createBody(mono: Mono, x: number, y: number) {
|
private createBody(mono: Mono, x: number, y: number) {
|
||||||
const options: Matter.IBodyDefinition = {
|
const options: Matter.IBodyDefinition = {
|
||||||
label: mono.id,
|
label: mono.id,
|
||||||
//density: 0.0005,
|
density: this.gameMode === 'space' ? 0.01 : ((mono.sizeX * mono.sizeY) / 10000),
|
||||||
density: ((mono.sizeX + mono.sizeY) / 2) / 1000,
|
restitution: this.gameMode === 'space' ? 0.5 : 0.2,
|
||||||
restitution: 0.2,
|
frictionAir: this.gameMode === 'space' ? 0 : 0.01,
|
||||||
frictionAir: 0.01,
|
friction: this.gameMode === 'space' ? 0.5 : 0.7,
|
||||||
friction: 0.7,
|
frictionStatic: this.gameMode === 'space' ? 0 : 5,
|
||||||
frictionStatic: 5,
|
slop: this.gameMode === 'space' ? 0.01 : 0.7,
|
||||||
slop: 1.0,
|
|
||||||
//mass: 0,
|
//mass: 0,
|
||||||
render: this.getMonoRenderOptions ? this.getMonoRenderOptions(mono) : undefined,
|
render: this.getMonoRenderOptions ? this.getMonoRenderOptions(mono) : undefined,
|
||||||
};
|
};
|
||||||
|
@ -1327,6 +1329,15 @@ export class DropAndFusionGame extends EventEmitter<{
|
||||||
operation: 'drop',
|
operation: 'drop',
|
||||||
x: inputX,
|
x: inputX,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// add force
|
||||||
|
if (this.gameMode === 'space') {
|
||||||
|
Matter.Body.applyForce(body, body.position, {
|
||||||
|
x: 0,
|
||||||
|
y: (Math.PI * head.mono.sizeX * head.mono.sizeY) / 65536,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
Matter.Composite.add(this.engine.world, body);
|
Matter.Composite.add(this.engine.world, body);
|
||||||
|
|
||||||
this.fusionReadyBodyIds.push(body.id);
|
this.fusionReadyBodyIds.push(body.id);
|
||||||
|
|
Loading…
Reference in New Issue