Compare commits

...

4 Commits

Author SHA1 Message Date
JiWoong Sul
d63463a677 feat(i18n): 아레나/명예의전당 번역 추가 2026-01-07 20:22:04 +09:00
JiWoong Sul
307007e164 feat(ui): 명예의 전당 화면 대폭 개선
- HallOfFameScreen UI 리뉴얼
- DeathOverlay 업데이트
2026-01-07 20:21:59 +09:00
JiWoong Sul
6667de56d3 feat(arena): 아레나 화면 및 위젯 개선
- 장비 비교 리스트 UI 개선
- 결과 패널/다이얼로그 업데이트
- 설정 화면 개선
2026-01-07 20:21:54 +09:00
JiWoong Sul
699ae3b7f3 feat(arena): 아레나 서비스 및 아이템 서비스 개선
- ArenaService 로직 확장
- ArenaMatch 모델 업데이트
- ItemService 아레나 지원 추가
2026-01-07 20:21:50 +09:00
10 changed files with 973 additions and 461 deletions

View File

@@ -1322,10 +1322,16 @@ String get hofCleared {
return 'Cleared';
}
String get hofSpells {
if (isKoreanLocale) return '';
if (isJapaneseLocale) return '';
return 'Spells';
String get hofSkills {
if (isKoreanLocale) return '';
if (isJapaneseLocale) return '';
return 'Skills';
}
String get hofNoSkills {
if (isKoreanLocale) return '스킬 없음';
if (isJapaneseLocale) return 'スキルなし';
return 'No Skills';
}
String get hofCombatStats {

View File

@@ -1,5 +1,6 @@
import 'package:asciineverdie/data/skill_data.dart';
import 'package:asciineverdie/src/core/engine/combat_calculator.dart';
import 'package:asciineverdie/src/core/engine/item_service.dart';
import 'package:asciineverdie/src/core/engine/skill_service.dart';
import 'package:asciineverdie/src/core/model/arena_match.dart';
import 'package:asciineverdie/src/core/model/equipment_item.dart';
@@ -668,18 +669,58 @@ class ArenaService {
}
}
// ============================================================================
// 장비 교환
// AI 베팅 슬롯 선택
// ============================================================================
/// 장비 교환 (같은 슬롯끼리)
/// AI가 도전자에게서 약탈할 슬롯 자동 선택
///
/// 승자가 선택한 슬롯의 장비를 서로 교환
/// 도전자의 가장 좋은 장비 슬롯 선택 (무기 제외)
EquipmentSlot selectOpponentBettingSlot(HallOfFameEntry challenger) {
final equipment = challenger.finalEquipment ?? [];
if (equipment.isEmpty) {
// 장비가 없으면 기본 슬롯 (투구)
return EquipmentSlot.helm;
}
// 무기를 제외한 장비 중 가장 높은 점수의 슬롯 선택
EquipmentSlot? bestSlot;
int bestScore = -1;
for (final item in equipment) {
// 무기는 약탈 불가
if (item.slot == EquipmentSlot.weapon) continue;
if (item.isEmpty) continue;
final score = ItemService.calculateEquipmentScore(item);
if (score > bestScore) {
bestScore = score;
bestSlot = item.slot;
}
}
// 유효한 슬롯이 없으면 투구 선택
return bestSlot ?? EquipmentSlot.helm;
}
/// 베팅 가능한 슬롯 목록 반환 (무기 제외)
List<EquipmentSlot> getBettableSlots() {
return EquipmentSlot.values
.where((slot) => slot != EquipmentSlot.weapon)
.toList();
}
// ============================================================================
// 장비 약탈
// ============================================================================
/// 장비 약탈 (승자가 패자의 베팅 슬롯 장비 획득)
///
/// - 승자: 자신이 선택한 슬롯의 패자 장비 획득
/// - 패자: 해당 슬롯 장비 손실 → 기본 장비로 대체
(HallOfFameEntry, HallOfFameEntry) _exchangeEquipment({
required ArenaMatch match,
required bool isVictory,
}) {
final slot = match.bettingSlot;
// 도전자 장비 목록 복사
final challengerEquipment =
List<EquipmentItem>.from(match.challenger.finalEquipment ?? []);
@@ -688,13 +729,29 @@ class ArenaService {
final opponentEquipment =
List<EquipmentItem>.from(match.opponent.finalEquipment ?? []);
// 해당 슬롯의 장비 찾기
final challengerItem = _findItemBySlot(challengerEquipment, slot);
final opponentItem = _findItemBySlot(opponentEquipment, slot);
if (isVictory) {
// 도전자 승리: 도전자가 선택한 슬롯의 상대 장비 획득
final winnerSlot = match.challengerBettingSlot;
final lootedItem = _findItemBySlot(opponentEquipment, winnerSlot);
// 장비 교
_replaceItemInList(challengerEquipment, slot, opponentItem);
_replaceItemInList(opponentEquipment, slot, challengerItem);
// 도전자: 약탈한 장비
_replaceItemInList(challengerEquipment, winnerSlot, lootedItem);
// 상대: 해당 슬롯 기본 장비로 대체
final defaultItem = _createDefaultEquipment(winnerSlot);
_replaceItemInList(opponentEquipment, winnerSlot, defaultItem);
} else {
// 상대 승리: 상대가 선택한 슬롯의 도전자 장비 획득
final winnerSlot = match.opponentBettingSlot;
final lootedItem = _findItemBySlot(challengerEquipment, winnerSlot);
// 상대: 약탈한 장비로 교체
_replaceItemInList(opponentEquipment, winnerSlot, lootedItem);
// 도전자: 해당 슬롯 기본 장비로 대체
final defaultItem = _createDefaultEquipment(winnerSlot);
_replaceItemInList(challengerEquipment, winnerSlot, defaultItem);
}
// 업데이트된 엔트리 생성
final updatedChallenger = match.challenger.copyWith(
@@ -731,4 +788,11 @@ class ArenaService {
// 슬롯이 없으면 추가
equipment.add(newItem);
}
/// 기본 장비 생성 (Common 등급)
///
/// 패자가 장비를 잃었을 때 빈 슬롯 방지용
EquipmentItem _createDefaultEquipment(EquipmentSlot slot) {
return ItemService.createDefaultEquipmentForSlot(slot);
}
}

View File

@@ -279,6 +279,51 @@ class ItemService {
return score;
}
// ============================================================================
// 기본 장비 생성
// ============================================================================
/// 슬롯별 기본 장비 생성 (Common 등급, 레벨 1)
///
/// 아레나에서 패배하여 장비를 잃었을 때 빈 슬롯 방지용
static EquipmentItem createDefaultEquipmentForSlot(EquipmentSlot slot) {
final name = _getDefaultItemName(slot);
const rarity = ItemRarity.common;
// 기본 스탯 (레벨 1 기준)
final stats = switch (slot) {
EquipmentSlot.weapon => const ItemStats(atk: 2, attackSpeed: 1000),
EquipmentSlot.shield => const ItemStats(def: 1, blockRate: 0.05),
_ => const ItemStats(def: 1),
};
return EquipmentItem(
name: name,
slot: slot,
level: 1,
weight: 1,
stats: stats,
rarity: rarity,
);
}
/// 슬롯별 기본 장비 이름
static String _getDefaultItemName(EquipmentSlot slot) {
return switch (slot) {
EquipmentSlot.weapon => 'Wooden Stick',
EquipmentSlot.shield => 'Wooden Shield',
EquipmentSlot.helm => 'Cloth Cap',
EquipmentSlot.hauberk => 'Torn Shirt',
EquipmentSlot.brassairts => 'Cloth Wraps',
EquipmentSlot.vambraces => 'Worn Bracers',
EquipmentSlot.gauntlets => 'Tattered Gloves',
EquipmentSlot.gambeson => 'Ragged Tunic',
EquipmentSlot.cuisses => 'Worn Pants',
EquipmentSlot.greaves => 'Cloth Leggings',
EquipmentSlot.sollerets => 'Worn Sandals',
};
}
// ============================================================================
// 자동 장착
// ============================================================================

View File

@@ -3,12 +3,13 @@ import 'package:asciineverdie/src/core/model/hall_of_fame.dart';
/// 아레나 대전 정보
///
/// 도전자와 상대의 정보, 베팅 슬롯을 포함
/// 도전자와 상대의 정보, 양방향 베팅 슬롯을 포함
class ArenaMatch {
const ArenaMatch({
required this.challenger,
required this.opponent,
required this.bettingSlot,
required this.challengerBettingSlot,
required this.opponentBettingSlot,
});
/// 도전자 (내 캐릭터)
@@ -17,14 +18,21 @@ class ArenaMatch {
/// 상대 캐릭터
final HallOfFameEntry opponent;
/// 베팅 슬롯 (같은 슬롯 교환)
final EquipmentSlot bettingSlot;
/// 도전자 베팅 슬롯 (승리 시 상대에게서 빼앗을 슬롯)
final EquipmentSlot challengerBettingSlot;
/// 상대 베팅 슬롯 (상대 승리 시 도전자에게서 빼앗을 슬롯)
final EquipmentSlot opponentBettingSlot;
/// 도전자 순위
int get challengerRank => 0; // ArenaService에서 계산
/// 상대 순위
int get opponentRank => 0; // ArenaService에서 계산
/// 기존 bettingSlot 호환용 (deprecated)
@Deprecated('Use challengerBettingSlot instead')
EquipmentSlot get bettingSlot => challengerBettingSlot;
}
/// 아레나 대전 결과

View File

@@ -55,9 +55,12 @@ class _ArenaSetupScreenState extends State<ArenaSetupScreen> {
/// 자동 결정된 상대
HallOfFameEntry? _opponent;
/// 선택된 베팅 슬롯
/// 선택된 베팅 슬롯 (도전자가 상대에게서 뺏을 슬롯)
EquipmentSlot? _selectedSlot;
/// 상대가 선택한 베팅 슬롯 (패배 시 뺏길 슬롯)
EquipmentSlot? _opponentBettingSlot;
@override
void initState() {
super.initState();
@@ -71,9 +74,13 @@ class _ArenaSetupScreenState extends State<ArenaSetupScreen> {
void _selectChallenger(HallOfFameEntry entry) {
final opponent = _arenaService.findOpponent(widget.hallOfFame, entry.id);
// AI가 도전자에게서 약탈할 슬롯 미리 계산
final opponentSlot = _arenaService.selectOpponentBettingSlot(entry);
setState(() {
_challenger = entry;
_opponent = opponent;
_opponentBettingSlot = opponentSlot;
_step = 1;
});
}
@@ -81,14 +88,16 @@ class _ArenaSetupScreenState extends State<ArenaSetupScreen> {
void _startBattle() {
if (_challenger == null ||
_opponent == null ||
_selectedSlot == null) {
_selectedSlot == null ||
_opponentBettingSlot == null) {
return;
}
final match = ArenaMatch(
challenger: _challenger!,
opponent: _opponent!,
bettingSlot: _selectedSlot!,
challengerBettingSlot: _selectedSlot!,
opponentBettingSlot: _opponentBettingSlot!,
);
final navigator = Navigator.of(context);
@@ -188,7 +197,7 @@ class _ArenaSetupScreenState extends State<ArenaSetupScreen> {
),
// 상단 캐릭터 정보 (좌우 대칭)
_buildCharacterHeaders(),
// 장비 비교 리스트
// 장비 비교 리스트 (양방향 베팅 표시 포함)
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 12),
@@ -197,6 +206,7 @@ class _ArenaSetupScreenState extends State<ArenaSetupScreen> {
enemyEquipment: _opponent?.finalEquipment,
selectedSlot: _selectedSlot,
recommendedSlot: recommendedSlot,
opponentBettingSlot: _opponentBettingSlot,
onSlotSelected: (slot) {
setState(() => _selectedSlot = slot);
},
@@ -209,14 +219,16 @@ class _ArenaSetupScreenState extends State<ArenaSetupScreen> {
);
}
/// 추천 슬롯 계산 (점수 이득이 가장 큰 슬롯)
/// 추천 슬롯 계산 (점수 이득이 가장 큰 슬롯, 무기 제외)
EquipmentSlot? _calculateRecommendedSlot() {
if (_challenger == null || _opponent == null) return null;
EquipmentSlot? bestSlot;
int maxGain = 0;
for (final slot in EquipmentSlot.values) {
// 베팅 가능한 슬롯만 검사 (무기 제외)
final bettableSlots = _arenaService.getBettableSlots();
for (final slot in bettableSlots) {
final myItem = _findItem(slot, _challenger!.finalEquipment);
final enemyItem = _findItem(slot, _opponent!.finalEquipment);

View File

@@ -11,6 +11,7 @@ const _myEquipmentTitle = 'MY EQUIPMENT';
const _enemyEquipmentTitle = 'ENEMY EQUIPMENT';
const _selectedLabel = 'SELECTED';
const _recommendedLabel = 'BEST';
const _weaponLockedLabel = 'LOCKED';
/// 좌우 대칭 장비 비교 리스트
///
@@ -24,6 +25,7 @@ class ArenaEquipmentCompareList extends StatefulWidget {
required this.selectedSlot,
required this.onSlotSelected,
this.recommendedSlot,
this.opponentBettingSlot,
});
/// 내 장비 목록
@@ -32,7 +34,7 @@ class ArenaEquipmentCompareList extends StatefulWidget {
/// 상대 장비 목록
final List<EquipmentItem>? enemyEquipment;
/// 현재 선택된 슬롯
/// 현재 선택된 슬롯 (내가 상대에게서 뺏을 슬롯)
final EquipmentSlot? selectedSlot;
/// 슬롯 선택 콜백
@@ -41,6 +43,9 @@ class ArenaEquipmentCompareList extends StatefulWidget {
/// 추천 슬롯 (점수 이득이 가장 큰 슬롯)
final EquipmentSlot? recommendedSlot;
/// 상대가 선택한 슬롯 (패배 시 내가 잃을 슬롯)
final EquipmentSlot? opponentBettingSlot;
@override
State<ArenaEquipmentCompareList> createState() =>
_ArenaEquipmentCompareListState();
@@ -162,6 +167,14 @@ class _ArenaEquipmentCompareListState extends State<ArenaEquipmentCompareList> {
final isSelected = widget.selectedSlot == slot;
final isRecommended = widget.recommendedSlot == slot;
// 무기 슬롯은 선택 불가 (보호됨)
final isLocked = slot == EquipmentSlot.weapon;
// 양방향 베팅 상태
final isMyTarget = isSelected; // 내가 선택 = 상대 장비 획득 예정
final isOpponentTarget =
widget.opponentBettingSlot == slot; // 상대가 선택 = 내 장비 손실 예정
final myScore =
myItem != null ? ItemService.calculateEquipmentScore(myItem) : 0;
final enemyScore =
@@ -172,7 +185,9 @@ class _ArenaEquipmentCompareListState extends State<ArenaEquipmentCompareList> {
children: [
// 슬롯 행 (좌우 대칭)
GestureDetector(
onTap: () {
onTap: isLocked
? null
: () {
// 탭하면 즉시 선택 + 확장 + 자동 스크롤
widget.onSlotSelected(slot);
setState(() {
@@ -188,10 +203,8 @@ class _ArenaEquipmentCompareListState extends State<ArenaEquipmentCompareList> {
child: Container(
padding: const EdgeInsets.symmetric(vertical: 6, horizontal: 4),
decoration: BoxDecoration(
color: isSelected
? RetroColors.goldOf(context).withValues(alpha: 0.2)
: isRecommended
? Colors.green.withValues(alpha: 0.1)
color: isLocked
? RetroColors.borderOf(context).withValues(alpha: 0.1)
: isExpanded
? RetroColors.panelBgOf(context)
: Colors.transparent,
@@ -203,34 +216,98 @@ class _ArenaEquipmentCompareListState extends State<ArenaEquipmentCompareList> {
),
child: Row(
children: [
// 내 장비
Expanded(child: _buildEquipmentCell(context, myItem, myScore, Colors.blue)),
// 내 장비 (상대가 노리면 빨간 배경)
Expanded(
child: _buildEquipmentCell(
context,
myItem,
myScore,
Colors.blue,
isLocked: isLocked,
isTargetedByOpponent: isOpponentTarget,
),
),
// 슬롯 아이콘 (중앙)
_buildSlotIndicator(context, slot, isSelected, isRecommended, scoreDiff),
// 상대 장비
Expanded(child: _buildEquipmentCell(context, enemyItem, enemyScore, Colors.red)),
_buildSlotIndicator(
context,
slot,
isSelected,
isRecommended,
scoreDiff,
isLocked: isLocked,
isOpponentTarget: isOpponentTarget,
),
// 상대 장비 (내가 선택하거나 추천이면 녹색 배경)
Expanded(
child: _buildEquipmentCell(
context,
enemyItem,
enemyScore,
Colors.red,
isLocked: isLocked,
isMyTarget: isMyTarget,
isRecommended: isRecommended && !isMyTarget,
),
),
],
),
),
),
// 확장된 비교 패널
if (isExpanded)
// 확장된 비교 패널 (잠긴 슬롯은 확장 불가)
if (isExpanded && !isLocked)
_buildExpandedPanel(context, slot, myItem, enemyItem, scoreDiff),
],
);
}
/// 장비 셀 (한쪽)
///
/// [isTargetedByOpponent] 상대가 이 슬롯을 노림 (좌측 - 내 장비 손실)
/// [isMyTarget] 내가 이 슬롯을 선택함 (우측 - 상대 장비 획득)
/// [isRecommended] 추천 슬롯 (우측 - 획득 추천)
Widget _buildEquipmentCell(
BuildContext context,
EquipmentItem? item,
int score,
Color accentColor,
) {
Color accentColor, {
bool isLocked = false,
bool isTargetedByOpponent = false,
bool isMyTarget = false,
bool isRecommended = false,
}) {
final hasItem = item != null && item.isNotEmpty;
final rarityColor = hasItem ? _getRarityColor(item.rarity) : Colors.grey;
return Row(
// 배경색 결정
Color? bgColor;
Color? borderColor;
if (!isLocked) {
if (isTargetedByOpponent) {
bgColor = Colors.red.withValues(alpha: 0.2); // 손실 예정
borderColor = Colors.red.withValues(alpha: 0.5);
} else if (isMyTarget) {
bgColor = Colors.green.withValues(alpha: 0.25); // 획득 예정
borderColor = Colors.green.withValues(alpha: 0.6);
} else if (isRecommended) {
bgColor = Colors.green.withValues(alpha: 0.15); // 추천
borderColor = Colors.green.withValues(alpha: 0.4);
}
}
final textColor = isLocked
? RetroColors.textMutedOf(context)
: hasItem
? rarityColor
: RetroColors.textMutedOf(context);
return Container(
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 6),
decoration: BoxDecoration(
color: bgColor,
borderRadius: BorderRadius.circular(4),
border: borderColor != null ? Border.all(color: borderColor) : null,
),
child: Row(
children: [
// 아이템 이름
Expanded(
@@ -238,8 +315,8 @@ class _ArenaEquipmentCompareListState extends State<ArenaEquipmentCompareList> {
hasItem ? item.name : '-',
style: TextStyle(
fontFamily: 'PressStart2P',
fontSize: 5,
color: hasItem ? rarityColor : RetroColors.textMutedOf(context),
fontSize: 6,
color: textColor,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
@@ -250,13 +327,16 @@ class _ArenaEquipmentCompareListState extends State<ArenaEquipmentCompareList> {
'$score',
style: TextStyle(
fontFamily: 'PressStart2P',
fontSize: 5,
color: hasItem
fontSize: 6,
color: isLocked
? RetroColors.textMutedOf(context)
: hasItem
? RetroColors.textSecondaryOf(context)
: RetroColors.textMutedOf(context),
),
),
],
),
);
}
@@ -266,14 +346,27 @@ class _ArenaEquipmentCompareListState extends State<ArenaEquipmentCompareList> {
EquipmentSlot slot,
bool isSelected,
bool isRecommended,
int scoreDiff,
) {
int scoreDiff, {
bool isLocked = false,
bool isOpponentTarget = false,
}) {
final Color borderColor;
final Color bgColor;
if (isSelected) {
if (isLocked) {
borderColor = RetroColors.borderOf(context).withValues(alpha: 0.5);
bgColor = RetroColors.borderOf(context).withValues(alpha: 0.1);
} else if (isSelected && isOpponentTarget) {
// 양쪽 모두 선택 - 금색 테두리 유지
borderColor = RetroColors.goldOf(context);
bgColor = RetroColors.goldOf(context).withValues(alpha: 0.3);
} else if (isSelected) {
borderColor = RetroColors.goldOf(context);
bgColor = RetroColors.goldOf(context).withValues(alpha: 0.3);
} else if (isOpponentTarget) {
// 상대만 선택 - 빨간 표시
borderColor = Colors.red.withValues(alpha: 0.7);
bgColor = Colors.red.withValues(alpha: 0.15);
} else if (isRecommended) {
borderColor = Colors.green;
bgColor = Colors.green.withValues(alpha: 0.2);
@@ -295,14 +388,26 @@ class _ArenaEquipmentCompareListState extends State<ArenaEquipmentCompareList> {
children: [
// 슬롯 아이콘
Icon(
_getSlotIcon(slot),
isLocked ? Icons.lock : _getSlotIcon(slot),
size: 12,
color: isSelected
color: isLocked
? RetroColors.textMutedOf(context)
: isSelected
? RetroColors.goldOf(context)
: RetroColors.textSecondaryOf(context),
),
const SizedBox(height: 2),
// 점수 변화
// 잠금 표시 또는 점수 변화
if (isLocked)
Text(
_weaponLockedLabel,
style: TextStyle(
fontFamily: 'PressStart2P',
fontSize: 4,
color: RetroColors.textMutedOf(context),
),
)
else
_buildScoreDiffBadge(context, scoreDiff, isRecommended),
],
),

View File

@@ -33,7 +33,10 @@ class ArenaResultDialog extends StatelessWidget {
Widget build(BuildContext context) {
final isVictory = result.isVictory;
final resultColor = isVictory ? Colors.amber : Colors.red;
final slot = result.match.bettingSlot;
// 승패에 따라 교환 슬롯 결정
final slot = isVictory
? result.match.challengerBettingSlot
: result.match.opponentBettingSlot;
return AlertDialog(
backgroundColor: RetroColors.panelBgOf(context),

View File

@@ -243,9 +243,15 @@ class _ArenaResultPanelState extends State<ArenaResultPanel>
}
Widget _buildExchangeSection(BuildContext context) {
final slot = widget.result.match.bettingSlot;
final isVictory = widget.result.isVictory;
// 승패에 따라 교환 슬롯 결정
// 승리: 도전자가 선택한 슬롯(상대에게서 약탈)
// 패배: 상대가 선택한 슬롯(도전자에게서 약탈당함)
final slot = isVictory
? widget.result.match.challengerBettingSlot
: widget.result.match.opponentBettingSlot;
// 도전자의 교환 결과
final oldItem = _findItem(
widget.result.match.challenger.finalEquipment,

View File

@@ -94,8 +94,9 @@ class DeathOverlay extends StatelessWidget {
],
),
),
// 본문
SingleChildScrollView(
// 본문 (스크롤 가능)
Flexible(
child: SingleChildScrollView(
padding: const EdgeInsets.all(16),
child: Column(
mainAxisSize: MainAxisSize.min,
@@ -134,6 +135,7 @@ class DeathOverlay extends StatelessWidget {
],
),
),
),
],
),
),

File diff suppressed because it is too large Load Diff