feat: audit Phase 1 — P0/P1 quick wins
All checks were successful
CI/CD — Build & Deploy / Build & Deploy (push) Successful in 35s
All checks were successful
CI/CD — Build & Deploy / Build & Deploy (push) Successful in 35s
- Fix vitalité: HP initial = 100 + (vitalité-1)×10 - Arme de départ: Bâton de Roseau équipé à la création - Rebalance forge: niv3 200, niv4 400, niv5 700 (−30%) - Confirmation avant vente d'item (confirm dialog) - Fix forge costs dupliqués (shop sellback + inventaire)
This commit is contained in:
@@ -11,6 +11,8 @@ import { LevelThreshold } from './entities/level-threshold.entity';
|
||||
import { CreateCharacterDto } from './dto/create-character.dto';
|
||||
import { DistributeStatsDto } from './dto/distribute-stats.dto';
|
||||
import { User } from '../user/user.entity';
|
||||
import { Item } from '../item/item.entity';
|
||||
import { CharacterItem } from '../item/character-item.entity';
|
||||
import { xpRequiredForLevel } from '../combat/combat.engine';
|
||||
|
||||
const STAT_POOL = 10; // 5 stats × 1 base + 5 points à distribuer
|
||||
@@ -53,6 +55,7 @@ export class CharacterService {
|
||||
throw new ConflictException('Ce joueur possède déjà un personnage');
|
||||
}
|
||||
|
||||
const baseHp = 100 + (dto.vitalite - 1) * 10; // vitalité 1 = 100 HP, chaque point = +10
|
||||
const character = this.characterRepository.create({
|
||||
userId: user.id,
|
||||
name: dto.name,
|
||||
@@ -61,12 +64,29 @@ export class CharacterService {
|
||||
intelligence: dto.intelligence,
|
||||
chance: dto.chance,
|
||||
vitalite: dto.vitalite,
|
||||
hpMax: baseHp,
|
||||
hpCurrent: baseHp,
|
||||
enduranceSaved: 100,
|
||||
lastEnduranceTs: new Date(),
|
||||
enduranceMax: 100,
|
||||
});
|
||||
|
||||
const saved = await this.characterRepository.save(character);
|
||||
|
||||
// Arme de départ — Bâton de Roseau équipé automatiquement
|
||||
const starterWeapon = await this.dataSource.getRepository(Item)
|
||||
.findOne({ where: { name: 'Bâton de Roseau' } });
|
||||
if (starterWeapon) {
|
||||
await this.dataSource.getRepository(CharacterItem).save(
|
||||
this.dataSource.getRepository(CharacterItem).create({
|
||||
characterId: saved.id,
|
||||
itemId: starterWeapon.id,
|
||||
forgeLevel: 0,
|
||||
equipped: true,
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
return {
|
||||
...saved,
|
||||
enduranceCurrent: this.calculateEndurance(saved),
|
||||
|
||||
@@ -13,9 +13,9 @@ const FORGE_BONUS_PER_LEVEL = 2;
|
||||
const FORGE_GOLD_COST: Record<number, number> = {
|
||||
1: 50,
|
||||
2: 100,
|
||||
3: 250,
|
||||
4: 500,
|
||||
5: 1000,
|
||||
3: 200,
|
||||
4: 400,
|
||||
5: 700,
|
||||
};
|
||||
|
||||
const FORGE_ENDURANCE_COST = 10;
|
||||
|
||||
@@ -154,7 +154,7 @@ export class ShopService {
|
||||
if (charItem.equipped) throw new BadRequestException('Déséquipez l\'item avant de le vendre');
|
||||
|
||||
// Prix de vente = base + investissement forge (coûts cumulés * 50%)
|
||||
const FORGE_GOLD_COST: Record<number, number> = { 1: 50, 2: 100, 3: 250, 4: 500, 5: 1000 };
|
||||
const FORGE_GOLD_COST: Record<number, number> = { 1: 50, 2: 100, 3: 200, 4: 400, 5: 700 };
|
||||
let forgeInvestment = 0;
|
||||
for (let i = 1; i <= charItem.forgeLevel; i++) {
|
||||
forgeInvestment += FORGE_GOLD_COST[i] ?? 0;
|
||||
|
||||
Reference in New Issue
Block a user